diff options
author | Aoang <aoang@x2ox.com> | 2022-03-20 21:34:31 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-20 14:34:31 +0100 |
commit | f3bce3aa6e9450a6f69ae3f98b6db0958d67233c (patch) | |
tree | e526052c5f4d730d6dec67c71dcdaa6ee8068b77 /server.go | |
parent | Fix race conditions in tests (diff) | |
download | fasthttp-f3bce3aa6e9450a6f69ae3f98b6db0958d67233c.tar.gz fasthttp-f3bce3aa6e9450a6f69ae3f98b6db0958d67233c.tar.bz2 fasthttp-f3bce3aa6e9450a6f69ae3f98b6db0958d67233c.zip |
Add Go 1.18 support (#1253)
* Add Go 1.18 support
* fix Gosec Security Scanner
https://github.com/valyala/fasthttp/runs/5595618634?check_suite_focus=true
* fix https://github.com/securego/gosec/issues/469#issuecomment-1070608395 Gosec Github Action Doesn't Work at Go 1.18
* fix https://github.com/golangci/golangci-lint/pull/2438 golangci/golangci-lint Doesn't Work at Go 1.18
* fix golint unused
* fix golint: SA1019: netErr.Temporary is deprecated
* fix https://github.com/valyala/fasthttp/issues/1256
Diffstat (limited to 'server.go')
-rw-r--r-- | server.go | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -482,7 +482,7 @@ func TimeoutWithCodeHandler(h RequestHandler, timeout time.Duration, msg string, } } -//RequestConfig configure the per request deadline and body limits +// RequestConfig configure the per request deadline and body limits type RequestConfig struct { // ReadTimeout is the maximum duration for reading the entire // request body. @@ -1915,8 +1915,8 @@ func acceptConn(s *Server, ln net.Listener, lastPerIPErrorTime *time.Time) (net. if c != nil { panic("BUG: net.Listener returned non-nil conn and non-nil error") } - if netErr, ok := err.(net.Error); ok && netErr.Temporary() { - s.logger().Printf("Temporary error when accepting new connections: %s", netErr) + if netErr, ok := err.(net.Error); ok && netErr.Timeout() { + s.logger().Printf("Timeout error when accepting new connections: %s", netErr) time.Sleep(time.Second) continue } @@ -2230,7 +2230,7 @@ func (s *Server) serveConn(c net.Conn) (err error) { writeTimeout = reqConf.WriteTimeout } } - //read body + // read body if s.StreamRequestBody { err = ctx.Request.readBodyStream(br, maxRequestBodySize, s.GetOnly, !s.DisablePreParseMultipartForm) } else { |