Source file src/net/http/omithttp2client.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 || nethttpomithttp2client
     6  
     7  package http
     8  
     9  import (
    10  	"context"
    11  	"errors"
    12  	"net"
    13  )
    14  
    15  // omitHTTP2Client is true when the nethttpomithttp2 or
    16  // nethttpomithttp2client build tag is set, which means http2client.go
    17  // isn't compiled in and we shouldn't try to use it.
    18  const omitHTTP2Client = true
    19  
    20  const noHTTP2 = "no bundled HTTP/2" // should never see this
    21  
    22  func (t *Transport) configureHTTP2(protocols Protocols) {}
    23  func (t *Transport) http2AddConn(scheme, authority string, nc net.Conn) (RoundTripper, error) {
    24  	return nil, errors.ErrUnsupported
    25  }
    26  func (t *Transport) http2ExternalDial(ctx context.Context, cm connectMethod) (RoundTripper, error) {
    27  	return nil, errors.ErrUnsupported
    28  }
    29  func (t *Transport) http2NewClientConn(nc net.Conn, internalStateHook func()) (RoundTripper, error) {
    30  	return nil, errors.ErrUnsupported
    31  }
    32  func (t *Transport) http2NewClientConnFromContext(ctx context.Context) (*ClientConn, error) {
    33  	return nil, errors.ErrUnsupported
    34  }
    35  
    36  type http2Transport struct{}
    37  type http2ExternalTransportConfig interface {
    38  	ExternalRoundTrip() bool
    39  	RoundTrip(*Request) (*Response, error)
    40  	Registered(*Transport)
    41  	unimplementable()
    42  }
    43  
    44  func (*http2Transport) CloseIdleConnections()            {}
    45  func (*http2Transport) IdleConnStrsForTesting() []string { return nil }
    46  
    47  type http2RoundTripper struct{}
    48  
    49  func (http2RoundTripper) RoundTrip(*Request) (*Response, error) { panic(noHTTP2) }
    50  

View as plain text