Skip to content

Commit

Permalink
fix: regression in vars extract for wildcard host
Browse files Browse the repository at this point in the history
Continuing from PR #447 we have to add extra
check to ignore the port as well
  • Loading branch information
harshavardhana committed Jul 10, 2020
1 parent 948bec3 commit d2eaf19
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions regexp.go
Expand Up @@ -325,6 +325,12 @@ func (v routeRegexpGroup) setMatch(req *http.Request, m *RouteMatch, r *Route) {
// Store host variables.
if v.host != nil {
host := getHost(req)
if v.host.wildcardHostPort {
// Don't be strict on the port match
if i := strings.Index(host, ":"); i != -1 {
host = host[:i]
}
}
matches := v.host.regexp.FindStringSubmatchIndex(host)
if len(matches) > 0 {
extractVars(host, matches, v.host.varsN, m.Vars)
Expand Down

0 comments on commit d2eaf19

Please sign in to comment.