package console import ( "net/http" "time" ) // NewHTTPServer is the console's http.Server (cmd/console serves with it): // ReadHeaderTimeout 10 s, ReadTimeout 5 minutes for request bodies, and no // WriteTimeout, because the doors that stream (the db door, the forwarded // read) set their own per-write deadlines. A door that holds a request // longer than ReadTimeout extends its own read deadline (the import door, // the forwarded read); the forwarded read's long-request tests (T7) serve // through this constructor. cmd/console's comment above its call says why // each value is what it is. func NewHTTPServer(h http.Handler) *http.Server { return &http.Server{ Handler: h, ReadHeaderTimeout: 10 * time.Second, ReadTimeout: 5 * time.Minute, } }