Browse Source

Rearrange getHost function

pull/71/head
Felipe Madrigal 11 years ago
parent
commit
8df3a80fb8
  1. 7
      regexp.go

7
regexp.go

@ -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() {
return r.URL.Host
}
host := r.Host host := r.Host
// Slice off any port information. // Slice off any port information.
if i := strings.Index(host, ":"); i != -1 { if i := strings.Index(host, ":"); i != -1 {
host = host[:i] host = host[:i]
} }
return host return host
}
return r.URL.Host
} }

Loading…
Cancel
Save