remove useless return
This commit is contained in:
parent
3829a46f87
commit
ec887ccb93
@ -152,24 +152,6 @@ func (ph *ProxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
mr, ok := containerMethodRegex["*"]
|
||||
if ok {
|
||||
ph.checkMethodAndRegex(w, r, mr)
|
||||
/*
|
||||
var req *regexp.Regexp
|
||||
req, ok = mr[r.Method]
|
||||
if !ok {
|
||||
logDeniedRequest(r, http.StatusMethodNotAllowed, "this HTTP method is not in the list of those authorized for this container")
|
||||
|
||||
http.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
if !req.MatchString(r.URL.Path) {
|
||||
logDeniedRequest(r, http.StatusForbidden, "this path does not match any regular expression for this HTTP method")
|
||||
http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
logAuthorizedRequest(r, "", "incoming request matches a registered regular expression")
|
||||
ph.rp.ServeHTTP(w, r)
|
||||
return
|
||||
*/
|
||||
}
|
||||
var (
|
||||
containerName string
|
||||
@ -183,24 +165,6 @@ func (ph *ProxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
for _, resolvedIP := range resolvedIPs {
|
||||
if resolvedIP.Equal(net.ParseIP(host)) {
|
||||
ph.checkMethodAndRegex(w, r, mr)
|
||||
/*
|
||||
var req *regexp.Regexp
|
||||
req, ok = mr[r.Method]
|
||||
if !ok {
|
||||
logDeniedRequest(r, http.StatusMethodNotAllowed, "this HTTP method is not in the list of those authorized for this container")
|
||||
http.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
if !req.MatchString(r.URL.Path) {
|
||||
logDeniedRequest(r, http.StatusForbidden, "this path does not match any regular expression for this HTTP method")
|
||||
http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
logAuthorizedRequest(r, containerName, "incoming request matches a registered regular expression")
|
||||
|
||||
ph.rp.ServeHTTP(w, r)
|
||||
return
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -242,17 +206,7 @@ func (ph *ProxyHandler) checkMethodAndRegex(w http.ResponseWriter, r *http.Reque
|
||||
return
|
||||
}
|
||||
logAuthorizedRequest(r, "", "incoming request matches a registered regular expression")
|
||||
/*
|
||||
log.Info().
|
||||
Str("remote_addr", r.RemoteAddr).
|
||||
Str("method", r.Method).
|
||||
Str("path", r.URL.Path).
|
||||
Int("status_code", http.StatusOK).
|
||||
Str("status_text", http.StatusText(http.StatusOK)).
|
||||
Msg("incoming request matches a registered regular expression")
|
||||
*/
|
||||
ph.rp.ServeHTTP(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
// action is executed when the ServeCmd command is called.
|
||||
|
Loading…
x
Reference in New Issue
Block a user