Add stripPort helper
This commit is contained in:
parent
29c849f993
commit
6e30ede516
1 changed files with 13 additions and 1 deletions
|
@ -131,10 +131,22 @@ func (a authReq) Parse(ing *extensions.Ingress) (interface{}, error) {
|
||||||
|
|
||||||
return &External{
|
return &External{
|
||||||
URL: str,
|
URL: str,
|
||||||
Host: ur.Hostname(),
|
Host: stripPort(ur.Host),
|
||||||
SigninURL: signin,
|
SigninURL: signin,
|
||||||
Method: m,
|
Method: m,
|
||||||
SendBody: sb,
|
SendBody: sb,
|
||||||
ResponseHeaders: h,
|
ResponseHeaders: h,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Remove after upgrade to Go 1.8
|
||||||
|
func stripPort(hostport string) string {
|
||||||
|
colon := strings.IndexByte(hostport, ':')
|
||||||
|
if colon == -1 {
|
||||||
|
return hostport
|
||||||
|
}
|
||||||
|
if i := strings.IndexByte(hostport, ']'); i != -1 {
|
||||||
|
return strings.TrimPrefix(hostport[:i], "[")
|
||||||
|
}
|
||||||
|
return hostport[:colon]
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue