Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 11, 11:00 UTC
chore: clean up wording and typo fixes (#7745)
* chore: clean up wording and typo fixes * chore: ASCII -> alphanumeric in lexer for heredoc marker
Zen Dodd committed
May 20, 2026 at 16:36 UTC
88037f1666eb9ce1b26453d32dc861cb3a87a4c7
18 files changed
+33
-33
caddyconfig/caddyfile/lexer.go
+2
-2
@@ -155,7 +155,7 @@ func (l *lexer) next() (bool, error) {
155
// want to keep.
156
if ch == '\n' {
157
if len(val) == 2 {
158
- return false, fmt.Errorf("missing opening heredoc marker on line #%d; must contain only alpha-numeric characters, dashes and underscores; got empty string", l.line)
158
+ return false, fmt.Errorf("missing opening heredoc marker on line #%d; must contain only alphanumeric characters, dashes and underscores; got empty string", l.line)
159
}
160
161
// check if there's too many <
@@ -165,7 +165,7 @@ func (l *lexer) next() (bool, error) {
165
166
heredocMarker = string(val[2:])
167
if !heredocMarkerRegexp.Match([]byte(heredocMarker)) {
168
- return false, fmt.Errorf("heredoc marker on line #%d must contain only alpha-numeric characters, dashes and underscores; got '%s'", l.line, heredocMarker)
168
+ return false, fmt.Errorf("heredoc marker on line #%d must contain only alphanumeric characters, dashes and underscores; got '%s'", l.line, heredocMarker)
169
}
170
171
inHeredoc = true
caddyconfig/caddyfile/lexer_test.go
+1
-1
@@ -424,7 +424,7 @@ EOF
424
{
425
input: []byte("not-a-heredoc <<\n"),
426
expectErr: true,
427
- errorMessage: "missing opening heredoc marker on line #1; must contain only alpha-numeric characters, dashes and underscores; got empty string",
427
+ errorMessage: "missing opening heredoc marker on line #1; must contain only alphanumeric characters, dashes and underscores; got empty string",
428
},
429
{
430
input: []byte(`heredoc <<<EOF
caddyconfig/caddyfile/parse.go
+1
-1
@@ -683,7 +683,7 @@ func (p *parser) directive() error {
683
// openCurlyBrace expects the current token to be an
684
// opening curly brace. This acts like an assertion
685
// because it returns an error if the token is not
686
-// a opening curly brace. It does NOT advance the token.
686
+// an opening curly brace. It does NOT advance the token.
687
func (p *parser) openCurlyBrace() error {
688
if p.Val() != "{" {
689
if p.valLooksLikeGlobalOptionsAfterImportedSnippets() {
caddytest/caddytest.go
+6
-6
@@ -518,7 +518,7 @@ func (tc *Tester) AssertResponseCode(req *http.Request, expectedStatusCode int)
518
return resp
519
}
520
521
-// AssertResponse request a URI and assert the status code and the body contains a string
521
+// AssertResponse requests a URI and asserts the status code and body.
522
func (tc *Tester) AssertResponse(req *http.Request, expectedStatusCode int, expectedBody string) (*http.Response, string) {
523
tc.t.Helper()
524
@@ -541,7 +541,7 @@ func (tc *Tester) AssertResponse(req *http.Request, expectedStatusCode int, expe
541
542
// Verb specific test functions
543
544
-// AssertGetResponse GET a URI and expect a statusCode and body text
544
+// AssertGetResponse requests a URI with GET and expects a status code and body text.
545
func (tc *Tester) AssertGetResponse(requestURI string, expectedStatusCode int, expectedBody string) (*http.Response, string) {
546
tc.t.Helper()
547
@@ -553,7 +553,7 @@ func (tc *Tester) AssertGetResponse(requestURI string, expectedStatusCode int, e
553
return tc.AssertResponse(req, expectedStatusCode, expectedBody)
554
}
555
556
-// AssertDeleteResponse request a URI and expect a statusCode and body text
556
+// AssertDeleteResponse requests a URI with DELETE and expects a status code and body text.
557
func (tc *Tester) AssertDeleteResponse(requestURI string, expectedStatusCode int, expectedBody string) (*http.Response, string) {
558
tc.t.Helper()
559
@@ -565,7 +565,7 @@ func (tc *Tester) AssertDeleteResponse(requestURI string, expectedStatusCode int
565
return tc.AssertResponse(req, expectedStatusCode, expectedBody)
566
}
567
568
-// AssertPostResponseBody POST to a URI and assert the response code and body
568
+// AssertPostResponseBody requests a URI with POST and asserts the response code and body.
569
func (tc *Tester) AssertPostResponseBody(requestURI string, requestHeaders []string, requestBody *bytes.Buffer, expectedStatusCode int, expectedBody string) (*http.Response, string) {
570
tc.t.Helper()
571
@@ -580,7 +580,7 @@ func (tc *Tester) AssertPostResponseBody(requestURI string, requestHeaders []str
580
return tc.AssertResponse(req, expectedStatusCode, expectedBody)
581
}
582
583
-// AssertPutResponseBody PUT to a URI and assert the response code and body
583
+// AssertPutResponseBody requests a URI with PUT and asserts the response code and body.
584
func (tc *Tester) AssertPutResponseBody(requestURI string, requestHeaders []string, requestBody *bytes.Buffer, expectedStatusCode int, expectedBody string) (*http.Response, string) {
585
tc.t.Helper()
586
@@ -595,7 +595,7 @@ func (tc *Tester) AssertPutResponseBody(requestURI string, requestHeaders []stri
595
return tc.AssertResponse(req, expectedStatusCode, expectedBody)
596
}
597
598
-// AssertPatchResponseBody PATCH to a URI and assert the response code and body
598
+// AssertPatchResponseBody requests a URI with PATCH and asserts the response code and body.
599
func (tc *Tester) AssertPatchResponseBody(requestURI string, requestHeaders []string, requestBody *bytes.Buffer, expectedStatusCode int, expectedBody string) (*http.Response, string) {
600
tc.t.Helper()
601
caddytest/integration/caddyfile_adapt/heredoc_invalid_marker.caddyfiletest
+1
-1
@@ -6,4 +6,4 @@ handle {
6
END!
7
}
8
----------
9
-heredoc marker on line #4 must contain only alpha-numeric characters, dashes and underscores; got 'END!'
\ No newline at end of file
9
+heredoc marker on line #4 must contain only alphanumeric characters, dashes and underscores; got 'END!'
caddytest/integration/stream_test.go
+1
-1
@@ -159,7 +159,7 @@ func testH2ToH2CStreamServeH2C(t *testing.T) *http.Server {
159
}
160
// We only accept HTTP/2!
161
if r.ProtoMajor != 2 {
162
- t.Error("Not a HTTP/2 request, rejected!")
162
+ t.Error("Not an HTTP/2 request, rejected!")
163
w.WriteHeader(http.StatusInternalServerError)
164
return
165
}
cmd/commands.go
+1
-1
@@ -566,7 +566,7 @@ argument of --directory. If the directory does not exist, it will be created.
566
// following format:
567
//
568
// - lowercase
569
-// - alphanumeric and hyphen characters only
569
+// - ASCII lowercase letters, digits and hyphens only
570
// - cannot start or end with a hyphen
571
// - hyphen cannot be adjacent to another hyphen
572
//
modules/caddyhttp/celmatcher.go
+3
-3
@@ -108,7 +108,7 @@ func (m *MatchExpression) UnmarshalJSON(data []byte) error {
108
return json.Unmarshal(data, &m.Expr)
109
}
110
// otherwise, it's a full object, so unmarshal it,
111
- // using an temp map to avoid infinite recursion
111
+ // using a temp map to avoid infinite recursion
112
var tmpJson map[string]any
113
err := json.Unmarshal(data, &tmpJson)
114
*m = MatchExpression{
@@ -118,7 +118,7 @@ func (m *MatchExpression) UnmarshalJSON(data []byte) error {
118
return err
119
}
120
121
-// Provision sets ups m.
121
+// Provision sets up m.
122
func (m *MatchExpression) Provision(ctx caddy.Context) error {
123
m.log = ctx.Logger()
124
@@ -319,7 +319,7 @@ func (cr celHTTPRequest) Value() any { return cr }
319
320
var pkixNameCELType = cel.ObjectType("pkix.Name", traits.ReceiverType)
321
322
-// celPkixName wraps an pkix.Name with
322
+// celPkixName wraps a pkix.Name with
323
// methods to satisfy the ref.Val interface.
324
type celPkixName struct{ *pkix.Name }
325
modules/caddyhttp/celmatcher_test.go
+1
-1
@@ -79,7 +79,7 @@ eqp31wM9il1n+guTNyxJd+FzVAH+hCZE5K+tCgVDdVFUlDEHHbS/wqb2PSIoouLV
79
wantResult: true,
80
},
81
{
82
- name: "header matches an placeholder replaced during the header matcher (MatchHeader)",
82
+ name: "header matches a placeholder replaced during the header matcher (MatchHeader)",
83
expression: &MatchExpression{
84
Expr: `header({'Field': '\{http.request.uri.path}'})`,
85
},
modules/caddyhttp/encode/encode.go
+2
-2
@@ -162,7 +162,7 @@ func (enc *Encode) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyh
162
163
// to comply with RFC 9110 section 8.8.3(.3), we modify the Etag when encoding
164
// by appending a hyphen and the encoder name; the problem is, the client will
165
- // send back that Etag in a If-None-Match header, but upstream handlers that set
165
+ // send back that Etag in an If-None-Match header, but upstream handlers that set
166
// the Etag in the first place don't know that we appended to their Etag! so here
167
// we have to strip our addition so the upstream handlers can still honor client
168
// caches without knowing about our changes...
@@ -369,7 +369,7 @@ const sniffLen = 512
369
370
// ReadFrom will try to use sendfile to copy from the reader to the response writer.
371
// It's only used if the response writer implements io.ReaderFrom and the data can't be compressed.
372
-// It's based on stdlin http1.1 response writer implementation.
372
+// It's based on the standard library HTTP/1.1 response writer implementation.
373
// https://github.com/golang/go/blob/f4e3ec3dbe3b8e04a058d266adf8e048bab563f2/src/net/http/server.go#L586
374
func (rw *responseWriter) ReadFrom(r io.Reader) (int64, error) {
375
rf, ok := rw.ResponseWriter.(io.ReaderFrom)
modules/caddyhttp/fileserver/staticfiles.go
+1
-1
@@ -124,7 +124,7 @@ type FileServer struct {
124
// put "hidden" in the list. To hide only ./hidden, put "./hidden" in the list.
125
//
126
// When possible, all paths are resolved to their absolute form before
127
- // comparisons are made. For maximum clarity and explictness, use complete,
127
+ // comparisons are made. For maximum clarity and explicitness, use complete,
128
// absolute paths; or, for greater portability, use relative paths instead.
129
//
130
// Note that hide comparisons are case-sensitive. On case-insensitive
modules/caddyhttp/http2listener.go
+1
-1
@@ -15,7 +15,7 @@ type connectionStater interface {
15
16
// http2Listener wraps the listener to solve the following problems:
17
// 1. prevent genuine h2c connections from succeeding if h2c is not enabled
18
-// and the connection doesn't implment connectionStater or the resulting NegotiatedProtocol
18
+// and the connection doesn't implement connectionStater or the resulting NegotiatedProtocol
19
// isn't http2.
20
// This does allow a connection to pass as tls enabled even if it's not, listener wrappers
21
// can do this.
modules/caddyhttp/httpredirectlistener.go
+1
-1
@@ -101,7 +101,7 @@ type httpRedirectConn struct {
101
102
// Read tries to peek at the first few bytes of the request, and if we get
103
// an error reading the headers, and that error was due to the bytes looking
104
-// like an HTTP request, then we perform a HTTP->HTTPS redirect on the same
104
+// like an HTTP request, then we perform an HTTP->HTTPS redirect on the same
105
// port as the original connection.
106
func (c *httpRedirectConn) Read(p []byte) (int, error) {
107
if c.once {
modules/caddyhttp/reverseproxy/fastcgi/client.go
+5
-5
@@ -135,8 +135,8 @@ type client struct {
135
logger *zap.Logger
136
}
137
138
-// Do made the request and returns a io.Reader that translates the data read
139
-// from fcgi responder out of fcgi packet before returning it.
138
+// Do makes the request and returns an io.Reader that translates the data read
139
+// from the FastCGI responder out of FastCGI packets before returning it.
140
func (c *client) Do(p map[string]string, req io.Reader) (r io.Reader, err error) {
141
// check for CONTENT_LENGTH, since the lack of it or wrong value will cause the backend to hang
142
if clStr, ok := p["CONTENT_LENGTH"]; !ok {
@@ -179,7 +179,7 @@ func (c *client) Do(p map[string]string, req io.Reader) (r io.Reader, err error)
179
return r, err
180
}
181
182
-// clientCloser is a io.ReadCloser. It wraps a io.Reader with a Closer
182
+// clientCloser is an io.ReadCloser. It wraps an io.Reader with a Closer
183
// that closes the client connection.
184
type clientCloser struct {
185
rwc net.Conn
@@ -208,8 +208,8 @@ func (f clientCloser) Close() error {
208
return f.rwc.Close()
209
}
210
211
-// Request returns a HTTP Response with Header and Body
212
-// from fcgi responder
211
+// Request returns an HTTP response with header and body
212
+// from the FastCGI responder.
213
func (c *client) Request(p map[string]string, req io.Reader) (resp *http.Response, err error) {
214
r, err := c.Do(p, req)
215
if err != nil {
modules/caddyhttp/reverseproxy/healthchecks.go
+1
-1
@@ -522,7 +522,7 @@ func (h *Handler) doActiveHealthCheck(dialInfo DialInfo, hostAddr string, networ
522
body = io.LimitReader(body, h.HealthChecks.Active.MaxSize)
523
}
524
defer func() {
525
- // drain any remaining body so connection could be re-used
525
+ // drain any remaining body so connection could be reused
526
_, _ = io.Copy(io.Discard, body)
527
resp.Body.Close()
528
}()
modules/caddyhttp/reverseproxy/selectionpolicies_test.go
+2
-2
@@ -568,7 +568,7 @@ func TestQueryHashPolicy(t *testing.T) {
568
pool[1].setHealthy(false)
569
h = queryPolicy.Select(pool, request, nil)
570
if h != nil {
571
- t.Error("Expected query policy policy host to be nil.")
571
+ t.Error("Expected query policy host to be nil.")
572
}
573
574
request = httptest.NewRequest(http.MethodGet, "/?foo=aa11&foo=bb22", nil)
@@ -630,7 +630,7 @@ func TestURIHashPolicy(t *testing.T) {
630
pool[1].setHealthy(false)
631
h = uriPolicy.Select(pool, request, nil)
632
if h != nil {
633
- t.Error("Expected uri policy policy host to be nil.")
633
+ t.Error("Expected uri policy host to be nil.")
634
}
635
}
636
modules/caddytls/automation.go
+1
-1
@@ -158,7 +158,7 @@ type AutomationPolicy struct {
158
DisableOCSPStapling bool `json:"disable_ocsp_stapling,omitempty"`
159
160
// Overrides the URLs of OCSP responders embedded in certificates.
161
- // Each key is a OCSP server URL to override, and its value is the
161
+ // Each key is an OCSP server URL to override, and its value is the
162
// replacement. An empty value will disable querying of that server.
163
// EXPERIMENTAL. Subject to change.
164
OCSPOverrides map[string]string `json:"ocsp_overrides,omitempty"`
modules/logging/filters.go
+2
-2
@@ -149,10 +149,10 @@ func (f *ReplaceFilter) Filter(in zapcore.Field) zapcore.Field {
149
// list of IP addresses, where all of the values
150
// will be masked.
151
type IPMaskFilter struct {
152
- // The IPv4 mask, as an subnet size CIDR.
152
+ // The IPv4 mask, as a subnet size CIDR.
153
IPv4MaskRaw int `json:"ipv4_cidr,omitempty"`
154
155
- // The IPv6 mask, as an subnet size CIDR.
155
+ // The IPv6 mask, as a subnet size CIDR.
156
IPv6MaskRaw int `json:"ipv6_cidr,omitempty"`
157
158
v4Mask net.IPMask