home: imp docs

This commit is contained in:
Ainar Garipov 2022-09-19 17:17:12 +03:00
parent ed209daf8a
commit 27b0251b5b
1 changed files with 10 additions and 7 deletions

View File

@ -169,15 +169,15 @@ func (web *Web) Start() {
printHTTPAddresses(schemeHTTP)
errs := make(chan error, 2)
// h2s adds support for plain h2c
h2s := &http2.Server{}
// Use an h2c handler to support unencrypted HTTP/2, e.g. for proxies.
hdlr := h2c.NewHandler(withMiddlewares(Context.mux, limitRequestBody), &http2.Server{})
// Create a new instance, because the Web is not usable after Shutdown.
hostStr := web.conf.BindHost.String()
// we need to have new instance, because after Shutdown() the Server is not usable
web.httpServer = &http.Server{
ErrorLog: log.StdLog("web: plain", log.DEBUG),
Addr: netutil.JoinHostPort(hostStr, web.conf.BindPort),
Handler: h2c.NewHandler(withMiddlewares(Context.mux, limitRequestBody), h2s),
Handler: hdlr,
ReadTimeout: web.conf.ReadTimeout,
ReadHeaderTimeout: web.conf.ReadHeaderTimeout,
WriteTimeout: web.conf.WriteTimeout,
@ -207,13 +207,16 @@ func (web *Web) startBetaServer(hostStr string) {
return
}
// h2s adds support for plain h2c
h2s := &http2.Server{}
// Use an h2c handler to support unencrypted HTTP/2, e.g. for proxies.
hdlr := h2c.NewHandler(
withMiddlewares(Context.mux, limitRequestBody, web.wrapIndexBeta),
&http2.Server{},
)
web.httpServerBeta = &http.Server{
ErrorLog: log.StdLog("web: plain: beta", log.DEBUG),
Addr: netutil.JoinHostPort(hostStr, web.conf.BetaBindPort),
Handler: h2c.NewHandler(withMiddlewares(Context.mux, limitRequestBody, web.wrapIndexBeta), h2s),
Handler: hdlr,
ReadTimeout: web.conf.ReadTimeout,
ReadHeaderTimeout: web.conf.ReadHeaderTimeout,
WriteTimeout: web.conf.WriteTimeout,