mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 11:58:28 +00:00
cmd/syncthing: Localhost header comparison should be case insensitive
This commit is contained in:
parent
891ff383ec
commit
d1d565e58b
@ -1328,7 +1328,7 @@ func addressIsLocalhost(addr string) bool {
|
|||||||
// There was no port, so we assume the address was just a hostname
|
// There was no port, so we assume the address was just a hostname
|
||||||
host = addr
|
host = addr
|
||||||
}
|
}
|
||||||
switch host {
|
switch strings.ToLower(host) {
|
||||||
case "127.0.0.1", "::1", "localhost":
|
case "127.0.0.1", "::1", "localhost":
|
||||||
return true
|
return true
|
||||||
default:
|
default:
|
||||||
|
@ -833,9 +833,11 @@ func TestAddressIsLocalhost(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
// These are all valid localhost addresses
|
// These are all valid localhost addresses
|
||||||
{"localhost", true},
|
{"localhost", true},
|
||||||
|
{"LOCALHOST", true},
|
||||||
{"::1", true},
|
{"::1", true},
|
||||||
{"127.0.0.1", true},
|
{"127.0.0.1", true},
|
||||||
{"localhost:8080", true},
|
{"localhost:8080", true},
|
||||||
|
{"LOCALHOST:8000", true},
|
||||||
{"[::1]:8080", true},
|
{"[::1]:8080", true},
|
||||||
{"127.0.0.1:8080", true},
|
{"127.0.0.1:8080", true},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user