From a9c7e94a38e4f4719a5c1cf7f3e11e8cf427f04e Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Sun, 13 Mar 2022 01:38:11 -0500 Subject: chore: Comment fixes (#4634) --- caddyconfig/httpcaddyfile/directives.go | 4 +-- modules/caddyhttp/reverseproxy/caddyfile.go | 38 +++++++++++++++++--------- modules/caddyhttp/reverseproxy/copyresponse.go | 2 +- modules/caddypki/adminapi.go | 4 +-- modules/caddypki/command.go | 6 ++-- 5 files changed, 33 insertions(+), 21 deletions(-) diff --git a/caddyconfig/httpcaddyfile/directives.go b/caddyconfig/httpcaddyfile/directives.go index b0d7815..aac4f1f 100644 --- a/caddyconfig/httpcaddyfile/directives.go +++ b/caddyconfig/httpcaddyfile/directives.go @@ -43,7 +43,7 @@ var directiveOrder = []string{ "root", "header", - "copy_response_headers", + "copy_response_headers", // only in reverse_proxy's handle_response "request_body", "redir", @@ -69,7 +69,7 @@ var directiveOrder = []string{ // handlers that typically respond to requests "abort", "error", - "copy_response", + "copy_response", // only in reverse_proxy's handle_response "respond", "metrics", "reverse_proxy", diff --git a/modules/caddyhttp/reverseproxy/caddyfile.go b/modules/caddyhttp/reverseproxy/caddyfile.go index cab0a71..af0c564 100644 --- a/modules/caddyhttp/reverseproxy/caddyfile.go +++ b/modules/caddyhttp/reverseproxy/caddyfile.go @@ -53,8 +53,8 @@ func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error) // UnmarshalCaddyfile sets up the handler from Caddyfile tokens. Syntax: // // reverse_proxy [] [] { -// # upstreams -// to +// # backends +// to // dynamic [...] // // # load balancing @@ -63,26 +63,28 @@ func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error) // lb_try_interval // // # active health checking -// health_uri -// health_port +// health_uri +// health_port // health_interval -// health_timeout -// health_status -// health_body +// health_timeout +// health_status +// health_body // health_headers { // [] // } // // # passive health checking -// max_fails -// fail_duration -// max_conns -// unhealthy_status +// fail_duration +// max_fails +// unhealthy_status // unhealthy_latency +// unhealthy_request_count // // # streaming // flush_interval // buffer_requests +// buffer_responses +// max_buffer_size // // # header manipulation // trusted_proxies [private_ranges] @@ -94,14 +96,23 @@ func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error) // ... // } // -// # intercepting responses +// # optionally intercept responses from upstream // @name { // status // header [] // } -// replace_status +// replace_status [] // handle_response [] { // +// +// # special directives only available in handle_response +// copy_response [] [] { +// status +// } +// copy_response_headers [] { +// include +// exclude +// } // } // } // @@ -1073,6 +1084,7 @@ func parseCopyResponseHeadersCaddyfile(h httpcaddyfile.Helper) (caddyhttp.Middle // UnmarshalCaddyfile sets up the handler from Caddyfile tokens. Syntax: // // copy_response_headers [] { +// include // exclude // } // diff --git a/modules/caddyhttp/reverseproxy/copyresponse.go b/modules/caddyhttp/reverseproxy/copyresponse.go index 174ffa7..72a55d4 100644 --- a/modules/caddyhttp/reverseproxy/copyresponse.go +++ b/modules/caddyhttp/reverseproxy/copyresponse.go @@ -66,7 +66,7 @@ func (h CopyResponseHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request } // allow a custom status code to be written; otherwise the - // status code from the upstream resposne is written + // status code from the upstream response is written if codeStr := h.StatusCode.String(); codeStr != "" { intVal, err := strconv.Atoi(repl.ReplaceAll(codeStr, "")) if err != nil { diff --git a/modules/caddypki/adminapi.go b/modules/caddypki/adminapi.go index a79e2d5..b4d2695 100644 --- a/modules/caddypki/adminapi.go +++ b/modules/caddypki/adminapi.go @@ -93,7 +93,7 @@ func (a *adminAPI) handleAPIEndpoints(w http.ResponseWriter, r *http.Request) er } } -// handleCAInfo returns cinformation about a particular +// handleCAInfo returns information about a particular // CA by its ID. If the CA ID is the default, then the CA will be // provisioned if it has not already been. Other CA IDs will return an // error if they have not been previously provisioned. @@ -143,7 +143,7 @@ func (a *adminAPI) handleCAInfo(w http.ResponseWriter, r *http.Request) error { return nil } -// handleCACerts returns cinformation about a particular +// handleCACerts returns the certificate chain for a particular // CA by its ID. If the CA ID is the default, then the CA will be // provisioned if it has not already been. Other CA IDs will return an // error if they have not been previously provisioned. diff --git a/modules/caddypki/command.go b/modules/caddypki/command.go index 4744c68..9b64c61 100644 --- a/modules/caddypki/command.go +++ b/modules/caddypki/command.go @@ -49,8 +49,8 @@ By default, this command installs the root certificate for Caddy's default CA (i.e. 'local'). You may specify the ID of another CA with the --ca flag. -Also, this command will attempt to connect to the Caddy's admin API -running at '` + caddy.DefaultAdminListen + `' to fetch the root certificate. You may +This command will attempt to connect to Caddy's admin API running at +'` + caddy.DefaultAdminListen + `' to fetch the root certificate. You may explicitly specify the --address, or use the --config flag to load the admin address from your config, if not using the default.`, Flags: func() *flag.FlagSet { @@ -216,7 +216,7 @@ func rootCertFromAdmin(adminAddr string, caID string) (*x509.Certificate, error) } defer resp.Body.Close() - // Decode the resposne + // Decode the response caInfo := new(caInfo) err = json.NewDecoder(resp.Body).Decode(caInfo) if err != nil { -- cgit v1.2.3