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