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  	"errors"
    11  	"sync"
    12  	"time"
    13  )
    14  
    15  func init() {
    16  	omitBundledHTTP2 = true
    17  }
    18  
    19  const noHTTP2 = "no bundled HTTP/2" // should never see this
    20  
    21  var http2errRequestCanceled = errors.New("net/http: request canceled")
    22  
    23  var http2goAwayTimeout = 1 * time.Second
    24  
    25  const http2NextProtoTLS = "h2"
    26  
    27  type http2Transport struct {
    28  	MaxHeaderListSize uint32
    29  	ConnPool          any
    30  }
    31  
    32  func (*http2Transport) RoundTrip(*Request) (*Response, error) { panic(noHTTP2) }
    33  func (*http2Transport) CloseIdleConnections()                 {}
    34  
    35  type http2noDialH2RoundTripper struct{}
    36  
    37  func (http2noDialH2RoundTripper) RoundTrip(*Request) (*Response, error) { panic(noHTTP2) }
    38  
    39  type http2noDialClientConnPool struct {
    40  	http2clientConnPool http2clientConnPool
    41  }
    42  
    43  type http2clientConnPool struct {
    44  	mu    *sync.Mutex
    45  	conns map[string][]*http2clientConn
    46  }
    47  
    48  type http2clientConn struct{}
    49  
    50  type http2clientConnIdleState struct {
    51  	canTakeNewRequest bool
    52  }
    53  
    54  func (cc *http2clientConn) idleState() http2clientConnIdleState { return http2clientConnIdleState{} }
    55  
    56  func http2configureTransports(*Transport) (*http2Transport, error) { panic(noHTTP2) }
    57  
    58  func http2isNoCachedConnError(err error) bool {
    59  	_, ok := err.(interface{ IsHTTP2NoCachedConnError() })
    60  	return ok
    61  }
    62  
    63  type http2Server struct {
    64  	NewWriteScheduler func() http2WriteScheduler
    65  }
    66  
    67  type http2WriteScheduler any
    68  
    69  func http2NewPriorityWriteScheduler(any) http2WriteScheduler { panic(noHTTP2) }
    70  
    71  func http2ConfigureServer(s *Server, conf *http2Server) error { panic(noHTTP2) }
    72  
    73  var http2ErrNoCachedConn = http2noCachedConnError{}
    74  
    75  type http2noCachedConnError struct{}
    76  
    77  func (http2noCachedConnError) IsHTTP2NoCachedConnError() {}
    78  
    79  func (http2noCachedConnError) Error() string { return "http2: no cached connection was available" }
    80  

View as plain text