MCPcopy Create free account
hub / github.com/ContentSquare/chproxy / newServer

Function newServer

main.go:196–208  ·  view source on GitHub ↗
(ln net.Listener, h http.Handler, cfg config.TimeoutCfg)

Source from the content-addressed store, hash-verified

194}
195
196func newServer(ln net.Listener, h http.Handler, cfg config.TimeoutCfg) *http.Server {
197 // nolint:gosec // We already configured ReadTimeout, so no need to set ReadHeaderTimeout as well.
198 return &http.Server{
199 TLSNextProto: make(map[string]func(*http.Server, *tls.Conn, http.Handler)),
200 Handler: h,
201 ReadTimeout: time.Duration(cfg.ReadTimeout),
202 WriteTimeout: time.Duration(cfg.WriteTimeout),
203 IdleTimeout: time.Duration(cfg.IdleTimeout),
204 // Suppress error logging from the server, since chproxy
205 // must handle all these errors in the code.
206 ErrorLog: log.NilLogger,
207 }
208}
209
210func listenAndServe(ln net.Listener, h http.Handler, cfg config.TimeoutCfg) error {
211 s := newServer(ln, h, cfg)

Callers 3

startTLSFunction · 0.85
startHTTPFunction · 0.85
listenAndServeFunction · 0.85

Calls

no outgoing calls

Tested by 2

startTLSFunction · 0.68
startHTTPFunction · 0.68