Source file src/net/http/omithttp2.go

     1  // Copyright 2019 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build nethttpomithttp2
     6  
     7  package http
     8  
     9  import (
    10  	"context"
    11  	"errors"
    12  	"net"
    13  )
    14  
    15  func init() {
    16  	omitBundledHTTP2 = true
    17  }
    18  
    19  const noHTTP2 = "no bundled HTTP/2" // should never see this
    20  
    21  func (s *Server) configureHTTP2()                               {}
    22  func (s *Server) setHTTP2Config(conf http2ExternalServerConfig) {}
    23  func (s *Server) serveHTTP2Conn(ctx context.Context, nc net.Conn, h Handler, sawClientPreface bool, upgradeReq *Request, settings []byte) {
    24  }
    25  
    26  func (t *Transport) configureHTTP2(protocols Protocols) {}
    27  func (t *Transport) http2AddConn(scheme, authority string, nc net.Conn) (RoundTripper, error) {
    28  	return nil, errors.ErrUnsupported
    29  }
    30  func (t *Transport) http2ExternalDial(ctx context.Context, cm connectMethod) (RoundTripper, error) {
    31  	return nil, errors.ErrUnsupported
    32  }
    33  func (t *Transport) http2NewClientConn(nc net.Conn, internalStateHook func()) (RoundTripper, error) {
    34  	return nil, errors.ErrUnsupported
    35  }
    36  func (t *Transport) http2NewClientConnFromContext(ctx context.Context) (*ClientConn, error) {
    37  	return nil, errors.ErrUnsupported
    38  }
    39  
    40  type http2Server struct{}
    41  type http2ExternalServerConfig interface {
    42  	unimplementable()
    43  }
    44  
    45  type http2Transport struct{}
    46  type http2ExternalTransportConfig interface {
    47  	ExternalRoundTrip() bool
    48  	RoundTrip(*Request) (*Response, error)
    49  	Registered(*Transport)
    50  	unimplementable()
    51  }
    52  
    53  func (*http2Transport) CloseIdleConnections()            {}
    54  func (*http2Transport) IdleConnStrsForTesting() []string { return nil }
    55  
    56  type http2RoundTripper struct{}
    57  
    58  func (http2RoundTripper) RoundTrip(*Request) (*Response, error) { panic(noHTTP2) }
    59  

View as plain text