Skip to content

Commit

Permalink
Fix pattern suffix.
Browse files Browse the repository at this point in the history
  • Loading branch information
can1357 committed Mar 27, 2024
1 parent 3639626 commit 0e6957c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions vhttp/pattern.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ func (p patternSuffix) Match(host, path string) bool {
if patternLen <= pathLen {
return path[pathLen-patternLen:] == p.suffix
}
if path != p.suffix[pathLen:] {
pos := patternLen - pathLen
if path != p.suffix[pos:] {
return false
}
sfx := p.suffix[:pathLen]
sfx := p.suffix[:pos]
return strings.HasSuffix(host, sfx)
}

Expand Down

0 comments on commit 0e6957c

Please sign in to comment.