Commit 8369a121 authored by Josh Soref's avatar Josh Soref Committed by Matt Holt

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
parent 97e1f14d
...@@ -111,7 +111,7 @@ Note that plugin documentation is not hosted by the Caddy website, other than ba ...@@ -111,7 +111,7 @@ Note that plugin documentation is not hosted by the Caddy website, other than ba
## Collaborator Instructions ## 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: - **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? - Can the change be made more elegant?
......
...@@ -421,7 +421,7 @@ func TestDirectiveImport(t *testing.T) { ...@@ -421,7 +421,7 @@ func TestDirectiveImport(t *testing.T) {
t.Error("directive import failed") t.Error("directive import failed")
} }
// import from nonexisting file // import from nonexistent file
_, err = testParseOne(`localhost _, err = testParseOne(`localhost
dir1 dir1
proxy { proxy {
......
...@@ -186,7 +186,7 @@ func (l bySize) Less(i, j int) bool { ...@@ -186,7 +186,7 @@ func (l bySize) Less(i, j int) bool {
iSize, jSize := l.Items[i].Size, l.Items[j].Size iSize, jSize := l.Items[i].Size, l.Items[j].Size
// Directory sizes depend on the filesystem implementation, // 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… // For a consistent user experience directories are pulled to the front…
if l.Items[i].IsDir { if l.Items[i].IsDir {
iSize = directoryOffset iSize = directoryOffset
......
...@@ -366,25 +366,25 @@ func TestBrowseJson(t *testing.T) { ...@@ -366,25 +366,25 @@ func TestBrowseJson(t *testing.T) {
} }
actualJSONResponse := rec.Body.String() actualJSONResponse := rec.Body.String()
copyOflisting := listing copyOfListing := listing
if test.SortBy == "" { if test.SortBy == "" {
copyOflisting.Sort = "name" copyOfListing.Sort = "name"
} else { } else {
copyOflisting.Sort = test.SortBy copyOfListing.Sort = test.SortBy
} }
if test.OrderBy == "" { if test.OrderBy == "" {
copyOflisting.Order = "asc" copyOfListing.Order = "asc"
} else { } else {
copyOflisting.Order = test.OrderBy copyOfListing.Order = test.OrderBy
} }
copyOflisting.applySort() copyOfListing.applySort()
limit := test.Limit limit := test.Limit
if limit <= len(copyOflisting.Items) && limit > 0 { if limit <= len(copyOfListing.Items) && limit > 0 {
marsh, err = json.Marshal(copyOflisting.Items[:limit]) marsh, err = json.Marshal(copyOfListing.Items[:limit])
} else { // if the 'limit' query is empty, or has the wrong value, list everything } 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 { if err != nil {
......
...@@ -53,7 +53,7 @@ func TestSetup(t *testing.T) { ...@@ -53,7 +53,7 @@ func TestSetup(t *testing.T) {
// test case #1 tests instantiation of Config with default values // test case #1 tests instantiation of Config with default values
{"browse /", []string{"/"}, false}, {"browse /", []string{"/"}, false},
// test case #2 tests detectaction of custom template // test case #2 tests detection of custom template
{"browse . " + tempTemplatePath, []string{"."}, false}, {"browse . " + tempTemplatePath, []string{"."}, false},
// test case #3 tests detection of non-existent template // test case #3 tests detection of non-existent template
......
...@@ -216,7 +216,7 @@ func Dial(network, address string) (fcgi *FCGIClient, err error) { ...@@ -216,7 +216,7 @@ func Dial(network, address string) (fcgi *FCGIClient, err error) {
return DialContext(context.Background(), network, address) return DialContext(context.Background(), network, address)
} }
// Close closes fcgi connnection // Close closes fcgi connection
func (c *FCGIClient) Close() { func (c *FCGIClient) Close() {
c.rwc.Close() c.rwc.Close()
} }
......
...@@ -44,7 +44,7 @@ import ( ...@@ -44,7 +44,7 @@ import (
// test fcgi protocol includes: // test fcgi protocol includes:
// Get, Post, Post in multipart/form-data, and Post with files // Get, Post, Post in multipart/form-data, and Post with files
// each key should be the md5 of the value or the file uploaded // 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 // test failed if the remote fcgi(script) failed md5 verification
// and output "FAILED" in response // and output "FAILED" in response
const ( const (
......
...@@ -114,7 +114,7 @@ outer: ...@@ -114,7 +114,7 @@ outer:
return g.Next.ServeHTTP(w, r) 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. // with a gzip.Writer to compress the output.
type gzipResponseWriter struct { type gzipResponseWriter struct {
internalWriter io.Writer internalWriter io.Writer
......
...@@ -191,7 +191,7 @@ func (m IfMatcher) Or(r *http.Request) bool { ...@@ -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. // 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 { func IfMatcherKeyword(c *caddy.Controller) bool {
if c.Val() == "if" || c.Val() == "if_op" { if c.Val() == "if" || c.Val() == "if_op" {
// clear remaining args // clear remaining args
......
...@@ -335,7 +335,7 @@ func TestHeuristicFunctionsAndHandler(t *testing.T) { ...@@ -335,7 +335,7 @@ func TestHeuristicFunctionsAndHandler(t *testing.T) {
// in other words, if one returns true, the others // in other words, if one returns true, the others
// should return false, with as little logic as possible, // should return false, with as little logic as possible,
// but with enough logic to force TLS proxies to do a // 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)) || if (isChrome && (isFirefox || isSafari || isEdge || isTor)) ||
(isFirefox && (isChrome || isSafari || isEdge || isTor)) || (isFirefox && (isChrome || isSafari || isEdge || isTor)) ||
(isSafari && (isChrome || isFirefox || isEdge || isTor)) || (isSafari && (isChrome || isFirefox || isEdge || isTor)) ||
......
...@@ -228,7 +228,7 @@ func (h *httpContext) MakeServers() ([]caddy.Server, error) { ...@@ -228,7 +228,7 @@ func (h *httpContext) MakeServers() ([]caddy.Server, error) {
// make a rough estimate as to whether we're in a "production // make a rough estimate as to whether we're in a "production
// environment/system" - start by assuming that most production // environment/system" - start by assuming that most production
// servers will set their default CA endpoint to a public, // 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 var looksLikeProductionCA bool
for _, publicCAEndpoint := range caddytls.KnownACMECAs { for _, publicCAEndpoint := range caddytls.KnownACMECAs {
if strings.Contains(certmagic.CA, publicCAEndpoint) { if strings.Contains(certmagic.CA, publicCAEndpoint) {
......
...@@ -217,7 +217,7 @@ func (rb *ResponseBuffer) ReadFrom(src io.Reader) (int64, error) { ...@@ -217,7 +217,7 @@ func (rb *ResponseBuffer) ReadFrom(src io.Reader) (int64, error) {
// https://go-review.googlesource.com/c/22134#message-ff351762308fe05f6b72a487d6842e3988916486 // https://go-review.googlesource.com/c/22134#message-ff351762308fe05f6b72a487d6842e3988916486
buf := respBufPool.Get().([]byte) buf := respBufPool.Get().([]byte)
n, err := io.CopyBuffer(rb.ResponseWriterWrapper, src, buf) 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 n, err
} }
return rb.Buffer.ReadFrom(src) return rb.Buffer.ReadFrom(src)
......
...@@ -76,7 +76,7 @@ func TestReplace(t *testing.T) { ...@@ -76,7 +76,7 @@ func TestReplace(t *testing.T) {
request.Header.Set("CustomAdd", "caddy") request.Header.Set("CustomAdd", "caddy")
request.Header.Set("Cookie", "foo=bar; taste=delicious") request.Header.Set("Cookie", "foo=bar; taste=delicious")
// add some respons headers // add some response headers
recordRequest.Header().Set("Custom", "CustomResponseHeader") recordRequest.Header().Set("Custom", "CustomResponseHeader")
hostname, err := os.Hostname() hostname, err := os.Hostname()
...@@ -303,7 +303,7 @@ func BenchmarkReplace(b *testing.B) { ...@@ -303,7 +303,7 @@ func BenchmarkReplace(b *testing.B) {
request.Header.Set("CustomAdd", "caddy") request.Header.Set("CustomAdd", "caddy")
request.Header.Set("Cookie", "foo=bar; taste=delicious") request.Header.Set("Cookie", "foo=bar; taste=delicious")
// add some respons headers // add some response headers
recordRequest.Header().Set("Custom", "CustomResponseHeader") recordRequest.Header().Set("Custom", "CustomResponseHeader")
now = func() time.Time { now = func() time.Time {
...@@ -336,7 +336,7 @@ func BenchmarkReplaceEscaped(b *testing.B) { ...@@ -336,7 +336,7 @@ func BenchmarkReplaceEscaped(b *testing.B) {
request.Header.Set("CustomAdd", "caddy") request.Header.Set("CustomAdd", "caddy")
request.Header.Set("Cookie", "foo=bar; taste=delicious") request.Header.Set("Cookie", "foo=bar; taste=delicious")
// add some respons headers // add some response headers
recordRequest.Header().Set("Custom", "CustomResponseHeader") recordRequest.Header().Set("Custom", "CustomResponseHeader")
now = func() time.Time { now = func() time.Time {
...@@ -473,7 +473,7 @@ func TestRound(t *testing.T) { ...@@ -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{ var testCases = map[time.Duration]int64{
2 * time.Second: 2000, 2 * time.Second: 2000,
9039492 * time.Nanosecond: 9, 9039492 * time.Nanosecond: 9,
......
...@@ -86,7 +86,7 @@ type SiteConfig struct { ...@@ -86,7 +86,7 @@ type SiteConfig struct {
} }
// Timeouts specify various timeouts for a server to use. // 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 // value should be treated literally (i.e. a zero-value
// duration would mean "no timeout"). If false, the duration // duration would mean "no timeout"). If false, the duration
// was left unset, so a zero-value duration would mean to // was left unset, so a zero-value duration would mean to
......
...@@ -101,7 +101,7 @@ func TestInclude(t *testing.T) { ...@@ -101,7 +101,7 @@ func TestInclude(t *testing.T) {
for i, test := range tests { for i, test := range tests {
testPrefix := getTestPrefix(i) testPrefix := getTestPrefix(i)
// WriteFile truncates the contentt // WriteFile truncates the content
err := ioutil.WriteFile(absInFilePath, []byte(test.fileContent), os.ModePerm) err := ioutil.WriteFile(absInFilePath, []byte(test.fileContent), os.ModePerm)
if err != nil { if err != nil {
t.Fatal(testPrefix+"Failed to create test file. Error was: %v", err) t.Fatal(testPrefix+"Failed to create test file. Error was: %v", err)
...@@ -162,7 +162,7 @@ func TestMarkdown(t *testing.T) { ...@@ -162,7 +162,7 @@ func TestMarkdown(t *testing.T) {
for i, test := range tests { for i, test := range tests {
testPrefix := getTestPrefix(i) testPrefix := getTestPrefix(i)
// WriteFile truncates the contentt // WriteFile truncates the content
err := ioutil.WriteFile(absInFilePath, []byte(test.fileContent), os.ModePerm) err := ioutil.WriteFile(absInFilePath, []byte(test.fileContent), os.ModePerm)
if err != nil { if err != nil {
t.Fatal(testPrefix+"Failed to create test file. Error was: %v", err) t.Fatal(testPrefix+"Failed to create test file. Error was: %v", err)
......
...@@ -336,7 +336,7 @@ func TestLogParse(t *testing.T) { ...@@ -336,7 +336,7 @@ func TestLogParse(t *testing.T) {
{`log access.log { rotate_size }`, true, nil}, {`log access.log { rotate_size }`, true, nil},
{`log access.log { ipmask }`, true, nil}, {`log access.log { ipmask }`, true, nil},
{`log access.log { invalid_option 1 }`, 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 { for i, test := range tests {
c := caddy.NewTestController("http", test.inputLogRules) c := caddy.NewTestController("http", test.inputLogRules)
......
...@@ -29,7 +29,7 @@ func (n *NoneParser) Type() string { ...@@ -29,7 +29,7 @@ func (n *NoneParser) Type() string {
return "None" 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 { func (n *NoneParser) Init(b *bytes.Buffer) bool {
m := make(map[string]interface{}) m := make(map[string]interface{})
n.metadata = NewMetadata(m) n.metadata = NewMetadata(m)
......
...@@ -122,7 +122,7 @@ func (r renderer) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte ...@@ -122,7 +122,7 @@ func (r renderer) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte
// LineBreak is the line break tag callback. // LineBreak is the line break tag callback.
func (r renderer) LineBreak(out *bytes.Buffer) {} 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. // of the input.
func (r renderer) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) { func (r renderer) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) {
out.Write(content) out.Write(content)
......
...@@ -303,7 +303,7 @@ func (p Proxy) match(r *http.Request) Upstream { ...@@ -303,7 +303,7 @@ func (p Proxy) match(r *http.Request) Upstream {
return u return u
} }
// createUpstremRequest shallow-copies r into a new request // createUpstreamRequest shallow-copies r into a new request
// that can be sent upstream. // that can be sent upstream.
// //
// Derived from reverseproxy.go in the standard Go httputil package. // Derived from reverseproxy.go in the standard Go httputil package.
......
...@@ -104,7 +104,7 @@ func TestReverseProxy(t *testing.T) { ...@@ -104,7 +104,7 @@ func TestReverseProxy(t *testing.T) {
// Set headers. // Set headers.
copyHeader(w.Header(), testHeaders) 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. // unannounced trailers are proxied correctly.
for k := range testTrailers { for k := range testTrailers {
w.Header().Set("Trailer", k) w.Header().Set("Trailer", k)
...@@ -127,7 +127,7 @@ func TestReverseProxy(t *testing.T) { ...@@ -127,7 +127,7 @@ func TestReverseProxy(t *testing.T) {
// Create the fake request body. // Create the fake request body.
// This will copy "trailersToSet" to r.Trailer right before it is closed and // 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{ body := &trailerTestStringReader{
Reader: *strings.NewReader("test"), Reader: *strings.NewReader("test"),
trailersToSet: testTrailers, trailersToSet: testTrailers,
...@@ -140,7 +140,7 @@ func TestReverseProxy(t *testing.T) { ...@@ -140,7 +140,7 @@ func TestReverseProxy(t *testing.T) {
copyHeader(r.Header, testHeaders) 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. // unannounced trailers are proxied correctly.
for k, v := range testTrailers { for k, v := range testTrailers {
r.Trailer[k] = v r.Trailer[k] = v
...@@ -262,7 +262,7 @@ func TestReverseProxyMaxConnLimit(t *testing.T) { ...@@ -262,7 +262,7 @@ func TestReverseProxyMaxConnLimit(t *testing.T) {
} else if code != 0 { } else if code != 0 {
t.Errorf("Bad return code for request %d: %d", i, code) t.Errorf("Bad return code for request %d: %d", i, code)
} else if w.Code != 200 { } 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) }(i)
} }
...@@ -1037,7 +1037,7 @@ func TestBasicAuth(t *testing.T) { ...@@ -1037,7 +1037,7 @@ func TestBasicAuth(t *testing.T) {
}{ }{
{"Nil Both", nil, nil}, {"Nil Both", nil, nil},
{"Nil Upstream User", nil, url.UserPassword("username", "password")}, {"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"), {"Both Provided", url.UserPassword("unused", "unused"),
url.UserPassword("username", "password")}, url.UserPassword("username", "password")},
} }
......
...@@ -456,7 +456,7 @@ func (rp *ReverseProxy) ServeHTTP(rw http.ResponseWriter, outreq *http.Request, ...@@ -456,7 +456,7 @@ func (rp *ReverseProxy) ServeHTTP(rw http.ResponseWriter, outreq *http.Request,
closeBody() closeBody()
// Since Go does not remove keys from res.Trailer we // 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. // we received further, unannounced trailers.
// //
// Most of the time forceSetTrailers should be false. // Most of the time forceSetTrailers should be false.
......
...@@ -36,7 +36,7 @@ func TestRoot(t *testing.T) { ...@@ -36,7 +36,7 @@ func TestRoot(t *testing.T) {
t.Fatalf("BeforeTest: Failed to find an existing directory for testing! Error was: %v", err) 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") existingFile, err := ioutil.TempFile("", "root_test")
if err != nil { if err != nil {
...@@ -57,7 +57,7 @@ func TestRoot(t *testing.T) { ...@@ -57,7 +57,7 @@ func TestRoot(t *testing.T) {
}{ }{
// positive // positive
{ {
fmt.Sprintf(`root %s`, nonExistingDir), false, nonExistingDir, "", fmt.Sprintf(`root %s`, nonexistentDir), false, nonexistentDir, "",
}, },
{ {
fmt.Sprintf(`root %s`, existingDirPath), false, existingDirPath, "", fmt.Sprintf(`root %s`, existingDirPath), false, existingDirPath, "",
......
...@@ -414,7 +414,7 @@ func GetSupportedProtocolName(protocol uint16) (string, error) { ...@@ -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. // SupportedCiphersMap has supported ciphers, used only for parsing config.
...@@ -452,7 +452,7 @@ func GetSupportedCipherName(cipher uint16) (string, error) { ...@@ -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 // List of all the ciphers we want to use by default
......
...@@ -125,7 +125,7 @@ func TestParseWindowsCommand(t *testing.T) { ...@@ -125,7 +125,7 @@ func TestParseWindowsCommand(t *testing.T) {
input: `cmd "a ""quoted value"`, input: `cmd "a ""quoted value"`,
expected: []string{`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 { // 9 - two quotes outside an inQuote element
input: `cmd a ""quoted value`, input: `cmd a ""quoted value`,
expected: []string{`cmd`, `a`, `"quoted`, `value`}, expected: []string{`cmd`, `a`, `"quoted`, `value`},
......
...@@ -20,8 +20,8 @@ func TestHook(t *testing.T) { ...@@ -20,8 +20,8 @@ func TestHook(t *testing.T) {
time.Sleep(500 * time.Millisecond) time.Sleep(500 * time.Millisecond)
os.RemoveAll(testDir) os.RemoveAll(testDir)
}() }()
osSenitiveTestDir := filepath.FromSlash(testDir) osSensitiveTestDir := filepath.FromSlash(testDir)
os.RemoveAll(osSenitiveTestDir) // start with a clean slate os.RemoveAll(osSensitiveTestDir) // start with a clean slate
tests := []struct { tests := []struct {
name string name string
...@@ -31,8 +31,8 @@ func TestHook(t *testing.T) { ...@@ -31,8 +31,8 @@ func TestHook(t *testing.T) {
shouldErr bool shouldErr bool
shouldRemoveErr bool shouldRemoveErr bool
}{ }{
{name: "blocking", event: caddy.InstanceStartupEvent, command: "mkdir", args: []string{osSenitiveTestDir}, shouldErr: false, shouldRemoveErr: false}, {name: "blocking", event: caddy.InstanceStartupEvent, command: "mkdir", args: []string{osSensitiveTestDir}, shouldErr: false, shouldRemoveErr: false},
{name: "nonBlocking", event: caddy.ShutdownEvent, command: "mkdir", args: []string{osSenitiveTestDir, "&"}, shouldErr: false, shouldRemoveErr: true}, {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: "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}, {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) { ...@@ -52,7 +52,7 @@ func TestHook(t *testing.T) {
t.Errorf("Test errored, but it shouldn't have; got '%v'", err) 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 { if err != nil && !test.shouldRemoveErr {
t.Errorf("Test received an error of:\n%v", err) t.Errorf("Test received an error of:\n%v", err)
} }
......
...@@ -109,7 +109,7 @@ func ListPlugins() map[string][]string { ...@@ -109,7 +109,7 @@ func ListPlugins() map[string][]string {
// cluster plugins in registration order // cluster plugins in registration order
for name := range clusterProviders { for name := range clusterProviders {
p["clustering"] = append(p["clsutering"], name) p["clustering"] = append(p["clustering"], name)
} }
// List the event hook plugins // List the event hook plugins
......
...@@ -391,7 +391,7 @@ var ( ...@@ -391,7 +391,7 @@ var (
// If the value is true, it may be removed if // If the value is true, it may be removed if
// the metric is re-enabled remotely later. If // the metric is re-enabled remotely later. If
// the value is false, it is permanent // 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 // disabled it) and can only be re-enabled
// with user consent. // with user consent.
disabledMetrics = make(map[string]bool) disabledMetrics = make(map[string]bool)
......
...@@ -181,7 +181,7 @@ func getCurrentCaddyfile() (Input, *Instance, error) { ...@@ -181,7 +181,7 @@ func getCurrentCaddyfile() (Input, *Instance, error) {
currentCaddyfile := inst.caddyfileInput currentCaddyfile := inst.caddyfileInput
if currentCaddyfile == nil { 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 nil, inst, fmt.Errorf("no Caddyfile to reload (was stdin left open?)")
} }
return currentCaddyfile, inst, nil return currentCaddyfile, inst, nil
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment