mirror of
https://github.com/caddyserver/caddy.git
synced 2024-11-22 12:08:28 +08:00
Fix spelling (#2448)
* spelling: access * spelling: associated * spelling: because * spelling: characteristics * spelling: chooses * spelling: cleared * spelling: clustering * spelling: collaborators * spelling: connection * spelling: content * spelling: conversion * spelling: deferring * spelling: detection * spelling: displayed * spelling: dispenser * spelling: heuristic * spelling: nonexistent * spelling: oflisting * spelling: preparses * spelling: response * spelling: responder * spelling: sensitive * spelling: specify * spelling: simple * spelling: spawning * spelling: status * spelling: unsupported * spelling: upstream * spelling: username * spelling: whether
This commit is contained in:
parent
97e1f14dd3
commit
8369a12115
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
|
@ -111,7 +111,7 @@ Note that plugin documentation is not hosted by the Caddy website, other than ba
|
|||
|
||||
## Collaborator Instructions
|
||||
|
||||
Collabators have push rights to the repository. We grant this permission after one or more successful, high-quality PRs are merged! We thank them for their help.The expectations we have of collaborators are:
|
||||
Collaborators have push rights to the repository. We grant this permission after one or more successful, high-quality PRs are merged! We thank them for their help.The expectations we have of collaborators are:
|
||||
|
||||
- **Help review pull requests.** Be meticulous, but also kind. We love our contributors, but we critique the contribution to make it better. Multiple, thorough reviews make for the best contributions! Here are some questions to consider:
|
||||
- Can the change be made more elegant?
|
||||
|
|
|
@ -421,7 +421,7 @@ func TestDirectiveImport(t *testing.T) {
|
|||
t.Error("directive import failed")
|
||||
}
|
||||
|
||||
// import from nonexisting file
|
||||
// import from nonexistent file
|
||||
_, err = testParseOne(`localhost
|
||||
dir1
|
||||
proxy {
|
||||
|
|
|
@ -186,7 +186,7 @@ func (l bySize) Less(i, j int) bool {
|
|||
iSize, jSize := l.Items[i].Size, l.Items[j].Size
|
||||
|
||||
// Directory sizes depend on the filesystem implementation,
|
||||
// which is opaque to a visitor, and should indeed does not change if the operator choses to change the fs.
|
||||
// which is opaque to a visitor, and should indeed does not change if the operator chooses to change the fs.
|
||||
// For a consistent user experience directories are pulled to the front…
|
||||
if l.Items[i].IsDir {
|
||||
iSize = directoryOffset
|
||||
|
|
|
@ -366,25 +366,25 @@ func TestBrowseJson(t *testing.T) {
|
|||
}
|
||||
|
||||
actualJSONResponse := rec.Body.String()
|
||||
copyOflisting := listing
|
||||
copyOfListing := listing
|
||||
if test.SortBy == "" {
|
||||
copyOflisting.Sort = "name"
|
||||
copyOfListing.Sort = "name"
|
||||
} else {
|
||||
copyOflisting.Sort = test.SortBy
|
||||
copyOfListing.Sort = test.SortBy
|
||||
}
|
||||
if test.OrderBy == "" {
|
||||
copyOflisting.Order = "asc"
|
||||
copyOfListing.Order = "asc"
|
||||
} else {
|
||||
copyOflisting.Order = test.OrderBy
|
||||
copyOfListing.Order = test.OrderBy
|
||||
}
|
||||
|
||||
copyOflisting.applySort()
|
||||
copyOfListing.applySort()
|
||||
|
||||
limit := test.Limit
|
||||
if limit <= len(copyOflisting.Items) && limit > 0 {
|
||||
marsh, err = json.Marshal(copyOflisting.Items[:limit])
|
||||
if limit <= len(copyOfListing.Items) && limit > 0 {
|
||||
marsh, err = json.Marshal(copyOfListing.Items[:limit])
|
||||
} else { // if the 'limit' query is empty, or has the wrong value, list everything
|
||||
marsh, err = json.Marshal(copyOflisting.Items)
|
||||
marsh, err = json.Marshal(copyOfListing.Items)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
|
|
@ -53,7 +53,7 @@ func TestSetup(t *testing.T) {
|
|||
// test case #1 tests instantiation of Config with default values
|
||||
{"browse /", []string{"/"}, false},
|
||||
|
||||
// test case #2 tests detectaction of custom template
|
||||
// test case #2 tests detection of custom template
|
||||
{"browse . " + tempTemplatePath, []string{"."}, false},
|
||||
|
||||
// test case #3 tests detection of non-existent template
|
||||
|
|
|
@ -216,7 +216,7 @@ func Dial(network, address string) (fcgi *FCGIClient, err error) {
|
|||
return DialContext(context.Background(), network, address)
|
||||
}
|
||||
|
||||
// Close closes fcgi connnection
|
||||
// Close closes fcgi connection
|
||||
func (c *FCGIClient) Close() {
|
||||
c.rwc.Close()
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ import (
|
|||
// test fcgi protocol includes:
|
||||
// Get, Post, Post in multipart/form-data, and Post with files
|
||||
// each key should be the md5 of the value or the file uploaded
|
||||
// sepicify remote fcgi responer ip:port to test with php
|
||||
// specify remote fcgi responder ip:port to test with php
|
||||
// test failed if the remote fcgi(script) failed md5 verification
|
||||
// and output "FAILED" in response
|
||||
const (
|
||||
|
|
|
@ -114,7 +114,7 @@ outer:
|
|||
return g.Next.ServeHTTP(w, r)
|
||||
}
|
||||
|
||||
// gzipResponeWriter wraps the underlying Write method
|
||||
// gzipResponseWriter wraps the underlying Write method
|
||||
// with a gzip.Writer to compress the output.
|
||||
type gzipResponseWriter struct {
|
||||
internalWriter io.Writer
|
||||
|
|
|
@ -191,7 +191,7 @@ func (m IfMatcher) Or(r *http.Request) bool {
|
|||
}
|
||||
|
||||
// IfMatcherKeyword checks if the next value in the dispenser is a keyword for 'if' config block.
|
||||
// If true, remaining arguments in the dispinser are cleard to keep the dispenser valid for use.
|
||||
// If true, remaining arguments in the dispenser are cleared to keep the dispenser valid for use.
|
||||
func IfMatcherKeyword(c *caddy.Controller) bool {
|
||||
if c.Val() == "if" || c.Val() == "if_op" {
|
||||
// clear remaining args
|
||||
|
|
|
@ -335,7 +335,7 @@ func TestHeuristicFunctionsAndHandler(t *testing.T) {
|
|||
// in other words, if one returns true, the others
|
||||
// should return false, with as little logic as possible,
|
||||
// but with enough logic to force TLS proxies to do a
|
||||
// good job preserving characterstics of the handshake.
|
||||
// good job preserving characteristics of the handshake.
|
||||
if (isChrome && (isFirefox || isSafari || isEdge || isTor)) ||
|
||||
(isFirefox && (isChrome || isSafari || isEdge || isTor)) ||
|
||||
(isSafari && (isChrome || isFirefox || isEdge || isTor)) ||
|
||||
|
|
|
@ -228,7 +228,7 @@ func (h *httpContext) MakeServers() ([]caddy.Server, error) {
|
|||
// make a rough estimate as to whether we're in a "production
|
||||
// environment/system" - start by assuming that most production
|
||||
// servers will set their default CA endpoint to a public,
|
||||
// trusted CA (obviously not a perfect hueristic)
|
||||
// trusted CA (obviously not a perfect heuristic)
|
||||
var looksLikeProductionCA bool
|
||||
for _, publicCAEndpoint := range caddytls.KnownACMECAs {
|
||||
if strings.Contains(certmagic.CA, publicCAEndpoint) {
|
||||
|
|
|
@ -217,7 +217,7 @@ func (rb *ResponseBuffer) ReadFrom(src io.Reader) (int64, error) {
|
|||
// https://go-review.googlesource.com/c/22134#message-ff351762308fe05f6b72a487d6842e3988916486
|
||||
buf := respBufPool.Get().([]byte)
|
||||
n, err := io.CopyBuffer(rb.ResponseWriterWrapper, src, buf)
|
||||
respBufPool.Put(buf) // defer'ing this slowed down benchmarks a smidgin, I think
|
||||
respBufPool.Put(buf) // deferring this slowed down benchmarks a smidgin, I think
|
||||
return n, err
|
||||
}
|
||||
return rb.Buffer.ReadFrom(src)
|
||||
|
|
|
@ -76,7 +76,7 @@ func TestReplace(t *testing.T) {
|
|||
request.Header.Set("CustomAdd", "caddy")
|
||||
request.Header.Set("Cookie", "foo=bar; taste=delicious")
|
||||
|
||||
// add some respons headers
|
||||
// add some response headers
|
||||
recordRequest.Header().Set("Custom", "CustomResponseHeader")
|
||||
|
||||
hostname, err := os.Hostname()
|
||||
|
@ -303,7 +303,7 @@ func BenchmarkReplace(b *testing.B) {
|
|||
request.Header.Set("CustomAdd", "caddy")
|
||||
request.Header.Set("Cookie", "foo=bar; taste=delicious")
|
||||
|
||||
// add some respons headers
|
||||
// add some response headers
|
||||
recordRequest.Header().Set("Custom", "CustomResponseHeader")
|
||||
|
||||
now = func() time.Time {
|
||||
|
@ -336,7 +336,7 @@ func BenchmarkReplaceEscaped(b *testing.B) {
|
|||
request.Header.Set("CustomAdd", "caddy")
|
||||
request.Header.Set("Cookie", "foo=bar; taste=delicious")
|
||||
|
||||
// add some respons headers
|
||||
// add some response headers
|
||||
recordRequest.Header().Set("Custom", "CustomResponseHeader")
|
||||
|
||||
now = func() time.Time {
|
||||
|
@ -473,7 +473,7 @@ func TestRound(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestMillisecondConverstion(t *testing.T) {
|
||||
func TestMillisecondConversion(t *testing.T) {
|
||||
var testCases = map[time.Duration]int64{
|
||||
2 * time.Second: 2000,
|
||||
9039492 * time.Nanosecond: 9,
|
||||
|
|
|
@ -86,7 +86,7 @@ type SiteConfig struct {
|
|||
}
|
||||
|
||||
// Timeouts specify various timeouts for a server to use.
|
||||
// If the assocated bool field is true, then the duration
|
||||
// If the associated bool field is true, then the duration
|
||||
// value should be treated literally (i.e. a zero-value
|
||||
// duration would mean "no timeout"). If false, the duration
|
||||
// was left unset, so a zero-value duration would mean to
|
||||
|
|
|
@ -101,7 +101,7 @@ func TestInclude(t *testing.T) {
|
|||
for i, test := range tests {
|
||||
testPrefix := getTestPrefix(i)
|
||||
|
||||
// WriteFile truncates the contentt
|
||||
// WriteFile truncates the content
|
||||
err := ioutil.WriteFile(absInFilePath, []byte(test.fileContent), os.ModePerm)
|
||||
if err != nil {
|
||||
t.Fatal(testPrefix+"Failed to create test file. Error was: %v", err)
|
||||
|
@ -162,7 +162,7 @@ func TestMarkdown(t *testing.T) {
|
|||
for i, test := range tests {
|
||||
testPrefix := getTestPrefix(i)
|
||||
|
||||
// WriteFile truncates the contentt
|
||||
// WriteFile truncates the content
|
||||
err := ioutil.WriteFile(absInFilePath, []byte(test.fileContent), os.ModePerm)
|
||||
if err != nil {
|
||||
t.Fatal(testPrefix+"Failed to create test file. Error was: %v", err)
|
||||
|
|
|
@ -336,7 +336,7 @@ func TestLogParse(t *testing.T) {
|
|||
{`log access.log { rotate_size }`, true, nil},
|
||||
{`log access.log { ipmask }`, true, nil},
|
||||
{`log access.log { invalid_option 1 }`, true, nil},
|
||||
{`log / acccess.log "{remote} - [{when}] "{method} {port}" {scheme} {mitm} "`, true, nil},
|
||||
{`log / access.log "{remote} - [{when}] "{method} {port}" {scheme} {mitm} "`, true, nil},
|
||||
}
|
||||
for i, test := range tests {
|
||||
c := caddy.NewTestController("http", test.inputLogRules)
|
||||
|
|
|
@ -29,7 +29,7 @@ func (n *NoneParser) Type() string {
|
|||
return "None"
|
||||
}
|
||||
|
||||
// Init prepases and parses the metadata and markdown file
|
||||
// Init preparses and parses the metadata and markdown file
|
||||
func (n *NoneParser) Init(b *bytes.Buffer) bool {
|
||||
m := make(map[string]interface{})
|
||||
n.metadata = NewMetadata(m)
|
||||
|
|
|
@ -122,7 +122,7 @@ func (r renderer) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte
|
|||
// LineBreak is the line break tag callback.
|
||||
func (r renderer) LineBreak(out *bytes.Buffer) {}
|
||||
|
||||
// Link is the link tag callback. Outputs a sipmle plain-text version
|
||||
// Link is the link tag callback. Outputs a simple plain-text version
|
||||
// of the input.
|
||||
func (r renderer) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) {
|
||||
out.Write(content)
|
||||
|
|
|
@ -303,7 +303,7 @@ func (p Proxy) match(r *http.Request) Upstream {
|
|||
return u
|
||||
}
|
||||
|
||||
// createUpstremRequest shallow-copies r into a new request
|
||||
// createUpstreamRequest shallow-copies r into a new request
|
||||
// that can be sent upstream.
|
||||
//
|
||||
// Derived from reverseproxy.go in the standard Go httputil package.
|
||||
|
|
|
@ -104,7 +104,7 @@ func TestReverseProxy(t *testing.T) {
|
|||
// Set headers.
|
||||
copyHeader(w.Header(), testHeaders)
|
||||
|
||||
// Only announce one of the trailers to test wether
|
||||
// Only announce one of the trailers to test whether
|
||||
// unannounced trailers are proxied correctly.
|
||||
for k := range testTrailers {
|
||||
w.Header().Set("Trailer", k)
|
||||
|
@ -127,7 +127,7 @@ func TestReverseProxy(t *testing.T) {
|
|||
|
||||
// Create the fake request body.
|
||||
// This will copy "trailersToSet" to r.Trailer right before it is closed and
|
||||
// thus test for us wether unannounced client trailers are proxied correctly.
|
||||
// thus test for us whether unannounced client trailers are proxied correctly.
|
||||
body := &trailerTestStringReader{
|
||||
Reader: *strings.NewReader("test"),
|
||||
trailersToSet: testTrailers,
|
||||
|
@ -140,7 +140,7 @@ func TestReverseProxy(t *testing.T) {
|
|||
|
||||
copyHeader(r.Header, testHeaders)
|
||||
|
||||
// Only announce one of the trailers to test wether
|
||||
// Only announce one of the trailers to test whether
|
||||
// unannounced trailers are proxied correctly.
|
||||
for k, v := range testTrailers {
|
||||
r.Trailer[k] = v
|
||||
|
@ -262,7 +262,7 @@ func TestReverseProxyMaxConnLimit(t *testing.T) {
|
|||
} else if code != 0 {
|
||||
t.Errorf("Bad return code for request %d: %d", i, code)
|
||||
} else if w.Code != 200 {
|
||||
t.Errorf("Bad statuc code for request %d: %d", i, w.Code)
|
||||
t.Errorf("Bad status code for request %d: %d", i, w.Code)
|
||||
}
|
||||
}(i)
|
||||
}
|
||||
|
@ -1037,7 +1037,7 @@ func TestBasicAuth(t *testing.T) {
|
|||
}{
|
||||
{"Nil Both", nil, nil},
|
||||
{"Nil Upstream User", nil, url.UserPassword("username", "password")},
|
||||
{"Nil Client User", url.UserPassword("usename", "password"), nil},
|
||||
{"Nil Client User", url.UserPassword("username", "password"), nil},
|
||||
{"Both Provided", url.UserPassword("unused", "unused"),
|
||||
url.UserPassword("username", "password")},
|
||||
}
|
||||
|
|
|
@ -456,7 +456,7 @@ func (rp *ReverseProxy) ServeHTTP(rw http.ResponseWriter, outreq *http.Request,
|
|||
closeBody()
|
||||
|
||||
// Since Go does not remove keys from res.Trailer we
|
||||
// can safely do a length comparison to check wether
|
||||
// can safely do a length comparison to check whether
|
||||
// we received further, unannounced trailers.
|
||||
//
|
||||
// Most of the time forceSetTrailers should be false.
|
||||
|
|
|
@ -36,7 +36,7 @@ func TestRoot(t *testing.T) {
|
|||
t.Fatalf("BeforeTest: Failed to find an existing directory for testing! Error was: %v", err)
|
||||
}
|
||||
|
||||
nonExistingDir := filepath.Join(existingDirPath, "highly_unlikely_to_exist_dir")
|
||||
nonexistentDir := filepath.Join(existingDirPath, "highly_unlikely_to_exist_dir")
|
||||
|
||||
existingFile, err := ioutil.TempFile("", "root_test")
|
||||
if err != nil {
|
||||
|
@ -57,7 +57,7 @@ func TestRoot(t *testing.T) {
|
|||
}{
|
||||
// positive
|
||||
{
|
||||
fmt.Sprintf(`root %s`, nonExistingDir), false, nonExistingDir, "",
|
||||
fmt.Sprintf(`root %s`, nonexistentDir), false, nonexistentDir, "",
|
||||
},
|
||||
{
|
||||
fmt.Sprintf(`root %s`, existingDirPath), false, existingDirPath, "",
|
||||
|
|
|
@ -414,7 +414,7 @@ func GetSupportedProtocolName(protocol uint16) (string, error) {
|
|||
}
|
||||
}
|
||||
|
||||
return "", fmt.Errorf("name: unsuported protocol")
|
||||
return "", fmt.Errorf("name: unsupported protocol")
|
||||
}
|
||||
|
||||
// SupportedCiphersMap has supported ciphers, used only for parsing config.
|
||||
|
@ -452,7 +452,7 @@ func GetSupportedCipherName(cipher uint16) (string, error) {
|
|||
}
|
||||
}
|
||||
|
||||
return "", fmt.Errorf("name: unsuported cipher")
|
||||
return "", fmt.Errorf("name: unsupported cipher")
|
||||
}
|
||||
|
||||
// List of all the ciphers we want to use by default
|
||||
|
|
|
@ -125,7 +125,7 @@ func TestParseWindowsCommand(t *testing.T) {
|
|||
input: `cmd "a ""quoted value"`,
|
||||
expected: []string{`cmd`, `a "quoted value`},
|
||||
},
|
||||
// TODO - see how many quotes are dislayed if we use "", """, """""""
|
||||
// TODO - see how many quotes are displayed if we use "", """, """""""
|
||||
{ // 9 - two quotes outside an inQuote element
|
||||
input: `cmd a ""quoted value`,
|
||||
expected: []string{`cmd`, `a`, `"quoted`, `value`},
|
||||
|
|
|
@ -20,8 +20,8 @@ func TestHook(t *testing.T) {
|
|||
time.Sleep(500 * time.Millisecond)
|
||||
os.RemoveAll(testDir)
|
||||
}()
|
||||
osSenitiveTestDir := filepath.FromSlash(testDir)
|
||||
os.RemoveAll(osSenitiveTestDir) // start with a clean slate
|
||||
osSensitiveTestDir := filepath.FromSlash(testDir)
|
||||
os.RemoveAll(osSensitiveTestDir) // start with a clean slate
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
|
@ -31,8 +31,8 @@ func TestHook(t *testing.T) {
|
|||
shouldErr bool
|
||||
shouldRemoveErr bool
|
||||
}{
|
||||
{name: "blocking", event: caddy.InstanceStartupEvent, command: "mkdir", args: []string{osSenitiveTestDir}, shouldErr: false, shouldRemoveErr: false},
|
||||
{name: "nonBlocking", event: caddy.ShutdownEvent, command: "mkdir", args: []string{osSenitiveTestDir, "&"}, shouldErr: false, shouldRemoveErr: true},
|
||||
{name: "blocking", event: caddy.InstanceStartupEvent, command: "mkdir", args: []string{osSensitiveTestDir}, shouldErr: false, shouldRemoveErr: false},
|
||||
{name: "nonBlocking", event: caddy.ShutdownEvent, command: "mkdir", args: []string{osSensitiveTestDir, "&"}, shouldErr: false, shouldRemoveErr: true},
|
||||
{name: "nonBlocking2", event: caddy.ShutdownEvent, command: "echo", args: []string{"&"}, shouldErr: false, shouldRemoveErr: true},
|
||||
{name: "nonExistent", event: caddy.CertRenewEvent, command: strconv.Itoa(int(time.Now().UnixNano())), shouldErr: true, shouldRemoveErr: true},
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ func TestHook(t *testing.T) {
|
|||
t.Errorf("Test errored, but it shouldn't have; got '%v'", err)
|
||||
}
|
||||
|
||||
err = os.Remove(osSenitiveTestDir)
|
||||
err = os.Remove(osSensitiveTestDir)
|
||||
if err != nil && !test.shouldRemoveErr {
|
||||
t.Errorf("Test received an error of:\n%v", err)
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ func ListPlugins() map[string][]string {
|
|||
|
||||
// cluster plugins in registration order
|
||||
for name := range clusterProviders {
|
||||
p["clustering"] = append(p["clsutering"], name)
|
||||
p["clustering"] = append(p["clustering"], name)
|
||||
}
|
||||
|
||||
// List the event hook plugins
|
||||
|
|
|
@ -391,7 +391,7 @@ var (
|
|||
// If the value is true, it may be removed if
|
||||
// the metric is re-enabled remotely later. If
|
||||
// the value is false, it is permanent
|
||||
// (presumably becaues the user explicitly
|
||||
// (presumably because the user explicitly
|
||||
// disabled it) and can only be re-enabled
|
||||
// with user consent.
|
||||
disabledMetrics = make(map[string]bool)
|
||||
|
|
|
@ -181,7 +181,7 @@ func getCurrentCaddyfile() (Input, *Instance, error) {
|
|||
|
||||
currentCaddyfile := inst.caddyfileInput
|
||||
if currentCaddyfile == nil {
|
||||
// hmm, did spawing process forget to close stdin? Anyhow, this is unusual.
|
||||
// hmm, did spawning process forget to close stdin? Anyhow, this is unusual.
|
||||
return nil, inst, fmt.Errorf("no Caddyfile to reload (was stdin left open?)")
|
||||
}
|
||||
return currentCaddyfile, inst, nil
|
||||
|
|
Loading…
Reference in New Issue
Block a user