-
Notifications
You must be signed in to change notification settings - Fork 17.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net/http: support disabling built-in HTTP/2 with a new build tag
Fixes #35082 Updates #6853 Change-Id: I4eeb0e15f534cff57fefb6039cd33fadf15b946e Reviewed-on: https://go-review.googlesource.com/c/go/+/205139 Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Reviewed-by: David Crawshaw <crawshaw@golang.org>
- Loading branch information
Showing
11 changed files
with
131 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Copyright 2019 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// +build nethttpomithttp2 | ||
|
||
package http | ||
|
||
import ( | ||
"errors" | ||
"sync" | ||
"time" | ||
) | ||
|
||
func init() { | ||
omitBundledHTTP2 = true | ||
} | ||
|
||
const noHTTP2 = "no bundled HTTP/2" // should never see this | ||
|
||
var http2errRequestCanceled = errors.New("net/http: request canceled") | ||
|
||
var http2goAwayTimeout = 1 * time.Second | ||
|
||
const http2NextProtoTLS = "h2" | ||
|
||
type http2Transport struct { | ||
MaxHeaderListSize uint32 | ||
ConnPool interface{} | ||
} | ||
|
||
func (*http2Transport) RoundTrip(*Request) (*Response, error) { panic(noHTTP2) } | ||
func (*http2Transport) CloseIdleConnections() {} | ||
|
||
type http2erringRoundTripper struct{} | ||
|
||
func (http2erringRoundTripper) RoundTrip(*Request) (*Response, error) { panic(noHTTP2) } | ||
|
||
type http2noDialClientConnPool struct { | ||
http2clientConnPool http2clientConnPool | ||
} | ||
|
||
type http2clientConnPool struct { | ||
mu *sync.Mutex | ||
conns map[string][]struct{} | ||
} | ||
|
||
func http2configureTransport(*Transport) (*http2Transport, error) { panic(noHTTP2) } | ||
|
||
func http2isNoCachedConnError(err error) bool { | ||
_, ok := err.(interface{ IsHTTP2NoCachedConnError() }) | ||
return ok | ||
} | ||
|
||
type http2Server struct { | ||
NewWriteScheduler func() http2WriteScheduler | ||
} | ||
|
||
type http2WriteScheduler interface{} | ||
|
||
func http2NewPriorityWriteScheduler(interface{}) http2WriteScheduler { panic(noHTTP2) } | ||
|
||
func http2ConfigureServer(s *Server, conf *http2Server) error { panic(noHTTP2) } | ||
|
||
var http2ErrNoCachedConn = http2noCachedConnError{} | ||
|
||
type http2noCachedConnError struct{} | ||
|
||
func (http2noCachedConnError) IsHTTP2NoCachedConnError() {} | ||
|
||
func (http2noCachedConnError) Error() string { return "http2: no cached connection was available" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters