File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ import (
2020 "net/http/httptest"
2121 "net/http/httputil"
2222 "net/textproto"
23- "regexp"
2423 "strings"
2524 "sync"
2625
@@ -271,11 +270,11 @@ func (s *Server) buildMuxer() {
271270
272271// publicHostMatcher matches incoming requests against the currently specified server publicHost.
273272func (s * Server ) publicHostMatcher (r * http.Request , rm * mux.RouteMatch ) bool {
274- if strings .Contains (s .publicHost , ":" ) {
273+ if strings .Contains (s .publicHost , ":" ) || ! strings . Contains ( r . Host , ":" ) {
275274 return r .Host == s .publicHost
276275 }
277- matched , _ := regexp . MatchString ( "^" + regexp . QuoteMeta ( s . publicHost ), r .Host )
278- return matched
276+ idx := strings . IndexByte ( r .Host , ':' )
277+ return r . Host [: idx ] == s . publicHost
279278}
280279
281280// Stop stops the server, closing all connections.
You can’t perform that action at this time.
0 commit comments