func()

in mux.go [283:302]


func (m *mux) handleHTTP(srv *http.Server, conn net.Conn, closed <-chan struct{}, handler http.Handler) error {
	// This code is adapted from x/net/http2 to not assume tls.Conn.

	// The TLSNextProto interface predates contexts, so the net/http package passes
	// down its per-connection base context via an exported but unadvertised method
	// on the Handler. This is for internal net/http<=>http2 use only.
	var ctx context.Context
	type baseContexter interface {
		BaseContext() context.Context
	}
	if bc, ok := handler.(baseContexter); ok {
		ctx = bc.BaseContext()
	}
	m.http2Server.ServeConn(conn, &http2.ServeConnOpts{
		Context:    ctx,
		Handler:    handler,
		BaseConfig: srv,
	})
	return nil
}