mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-19 01:05:37 +03:00
gofmt -s; fix misspellings and lint; Go 1.5.3 in Travis CI
This commit is contained in:
parent
a11e14aca8
commit
cae9f7de9c
16 changed files with 61 additions and 62 deletions
|
@ -2,7 +2,7 @@ language: go
|
||||||
|
|
||||||
go:
|
go:
|
||||||
- 1.4.3
|
- 1.4.3
|
||||||
- 1.5.2
|
- 1.5.3
|
||||||
- tip
|
- tip
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
|
|
@ -336,7 +336,7 @@ func redirPlaintextHost(cfg server.Config) server.Config {
|
||||||
BindHost: cfg.BindHost,
|
BindHost: cfg.BindHost,
|
||||||
Port: "80",
|
Port: "80",
|
||||||
Middleware: map[string][]middleware.Middleware{
|
Middleware: map[string][]middleware.Middleware{
|
||||||
"/": []middleware.Middleware{redirMidware},
|
"/": {redirMidware},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,9 +209,9 @@ func TestExistingCertAndKey(t *testing.T) {
|
||||||
|
|
||||||
func TestHostHasOtherPort(t *testing.T) {
|
func TestHostHasOtherPort(t *testing.T) {
|
||||||
configs := []server.Config{
|
configs := []server.Config{
|
||||||
server.Config{Host: "example.com", Port: "80"},
|
{Host: "example.com", Port: "80"},
|
||||||
server.Config{Host: "sub1.example.com", Port: "80"},
|
{Host: "sub1.example.com", Port: "80"},
|
||||||
server.Config{Host: "sub1.example.com", Port: "443"},
|
{Host: "sub1.example.com", Port: "443"},
|
||||||
}
|
}
|
||||||
|
|
||||||
if hostHasOtherPort(configs, 0, "80") {
|
if hostHasOtherPort(configs, 0, "80") {
|
||||||
|
@ -228,18 +228,18 @@ func TestHostHasOtherPort(t *testing.T) {
|
||||||
func TestMakePlaintextRedirects(t *testing.T) {
|
func TestMakePlaintextRedirects(t *testing.T) {
|
||||||
configs := []server.Config{
|
configs := []server.Config{
|
||||||
// Happy path = standard redirect from 80 to 443
|
// Happy path = standard redirect from 80 to 443
|
||||||
server.Config{Host: "example.com", TLS: server.TLSConfig{Managed: true}},
|
{Host: "example.com", TLS: server.TLSConfig{Managed: true}},
|
||||||
|
|
||||||
// Host on port 80 already defined; don't change it (no redirect)
|
// Host on port 80 already defined; don't change it (no redirect)
|
||||||
server.Config{Host: "sub1.example.com", Port: "80", Scheme: "http"},
|
{Host: "sub1.example.com", Port: "80", Scheme: "http"},
|
||||||
server.Config{Host: "sub1.example.com", TLS: server.TLSConfig{Managed: true}},
|
{Host: "sub1.example.com", TLS: server.TLSConfig{Managed: true}},
|
||||||
|
|
||||||
// Redirect from port 80 to port 5000 in this case
|
// Redirect from port 80 to port 5000 in this case
|
||||||
server.Config{Host: "sub2.example.com", Port: "5000", TLS: server.TLSConfig{Managed: true}},
|
{Host: "sub2.example.com", Port: "5000", TLS: server.TLSConfig{Managed: true}},
|
||||||
|
|
||||||
// Can redirect from 80 to either 443 or 5001, but choose 443
|
// Can redirect from 80 to either 443 or 5001, but choose 443
|
||||||
server.Config{Host: "sub3.example.com", Port: "443", TLS: server.TLSConfig{Managed: true}},
|
{Host: "sub3.example.com", Port: "443", TLS: server.TLSConfig{Managed: true}},
|
||||||
server.Config{Host: "sub3.example.com", Port: "5001", Scheme: "https", TLS: server.TLSConfig{Managed: true}},
|
{Host: "sub3.example.com", Port: "5001", Scheme: "https", TLS: server.TLSConfig{Managed: true}},
|
||||||
}
|
}
|
||||||
|
|
||||||
result := MakePlaintextRedirects(configs)
|
result := MakePlaintextRedirects(configs)
|
||||||
|
@ -253,8 +253,8 @@ func TestMakePlaintextRedirects(t *testing.T) {
|
||||||
|
|
||||||
func TestEnableTLS(t *testing.T) {
|
func TestEnableTLS(t *testing.T) {
|
||||||
configs := []server.Config{
|
configs := []server.Config{
|
||||||
server.Config{Host: "example.com", TLS: server.TLSConfig{Managed: true}},
|
{Host: "example.com", TLS: server.TLSConfig{Managed: true}},
|
||||||
server.Config{}, // not managed - no changes!
|
{}, // not managed - no changes!
|
||||||
}
|
}
|
||||||
|
|
||||||
EnableTLS(configs, false)
|
EnableTLS(configs, false)
|
||||||
|
@ -273,12 +273,12 @@ func TestGroupConfigsByEmail(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
configs := []server.Config{
|
configs := []server.Config{
|
||||||
server.Config{Host: "example.com", TLS: server.TLSConfig{LetsEncryptEmail: "", Managed: true}},
|
{Host: "example.com", TLS: server.TLSConfig{LetsEncryptEmail: "", Managed: true}},
|
||||||
server.Config{Host: "sub1.example.com", TLS: server.TLSConfig{LetsEncryptEmail: "foo@bar", Managed: true}},
|
{Host: "sub1.example.com", TLS: server.TLSConfig{LetsEncryptEmail: "foo@bar", Managed: true}},
|
||||||
server.Config{Host: "sub2.example.com", TLS: server.TLSConfig{LetsEncryptEmail: "", Managed: true}},
|
{Host: "sub2.example.com", TLS: server.TLSConfig{LetsEncryptEmail: "", Managed: true}},
|
||||||
server.Config{Host: "sub3.example.com", TLS: server.TLSConfig{LetsEncryptEmail: "foo@bar", Managed: true}},
|
{Host: "sub3.example.com", TLS: server.TLSConfig{LetsEncryptEmail: "foo@bar", Managed: true}},
|
||||||
server.Config{Host: "sub4.example.com", TLS: server.TLSConfig{LetsEncryptEmail: "", Managed: true}},
|
{Host: "sub4.example.com", TLS: server.TLSConfig{LetsEncryptEmail: "", Managed: true}},
|
||||||
server.Config{Host: "sub5.example.com", TLS: server.TLSConfig{LetsEncryptEmail: ""}}, // not managed
|
{Host: "sub5.example.com", TLS: server.TLSConfig{LetsEncryptEmail: ""}}, // not managed
|
||||||
}
|
}
|
||||||
DefaultEmail = "test@example.com"
|
DefaultEmail = "test@example.com"
|
||||||
|
|
||||||
|
|
|
@ -311,19 +311,19 @@ func TestParseAll(t *testing.T) {
|
||||||
}},
|
}},
|
||||||
|
|
||||||
{`localhost:1234`, false, [][]address{
|
{`localhost:1234`, false, [][]address{
|
||||||
[]address{{"localhost:1234", "", "localhost", "1234"}},
|
{{"localhost:1234", "", "localhost", "1234"}},
|
||||||
}},
|
}},
|
||||||
|
|
||||||
{`localhost:1234 {
|
{`localhost:1234 {
|
||||||
}
|
}
|
||||||
localhost:2015 {
|
localhost:2015 {
|
||||||
}`, false, [][]address{
|
}`, false, [][]address{
|
||||||
[]address{{"localhost:1234", "", "localhost", "1234"}},
|
{{"localhost:1234", "", "localhost", "1234"}},
|
||||||
[]address{{"localhost:2015", "", "localhost", "2015"}},
|
{{"localhost:2015", "", "localhost", "2015"}},
|
||||||
}},
|
}},
|
||||||
|
|
||||||
{`localhost:1234, http://host2`, false, [][]address{
|
{`localhost:1234, http://host2`, false, [][]address{
|
||||||
[]address{{"localhost:1234", "", "localhost", "1234"}, {"http://host2", "http", "host2", "80"}},
|
{{"localhost:1234", "", "localhost", "1234"}, {"http://host2", "http", "host2", "80"}},
|
||||||
}},
|
}},
|
||||||
|
|
||||||
{`localhost:1234, http://host2,`, true, [][]address{}},
|
{`localhost:1234, http://host2,`, true, [][]address{}},
|
||||||
|
@ -332,15 +332,15 @@ func TestParseAll(t *testing.T) {
|
||||||
}
|
}
|
||||||
https://host3.com, https://host4.com {
|
https://host3.com, https://host4.com {
|
||||||
}`, false, [][]address{
|
}`, false, [][]address{
|
||||||
[]address{{"http://host1.com", "http", "host1.com", "80"}, {"http://host2.com", "http", "host2.com", "80"}},
|
{{"http://host1.com", "http", "host1.com", "80"}, {"http://host2.com", "http", "host2.com", "80"}},
|
||||||
[]address{{"https://host3.com", "https", "host3.com", "443"}, {"https://host4.com", "https", "host4.com", "443"}},
|
{{"https://host3.com", "https", "host3.com", "443"}, {"https://host4.com", "https", "host4.com", "443"}},
|
||||||
}},
|
}},
|
||||||
|
|
||||||
{`import import_glob*.txt`, false, [][]address{
|
{`import import_glob*.txt`, false, [][]address{
|
||||||
[]address{{"glob0.host0", "", "glob0.host0", ""}},
|
{{"glob0.host0", "", "glob0.host0", ""}},
|
||||||
[]address{{"glob0.host1", "", "glob0.host1", ""}},
|
{{"glob0.host1", "", "glob0.host1", ""}},
|
||||||
[]address{{"glob1.host0", "", "glob1.host0", ""}},
|
{{"glob1.host0", "", "glob1.host0", ""}},
|
||||||
[]address{{"glob2.host0", "", "glob2.host0", ""}},
|
{{"glob2.host0", "", "glob2.host0", ""}},
|
||||||
}},
|
}},
|
||||||
} {
|
} {
|
||||||
p := testParser(test.input)
|
p := testParser(test.input)
|
||||||
|
|
|
@ -41,7 +41,7 @@ func TestBrowse(t *testing.T) {
|
||||||
// test case #2 tests detectaction of custom template
|
// test case #2 tests detectaction of custom template
|
||||||
{"browse . " + tempTemplatePath, []string{"."}, false},
|
{"browse . " + tempTemplatePath, []string{"."}, false},
|
||||||
|
|
||||||
// test case #3 tests detection of non-existant template
|
// test case #3 tests detection of non-existent template
|
||||||
{"browse . " + nonExistantDirPath, nil, true},
|
{"browse . " + nonExistantDirPath, nil, true},
|
||||||
|
|
||||||
// test case #4 tests detection of duplicate pathscopes
|
// test case #4 tests detection of duplicate pathscopes
|
||||||
|
|
|
@ -14,34 +14,34 @@ func TestRedir(t *testing.T) {
|
||||||
expectedRules []redirect.Rule
|
expectedRules []redirect.Rule
|
||||||
}{
|
}{
|
||||||
// test case #0 tests the recognition of a valid HTTP status code defined outside of block statement
|
// test case #0 tests the recognition of a valid HTTP status code defined outside of block statement
|
||||||
{"redir 300 {\n/ /foo\n}", false, []redirect.Rule{redirect.Rule{FromPath: "/", To: "/foo", Code: 300}}},
|
{"redir 300 {\n/ /foo\n}", false, []redirect.Rule{{FromPath: "/", To: "/foo", Code: 300}}},
|
||||||
|
|
||||||
// test case #1 tests the recognition of an invalid HTTP status code defined outside of block statement
|
// test case #1 tests the recognition of an invalid HTTP status code defined outside of block statement
|
||||||
{"redir 9000 {\n/ /foo\n}", true, []redirect.Rule{redirect.Rule{}}},
|
{"redir 9000 {\n/ /foo\n}", true, []redirect.Rule{{}}},
|
||||||
|
|
||||||
// test case #2 tests the detection of a valid HTTP status code outside of a block statement being overriden by an invalid HTTP status code inside statement of a block statement
|
// test case #2 tests the detection of a valid HTTP status code outside of a block statement being overriden by an invalid HTTP status code inside statement of a block statement
|
||||||
{"redir 300 {\n/ /foo 9000\n}", true, []redirect.Rule{redirect.Rule{}}},
|
{"redir 300 {\n/ /foo 9000\n}", true, []redirect.Rule{{}}},
|
||||||
|
|
||||||
// test case #3 tests the detection of an invalid HTTP status code outside of a block statement being overriden by a valid HTTP status code inside statement of a block statement
|
// test case #3 tests the detection of an invalid HTTP status code outside of a block statement being overriden by a valid HTTP status code inside statement of a block statement
|
||||||
{"redir 9000 {\n/ /foo 300\n}", true, []redirect.Rule{redirect.Rule{}}},
|
{"redir 9000 {\n/ /foo 300\n}", true, []redirect.Rule{{}}},
|
||||||
|
|
||||||
// test case #4 tests the recognition of a TO redirection in a block statement.The HTTP status code is set to the default of 301 - MovedPermanently
|
// test case #4 tests the recognition of a TO redirection in a block statement.The HTTP status code is set to the default of 301 - MovedPermanently
|
||||||
{"redir 302 {\n/foo\n}", false, []redirect.Rule{redirect.Rule{FromPath: "/", To: "/foo", Code: 302}}},
|
{"redir 302 {\n/foo\n}", false, []redirect.Rule{{FromPath: "/", To: "/foo", Code: 302}}},
|
||||||
|
|
||||||
// test case #5 tests the recognition of a TO and From redirection in a block statement
|
// test case #5 tests the recognition of a TO and From redirection in a block statement
|
||||||
{"redir {\n/bar /foo 303\n}", false, []redirect.Rule{redirect.Rule{FromPath: "/bar", To: "/foo", Code: 303}}},
|
{"redir {\n/bar /foo 303\n}", false, []redirect.Rule{{FromPath: "/bar", To: "/foo", Code: 303}}},
|
||||||
|
|
||||||
// test case #6 tests the recognition of a TO redirection in a non-block statement. The HTTP status code is set to the default of 301 - MovedPermanently
|
// test case #6 tests the recognition of a TO redirection in a non-block statement. The HTTP status code is set to the default of 301 - MovedPermanently
|
||||||
{"redir /foo", false, []redirect.Rule{redirect.Rule{FromPath: "/", To: "/foo", Code: 301}}},
|
{"redir /foo", false, []redirect.Rule{{FromPath: "/", To: "/foo", Code: 301}}},
|
||||||
|
|
||||||
// test case #7 tests the recognition of a TO and From redirection in a non-block statement
|
// test case #7 tests the recognition of a TO and From redirection in a non-block statement
|
||||||
{"redir /bar /foo 303", false, []redirect.Rule{redirect.Rule{FromPath: "/bar", To: "/foo", Code: 303}}},
|
{"redir /bar /foo 303", false, []redirect.Rule{{FromPath: "/bar", To: "/foo", Code: 303}}},
|
||||||
|
|
||||||
// test case #8 tests the recognition of multiple redirections
|
// test case #8 tests the recognition of multiple redirections
|
||||||
{"redir {\n / /foo 304 \n} \n redir {\n /bar /foobar 305 \n}", false, []redirect.Rule{redirect.Rule{FromPath: "/", To: "/foo", Code: 304}, redirect.Rule{FromPath: "/bar", To: "/foobar", Code: 305}}},
|
{"redir {\n / /foo 304 \n} \n redir {\n /bar /foobar 305 \n}", false, []redirect.Rule{{FromPath: "/", To: "/foo", Code: 304}, {FromPath: "/bar", To: "/foobar", Code: 305}}},
|
||||||
|
|
||||||
// test case #9 tests the detection of duplicate redirections
|
// test case #9 tests the detection of duplicate redirections
|
||||||
{"redir {\n /bar /foo 304 \n} redir {\n /bar /foo 304 \n}", true, []redirect.Rule{redirect.Rule{}}},
|
{"redir {\n /bar /foo 304 \n} redir {\n /bar /foo 304 \n}", true, []redirect.Rule{{}}},
|
||||||
} {
|
} {
|
||||||
recievedFunc, err := Redir(NewTestController(test.input))
|
recievedFunc, err := Redir(NewTestController(test.input))
|
||||||
if err != nil && !test.shouldErr {
|
if err != nil && !test.shouldErr {
|
||||||
|
|
|
@ -135,7 +135,7 @@ func TestRewriteParse(t *testing.T) {
|
||||||
to /to
|
to /to
|
||||||
if {path} is a
|
if {path} is a
|
||||||
}`, false, []rewrite.Rule{
|
}`, false, []rewrite.Rule{
|
||||||
&rewrite.ComplexRule{Base: "/", To: "/to", Ifs: []rewrite.If{rewrite.If{A: "{path}", Operator: "is", B: "a"}}},
|
&rewrite.ComplexRule{Base: "/", To: "/to", Ifs: []rewrite.If{{A: "{path}", Operator: "is", B: "a"}}},
|
||||||
}},
|
}},
|
||||||
{`rewrite {
|
{`rewrite {
|
||||||
status 400
|
status 400
|
||||||
|
|
|
@ -37,7 +37,7 @@ func TestStartup(t *testing.T) {
|
||||||
// test case #1 tests proper functionality of non-blocking commands
|
// test case #1 tests proper functionality of non-blocking commands
|
||||||
{"startup mkdir " + osSenitiveTestDir + " &", false, true},
|
{"startup mkdir " + osSenitiveTestDir + " &", false, true},
|
||||||
|
|
||||||
// test case #2 tests handling of non-existant commands
|
// test case #2 tests handling of non-existent commands
|
||||||
{"startup " + strconv.Itoa(int(time.Now().UnixNano())), true, true},
|
{"startup " + strconv.Itoa(int(time.Now().UnixNano())), true, true},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,13 +105,13 @@ func TestMarkdown(t *testing.T) {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
fileContent string
|
fileContent string
|
||||||
expectedContent string
|
expectedContent string
|
||||||
}{
|
}{
|
||||||
// Test 0 - test parsing of markdown
|
// Test 0 - test parsing of markdown
|
||||||
{
|
{
|
||||||
fileContent: "* str1\n* str2\n",
|
fileContent: "* str1\n* str2\n",
|
||||||
expectedContent: "<ul>\n<li>str1</li>\n<li>str2</li>\n</ul>\n",
|
expectedContent: "<ul>\n<li>str1</li>\n<li>str2</li>\n</ul>\n",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ func (r Rule) parseAddress() (string, string) {
|
||||||
if strings.HasPrefix(r.Address, "tcp://") {
|
if strings.HasPrefix(r.Address, "tcp://") {
|
||||||
return "tcp", r.Address[len("tcp://"):]
|
return "tcp", r.Address[len("tcp://"):]
|
||||||
}
|
}
|
||||||
// check if address has fastcgi scheme explicity set
|
// check if address has fastcgi scheme explicitly set
|
||||||
if strings.HasPrefix(r.Address, "fastcgi://") {
|
if strings.HasPrefix(r.Address, "fastcgi://") {
|
||||||
return "tcp", r.Address[len("fastcgi://"):]
|
return "tcp", r.Address[len("fastcgi://"):]
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,20 +35,20 @@ func TestRuleParseAddress(t *testing.T) {
|
||||||
func TestBuildEnv(t *testing.T) {
|
func TestBuildEnv(t *testing.T) {
|
||||||
|
|
||||||
buildEnvSingle := func(r *http.Request, rule Rule, fpath string, envExpected map[string]string, t *testing.T) {
|
buildEnvSingle := func(r *http.Request, rule Rule, fpath string, envExpected map[string]string, t *testing.T) {
|
||||||
|
|
||||||
h := Handler{}
|
h := Handler{}
|
||||||
|
|
||||||
env, err := h.buildEnv(r, rule, fpath)
|
env, err := h.buildEnv(r, rule, fpath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("Unexpected error:", err.Error())
|
t.Error("Unexpected error:", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, v := range envExpected {
|
for k, v := range envExpected {
|
||||||
if env[k] != v {
|
if env[k] != v {
|
||||||
t.Errorf("Unexpected %v. Got %v, expected %v", k, env[k], v)
|
t.Errorf("Unexpected %v. Got %v, expected %v", k, env[k], v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rule := Rule{}
|
rule := Rule{}
|
||||||
|
|
|
@ -39,9 +39,7 @@ const (
|
||||||
ipPort = "127.0.0.1:59000"
|
ipPort = "127.0.0.1:59000"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var globalt *testing.T
|
||||||
t_ *testing.T
|
|
||||||
)
|
|
||||||
|
|
||||||
type FastCGIServer struct{}
|
type FastCGIServer struct{}
|
||||||
|
|
||||||
|
@ -158,7 +156,7 @@ func sendFcgi(reqType int, fcgiParams map[string]string, data []byte, posts map[
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
|
|
||||||
if bytes.Index(content, []byte("FAILED")) >= 0 {
|
if bytes.Index(content, []byte("FAILED")) >= 0 {
|
||||||
t_.Error("Server return failed message")
|
globalt.Error("Server return failed message")
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -193,7 +191,7 @@ func generateRandFile(size int) (p string, m string) {
|
||||||
|
|
||||||
func DisabledTest(t *testing.T) {
|
func DisabledTest(t *testing.T) {
|
||||||
// TODO: test chunked reader
|
// TODO: test chunked reader
|
||||||
t_ = t
|
globalt = t
|
||||||
|
|
||||||
rand.Seed(time.Now().UTC().UnixNano())
|
rand.Seed(time.Now().UTC().UnixNano())
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ func TestServeHTTP(t *testing.T) {
|
||||||
expectedStatus int
|
expectedStatus int
|
||||||
expectedBodyContent string
|
expectedBodyContent string
|
||||||
}{
|
}{
|
||||||
// Test 0 - access withoutt any path
|
// Test 0 - access without any path
|
||||||
{
|
{
|
||||||
url: "https://foo",
|
url: "https://foo",
|
||||||
expectedStatus: http.StatusNotFound,
|
expectedStatus: http.StatusNotFound,
|
||||||
|
@ -78,7 +78,7 @@ func TestServeHTTP(t *testing.T) {
|
||||||
url: "https://foo/dir/",
|
url: "https://foo/dir/",
|
||||||
expectedStatus: http.StatusNotFound,
|
expectedStatus: http.StatusNotFound,
|
||||||
},
|
},
|
||||||
// Test 6 - access folder withtout trailing slash
|
// Test 6 - access folder without trailing slash
|
||||||
{
|
{
|
||||||
url: "https://foo/dir",
|
url: "https://foo/dir",
|
||||||
expectedStatus: http.StatusMovedPermanently,
|
expectedStatus: http.StatusMovedPermanently,
|
||||||
|
|
|
@ -102,7 +102,8 @@ func SetLastModifiedHeader(w http.ResponseWriter, modTime time.Time) {
|
||||||
w.Header().Set("Last-Modified", modTime.UTC().Format(http.TimeFormat))
|
w.Header().Set("Last-Modified", modTime.UTC().Format(http.TimeFormat))
|
||||||
}
|
}
|
||||||
|
|
||||||
// currentTime returns time.Now() everytime it's called. It's used for mocking in tests.
|
// currentTime, as it is defined here, returns time.Now().
|
||||||
|
// It's defined as a variable for mocking time in tests.
|
||||||
var currentTime = func() time.Time {
|
var currentTime = func() time.Time {
|
||||||
return time.Now()
|
return time.Now()
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,11 +12,11 @@ import (
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"runtime"
|
|
||||||
"time"
|
"time"
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
"golang.org/x/net/websocket"
|
"golang.org/x/net/websocket"
|
||||||
)
|
)
|
||||||
|
|
|
@ -336,7 +336,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
remoteHost = r.RemoteAddr
|
remoteHost = r.RemoteAddr
|
||||||
}
|
}
|
||||||
|
|
||||||
w.WriteHeader(http.StatusNotFound)
|
w.WriteHeader(http.StatusNotFound)
|
||||||
fmt.Fprintf(w, "No such host at %s", s.Server.Addr)
|
fmt.Fprintf(w, "No such host at %s", s.Server.Addr)
|
||||||
log.Printf("[INFO] %s - No such host at %s (requested by %s)", host, s.Server.Addr, remoteHost)
|
log.Printf("[INFO] %s - No such host at %s (requested by %s)", host, s.Server.Addr, remoteHost)
|
||||||
|
|
Loading…
Reference in a new issue