mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
Make DeadlineConn http.Listener compatible (#20635)
HTTP likes to slap an infinite read deadline on a connection and do a blocking read while the response is being written. This effectively means that a reading deadline becomes the request-response deadline. Instead of enforcing our timeout, we pass it through and keep "infinite deadline" is sticky on connections. However, we still "record" when reads are aborted, so we never overwrite that. The HTTP server should have `ReadTimeout` and `IdleTimeout` set for the deadline to be effective. Use --idle-timeout for incoming connections.
This commit is contained in:
@@ -421,6 +421,7 @@ func serverHandleCmdArgs(ctxt serverCtxt) {
|
||||
Interface: ctxt.Interface,
|
||||
SendBufSize: ctxt.SendBufSize,
|
||||
RecvBufSize: ctxt.RecvBufSize,
|
||||
IdleTimeout: ctxt.IdleTimeout,
|
||||
}
|
||||
|
||||
// allow transport to be HTTP/1.1 for proxying.
|
||||
@@ -878,6 +879,8 @@ func serverMain(ctx *cli.Context) {
|
||||
UseHandler(setCriticalErrorHandler(corsHandler(handler))).
|
||||
UseTLSConfig(newTLSConfig(getCert)).
|
||||
UseIdleTimeout(globalServerCtxt.IdleTimeout).
|
||||
UseReadTimeout(24 * time.Hour). // (overridden by listener.config.IdleTimeout on requests)
|
||||
UseWriteTimeout(24 * time.Hour). // (overridden by listener.config.IdleTimeout on requests)
|
||||
UseReadHeaderTimeout(globalServerCtxt.ReadHeaderTimeout).
|
||||
UseBaseContext(GlobalContext).
|
||||
UseCustomLogger(log.New(io.Discard, "", 0)). // Turn-off random logging by Go stdlib
|
||||
|
||||
Reference in New Issue
Block a user