mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-30 22:34:15 -05:00
chore: Comment fixes (#4634)
This commit is contained in:
parent
3d616e8c6d
commit
a9c7e94a38
5 changed files with 33 additions and 21 deletions
|
@ -43,7 +43,7 @@ var directiveOrder = []string{
|
||||||
"root",
|
"root",
|
||||||
|
|
||||||
"header",
|
"header",
|
||||||
"copy_response_headers",
|
"copy_response_headers", // only in reverse_proxy's handle_response
|
||||||
"request_body",
|
"request_body",
|
||||||
|
|
||||||
"redir",
|
"redir",
|
||||||
|
@ -69,7 +69,7 @@ var directiveOrder = []string{
|
||||||
// handlers that typically respond to requests
|
// handlers that typically respond to requests
|
||||||
"abort",
|
"abort",
|
||||||
"error",
|
"error",
|
||||||
"copy_response",
|
"copy_response", // only in reverse_proxy's handle_response
|
||||||
"respond",
|
"respond",
|
||||||
"metrics",
|
"metrics",
|
||||||
"reverse_proxy",
|
"reverse_proxy",
|
||||||
|
|
|
@ -53,8 +53,8 @@ func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error)
|
||||||
// UnmarshalCaddyfile sets up the handler from Caddyfile tokens. Syntax:
|
// UnmarshalCaddyfile sets up the handler from Caddyfile tokens. Syntax:
|
||||||
//
|
//
|
||||||
// reverse_proxy [<matcher>] [<upstreams...>] {
|
// reverse_proxy [<matcher>] [<upstreams...>] {
|
||||||
// # upstreams
|
// # backends
|
||||||
// to <upstreams...>
|
// to <upstreams...>
|
||||||
// dynamic <name> [...]
|
// dynamic <name> [...]
|
||||||
//
|
//
|
||||||
// # load balancing
|
// # load balancing
|
||||||
|
@ -63,26 +63,28 @@ func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error)
|
||||||
// lb_try_interval <interval>
|
// lb_try_interval <interval>
|
||||||
//
|
//
|
||||||
// # active health checking
|
// # active health checking
|
||||||
// health_uri <uri>
|
// health_uri <uri>
|
||||||
// health_port <port>
|
// health_port <port>
|
||||||
// health_interval <interval>
|
// health_interval <interval>
|
||||||
// health_timeout <duration>
|
// health_timeout <duration>
|
||||||
// health_status <status>
|
// health_status <status>
|
||||||
// health_body <regexp>
|
// health_body <regexp>
|
||||||
// health_headers {
|
// health_headers {
|
||||||
// <field> [<values...>]
|
// <field> [<values...>]
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// # passive health checking
|
// # passive health checking
|
||||||
// max_fails <num>
|
// fail_duration <duration>
|
||||||
// fail_duration <duration>
|
// max_fails <num>
|
||||||
// max_conns <num>
|
// unhealthy_status <status>
|
||||||
// unhealthy_status <status>
|
|
||||||
// unhealthy_latency <duration>
|
// unhealthy_latency <duration>
|
||||||
|
// unhealthy_request_count <num>
|
||||||
//
|
//
|
||||||
// # streaming
|
// # streaming
|
||||||
// flush_interval <duration>
|
// flush_interval <duration>
|
||||||
// buffer_requests
|
// buffer_requests
|
||||||
|
// buffer_responses
|
||||||
|
// max_buffer_size <size>
|
||||||
//
|
//
|
||||||
// # header manipulation
|
// # header manipulation
|
||||||
// trusted_proxies [private_ranges] <ranges...>
|
// trusted_proxies [private_ranges] <ranges...>
|
||||||
|
@ -94,14 +96,23 @@ func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error)
|
||||||
// ...
|
// ...
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// # intercepting responses
|
// # optionally intercept responses from upstream
|
||||||
// @name {
|
// @name {
|
||||||
// status <code...>
|
// status <code...>
|
||||||
// header <field> [<value>]
|
// header <field> [<value>]
|
||||||
// }
|
// }
|
||||||
// replace_status <matcher> <status_code>
|
// replace_status [<matcher>] <status_code>
|
||||||
// handle_response [<matcher>] {
|
// handle_response [<matcher>] {
|
||||||
// <directives...>
|
// <directives...>
|
||||||
|
//
|
||||||
|
// # special directives only available in handle_response
|
||||||
|
// copy_response [<matcher>] [<status>] {
|
||||||
|
// status <status>
|
||||||
|
// }
|
||||||
|
// copy_response_headers [<matcher>] {
|
||||||
|
// include <fields...>
|
||||||
|
// exclude <fields...>
|
||||||
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
@ -1073,6 +1084,7 @@ func parseCopyResponseHeadersCaddyfile(h httpcaddyfile.Helper) (caddyhttp.Middle
|
||||||
// UnmarshalCaddyfile sets up the handler from Caddyfile tokens. Syntax:
|
// UnmarshalCaddyfile sets up the handler from Caddyfile tokens. Syntax:
|
||||||
//
|
//
|
||||||
// copy_response_headers [<matcher>] {
|
// copy_response_headers [<matcher>] {
|
||||||
|
// include <fields...>
|
||||||
// exclude <fields...>
|
// exclude <fields...>
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
|
|
@ -66,7 +66,7 @@ func (h CopyResponseHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request
|
||||||
}
|
}
|
||||||
|
|
||||||
// allow a custom status code to be written; otherwise the
|
// 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 != "" {
|
if codeStr := h.StatusCode.String(); codeStr != "" {
|
||||||
intVal, err := strconv.Atoi(repl.ReplaceAll(codeStr, ""))
|
intVal, err := strconv.Atoi(repl.ReplaceAll(codeStr, ""))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -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
|
// 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
|
// provisioned if it has not already been. Other CA IDs will return an
|
||||||
// error if they have not been previously provisioned.
|
// 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
|
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
|
// 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
|
// provisioned if it has not already been. Other CA IDs will return an
|
||||||
// error if they have not been previously provisioned.
|
// error if they have not been previously provisioned.
|
||||||
|
|
|
@ -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
|
default CA (i.e. 'local'). You may specify the ID of another CA
|
||||||
with the --ca flag.
|
with the --ca flag.
|
||||||
|
|
||||||
Also, this command will attempt to connect to the Caddy's admin API
|
This command will attempt to connect to Caddy's admin API running at
|
||||||
running at '` + caddy.DefaultAdminListen + `' to fetch the root certificate. You may
|
'` + caddy.DefaultAdminListen + `' to fetch the root certificate. You may
|
||||||
explicitly specify the --address, or use the --config flag to load
|
explicitly specify the --address, or use the --config flag to load
|
||||||
the admin address from your config, if not using the default.`,
|
the admin address from your config, if not using the default.`,
|
||||||
Flags: func() *flag.FlagSet {
|
Flags: func() *flag.FlagSet {
|
||||||
|
@ -216,7 +216,7 @@ func rootCertFromAdmin(adminAddr string, caID string) (*x509.Certificate, error)
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
// Decode the resposne
|
// Decode the response
|
||||||
caInfo := new(caInfo)
|
caInfo := new(caInfo)
|
||||||
err = json.NewDecoder(resp.Body).Decode(caInfo)
|
err = json.NewDecoder(resp.Body).Decode(caInfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue