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:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user