|
|
|
@ -262,13 +262,14 @@ func (v *routeRegexpGroup) setMatch(req *http.Request, m *RouteMatch, r *Route) |
|
|
|
|
|
|
|
|
|
|
|
// getHost tries its best to return the request host.
|
|
|
|
// getHost tries its best to return the request host.
|
|
|
|
func getHost(r *http.Request) string { |
|
|
|
func getHost(r *http.Request) string { |
|
|
|
if !r.URL.IsAbs() { |
|
|
|
if r.URL.IsAbs() { |
|
|
|
host := r.Host |
|
|
|
return r.URL.Host |
|
|
|
// Slice off any port information.
|
|
|
|
} |
|
|
|
if i := strings.Index(host, ":"); i != -1 { |
|
|
|
host := r.Host |
|
|
|
host = host[:i] |
|
|
|
// Slice off any port information.
|
|
|
|
} |
|
|
|
if i := strings.Index(host, ":"); i != -1 { |
|
|
|
return host |
|
|
|
host = host[:i] |
|
|
|
} |
|
|
|
} |
|
|
|
return r.URL.Host |
|
|
|
return host |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|