Do not log ErrSmallBuffer for request headers

fasthttp returns a 431 error when the request headers are too large.
Most other HTTP servers do not log an error when the request header
exceeds the limit. When serving HTTP requests directly to browsers,
it is normal to occasionally hit the limit due to broken browsers
or broken sites linking to your resource. These issues are generally
outside of your control in the same way the already ignored errors are.
This commit is contained in:
Erik Dubbelboer
2018-08-26 16:07:42 +08:00
committed by Kirill Danshin
parent 77385190fb
commit fbf4b2d9cd
+1
View File
@@ -211,6 +211,7 @@ func (wp *workerPool) workerFunc(ch *workerChan) {
errStr := err.Error()
if wp.LogAllErrors || !(strings.Contains(errStr, "broken pipe") ||
strings.Contains(errStr, "reset by peer") ||
strings.Contains(errStr, "request headers: small read buffer") ||
strings.Contains(errStr, "i/o timeout")) {
wp.Logger.Printf("error when serving connection %q<->%q: %s", c.LocalAddr(), c.RemoteAddr(), err)
}