You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Potential fix is editing getHost() https://github.com/gorilla/mux/blob/master/regexp.go#L237 so it has a flag as to whether to strip off the port information. A new field would need to be probably need to be added somewhere such as routeRegexp.
The main reason I was using Host() match with a port in the first place is for trying to build reverse routes that include the absolute path as opposed to a relative one.
The text was updated successfully, but these errors were encountered:
An other problem with the Host() function is that it can't handle ipv6 addresses well.
For the "http://[::1]:8080/foo" url, and Host("{host:.+}") regexp, mux.Vars returns map[string]string{"file":"foo", "host":"["}
What's the status of this issue? Experimentation makes me believe that currently, one has to call Host() without a port, and that will work even if the Host header includes a port. Is that correct?
Also, in response to @soul9, getHost() should probably use net.SplitHostPort instead of just splitting on a colon, but that's a different issue.
Old issue: http://code.google.com/p/gorilla/issues/detail?id=51
According to section 14.23 of RFC 2616 the Host header can include the port number if the default value of 80 is not used.
See https://github.com/gorilla/mux/blob/master/mux_test.go#L119 for a commented-out test case that fails.
Potential fix is editing getHost() https://github.com/gorilla/mux/blob/master/regexp.go#L237 so it has a flag as to whether to strip off the port information. A new field would need to be probably need to be added somewhere such as routeRegexp.
The main reason I was using Host() match with a port in the first place is for trying to build reverse routes that include the absolute path as opposed to a relative one.
The text was updated successfully, but these errors were encountered: