Browse Source

Ignore context errors related to the remote host prematurely closing the

connection.
multi-app
Benjamin Shelton 2 months ago
parent
commit
74b6017e9e
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      router.go

+ 9
- 0
router.go View File

@@ -454,6 +454,15 @@ func defaultErrorFunc(router *Router) func(Context) {
ctx.SetRenderer(router.renderer)
}

if e := ctx.Error(); len(e) > 0 {
if len(e) > 24 && e[len(e)-24:] == "connection reset by peer" {
return
}
if len(e) > 11 && e[len(e)-11:] == "broken pipe" {
return
}
}

ctx.WriteHeader(ctx.Code())
ctx.ContentType(TextHTML)
// This is not the ideal solution since we only examine a) the presence of


Loading…
Cancel
Save