carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1package console
2
3import (
4 "net/http"
5 "time"
6)
7
8// NewHTTPServer is the console's http.Server (cmd/console serves with it):
9// ReadHeaderTimeout 10 s, ReadTimeout 5 minutes for request bodies, and no
10// WriteTimeout, because the doors that stream (the db door, the forwarded
11// read) set their own per-write deadlines. A door that holds a request
12// longer than ReadTimeout extends its own read deadline (the import door,
13// the forwarded read); the forwarded read's long-request tests (T7) serve
14// through this constructor. cmd/console's comment above its call says why
15// each value is what it is.
16func NewHTTPServer(h http.Handler) *http.Server {
17 return &http.Server{
18 Handler: h,
19 ReadHeaderTimeout: 10 * time.Second,
20 ReadTimeout: 5 * time.Minute,
21 }
22}
23