Skip to content

Commit 351305f

Browse files
module: Make the most common response code checked first.
1 parent 7f7fd13 commit 351305f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

module.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ func (m *Module) ServeHTTP(w http.ResponseWriter, req *http.Request) {
121121

122122
wafresponse := out.WAFResponse
123123
switch {
124-
case m.config.IsBlockCode(int(wafresponse)):
125-
status := int(wafresponse)
126-
http.Error(rw, fmt.Sprintf("%d %s\n", status, http.StatusText(status)), status)
127124
case m.config.IsAllowCode(int(wafresponse)):
128125
// continue with normal request
129126
m.handler.ServeHTTP(rw, req)
127+
case m.config.IsBlockCode(int(wafresponse)):
128+
status := int(wafresponse)
129+
http.Error(rw, fmt.Sprintf("%d %s\n", status, http.StatusText(status)), status)
130130
default:
131131
log.Printf("ERROR: Received invalid response code from inspector (failing open): %d", wafresponse)
132132
// continue with normal request

0 commit comments

Comments
 (0)