@ -41,6 +41,7 @@ func StartHTTPEndpoint(endpoint string, timeouts rpc.HTTPTimeouts, handler http.
httpSrv := & http . Server {
httpSrv := & http . Server {
Handler : handler ,
Handler : handler ,
ReadTimeout : timeouts . ReadTimeout ,
ReadTimeout : timeouts . ReadTimeout ,
ReadHeaderTimeout : timeouts . ReadHeaderTimeout ,
WriteTimeout : timeouts . WriteTimeout ,
WriteTimeout : timeouts . WriteTimeout ,
IdleTimeout : timeouts . IdleTimeout ,
IdleTimeout : timeouts . IdleTimeout ,
}
}
@ -75,6 +76,10 @@ func CheckTimeouts(timeouts *rpc.HTTPTimeouts) {
log . Warn ( "Sanitizing invalid HTTP read timeout" , "provided" , timeouts . ReadTimeout , "updated" , rpc . DefaultHTTPTimeouts . ReadTimeout )
log . Warn ( "Sanitizing invalid HTTP read timeout" , "provided" , timeouts . ReadTimeout , "updated" , rpc . DefaultHTTPTimeouts . ReadTimeout )
timeouts . ReadTimeout = rpc . DefaultHTTPTimeouts . ReadTimeout
timeouts . ReadTimeout = rpc . DefaultHTTPTimeouts . ReadTimeout
}
}
if timeouts . ReadHeaderTimeout < time . Second {
log . Warn ( "Sanitizing invalid HTTP read header timeout" , "provided" , timeouts . ReadHeaderTimeout , "updated" , rpc . DefaultHTTPTimeouts . ReadHeaderTimeout )
timeouts . ReadHeaderTimeout = rpc . DefaultHTTPTimeouts . ReadHeaderTimeout
}
if timeouts . WriteTimeout < time . Second {
if timeouts . WriteTimeout < time . Second {
log . Warn ( "Sanitizing invalid HTTP write timeout" , "provided" , timeouts . WriteTimeout , "updated" , rpc . DefaultHTTPTimeouts . WriteTimeout )
log . Warn ( "Sanitizing invalid HTTP write timeout" , "provided" , timeouts . WriteTimeout , "updated" , rpc . DefaultHTTPTimeouts . WriteTimeout )
timeouts . WriteTimeout = rpc . DefaultHTTPTimeouts . WriteTimeout
timeouts . WriteTimeout = rpc . DefaultHTTPTimeouts . WriteTimeout