fix: prevent nil panic for unsafe HEAD requests

This commit is contained in:
Mhammed Talhaouy
2026-03-19 00:12:21 +00:00
committed by GitHub
parent 0045108570
commit 8ae53cb9ae
+3 -3
View File
@@ -224,11 +224,11 @@ get_response:
}
var shouldIgnoreErrors, shouldIgnoreBodyErrors bool
switch {
case h.Options.Unsafe && req.Method == http.MethodHead && !stringsutil.ContainsAny(err.Error(), "i/o timeout"):
if h.Options.Unsafe && req.Method == http.MethodHead && err != nil &&
!stringsutil.ContainsAny(err.Error(), "i/o timeout") {
shouldIgnoreErrors = true
shouldIgnoreBodyErrors = true
}
}
var resp Response
resp.Input = req.Host