Merge pull request #2455 from tal7aouy/fix/unsafe-head-nil-pointer

fix: prevent nil panic for unsafe HEAD requests
This commit is contained in:
Mzack9999
2026-03-21 00:10:59 +01:00
committed by GitHub
+2 -2
View File
@@ -228,8 +228,8 @@ 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
}