kubectl: Handle splitting host:port when no port is present

In the proxy filter, if listening on port 80 or 443 there will
be no port present in the Host: HTTP header. Just use the entire
thing in these cases, and don't reject requests when no port
is present in the Host: HTTP header.
This commit is contained in:
Stef Walter
2015-07-02 14:46:43 +02:00
parent 9d32830040
commit 3db0bfdf65
2 changed files with 23 additions and 1 deletions

View File

@@ -309,3 +309,16 @@ func TestPathHandling(t *testing.T) {
}()
}
}
func TestExtractHost(t *testing.T) {
fixtures := map[string]string{
"localhost:8085": "localhost",
"marmalade": "marmalade",
}
for header, expected := range fixtures {
host := extractHost(header)
if host != expected {
t.Fatalf("%s != %s", host, expected)
}
}
}