go/src/net/http/transport_test.go

var hostPortHandler

type testCloseConn

func (c *testCloseConn) Close() error {}

type testConnSet

func (tcs *testConnSet) insert(c net.Conn) {}

func (tcs *testConnSet) remove(c net.Conn) {}

// some tests use this to manage raw tcp connections for later inspection
func makeTestDial(t *testing.T) (*testConnSet, func(n, addr string) (net.Conn, error)) {}

func (tcs *testConnSet) check(t *testing.T) {}

func TestReuseRequest(t *testing.T) {}

func testReuseRequest(t *testing.T, mode testMode) {}

// Two subsequent requests and verify their response is the same.
// The response from the server is our own IP:port
func TestTransportKeepAlives(t *testing.T) {}

func testTransportKeepAlives(t *testing.T, mode testMode) {}

func TestTransportConnectionCloseOnResponse(t *testing.T) {}

func testTransportConnectionCloseOnResponse(t *testing.T, mode testMode) {}

// TestTransportConnectionCloseOnRequest tests that the Transport's doesn't reuse
// an underlying TCP connection after making an http.Request with Request.Close set.
//
// It tests the behavior by making an HTTP request to a server which
// describes the source connection it got (remote port number +
// address of its net.Conn).
func TestTransportConnectionCloseOnRequest(t *testing.T) {}

func testTransportConnectionCloseOnRequest(t *testing.T, mode testMode) {}

// if the Transport's DisableKeepAlives is set, all requests should
// send Connection: close.
// HTTP/1-only (Connection: close doesn't exist in h2)
func TestTransportConnectionCloseOnRequestDisableKeepAlive(t *testing.T) {}

func testTransportConnectionCloseOnRequestDisableKeepAlive(t *testing.T, mode testMode) {}

// Test that Transport only sends one "Connection: close", regardless of
// how "close" was indicated.
func TestTransportRespectRequestWantsClose(t *testing.T) {}

func testTransportRespectRequestWantsClose(t *testing.T, mode testMode) {}

func TestTransportIdleCacheKeys(t *testing.T) {}

func testTransportIdleCacheKeys(t *testing.T, mode testMode) {}

// Tests that the HTTP transport re-uses connections when a client
// reads to the end of a response Body without closing it.
func TestTransportReadToEndReusesConn(t *testing.T) {}

func testTransportReadToEndReusesConn(t *testing.T, mode testMode) {}

func TestTransportMaxPerHostIdleConns(t *testing.T) {}

func testTransportMaxPerHostIdleConns(t *testing.T, mode testMode) {}

func TestTransportMaxConnsPerHostIncludeDialInProgress(t *testing.T) {}

func testTransportMaxConnsPerHostIncludeDialInProgress(t *testing.T, mode testMode) {}

func TestTransportMaxConnsPerHost(t *testing.T) {}

func testTransportMaxConnsPerHost(t *testing.T, mode testMode) {}

func TestTransportMaxConnsPerHostDialCancellation(t *testing.T) {}

func testTransportMaxConnsPerHostDialCancellation(t *testing.T, mode testMode) {}

func TestTransportRemovesDeadIdleConnections(t *testing.T) {}

func testTransportRemovesDeadIdleConnections(t *testing.T, mode testMode) {}

// Test that the Transport notices when a server hangs up on its
// unexpectedly (a keep-alive connection is closed).
func TestTransportServerClosingUnexpectedly(t *testing.T) {}

func testTransportServerClosingUnexpectedly(t *testing.T, mode testMode) {}

// Test for https://golang.org/issue/2616 (appropriate issue number)
// This fails pretty reliably with GOMAXPROCS=100 or something high.
func TestStressSurpriseServerCloses(t *testing.T) {}

func testStressSurpriseServerCloses(t *testing.T, mode testMode) {}

// TestTransportHeadResponses verifies that we deal with Content-Lengths
// with no bodies properly
func TestTransportHeadResponses(t *testing.T) {}

func testTransportHeadResponses(t *testing.T, mode testMode) {}

// TestTransportHeadChunkedResponse verifies that we ignore chunked transfer-encoding
// on responses to HEAD requests.
func TestTransportHeadChunkedResponse(t *testing.T) {}

func testTransportHeadChunkedResponse(t *testing.T, mode testMode) {}

var roundTripTests

// Test that the modification made to the Request by the RoundTripper is cleaned up
func TestRoundTripGzip(t *testing.T) {}

func testRoundTripGzip(t *testing.T, mode testMode) {}

func TestTransportGzip(t *testing.T) {}

func testTransportGzip(t *testing.T, mode testMode) {}

type transport100ContinueTest

const transport100ContinueTestBody

// newTransport100ContinueTest creates a Transport and sends an Expect: 100-continue
// request on it.
func newTransport100ContinueTest(t *testing.T, timeout time.Duration) *transport100ContinueTest {}

// respond sends response lines from the server to the transport.
func (test *transport100ContinueTest) respond(lines ...string) {}

// wantBodySent ensures the transport has sent the request body to the server.
func (test *transport100ContinueTest) wantBodySent() {}

// wantRequestDone ensures the Transport.RoundTrip has completed with the expected status.
func (test *transport100ContinueTest) wantRequestDone(want int) {}

func TestTransportExpect100ContinueSent(t *testing.T) {}

func TestTransportExpect100Continue200ResponseNoConnClose(t *testing.T) {}

func TestTransportExpect100Continue200ResponseWithConnClose(t *testing.T) {}

func TestTransportExpect100Continue500ResponseNoConnClose(t *testing.T) {}

func TestTransportExpect100Continue500ResponseTimeout(t *testing.T) {}

func TestSOCKS5Proxy(t *testing.T) {}

func testSOCKS5Proxy(t *testing.T, mode testMode) {}

func TestTransportProxy(t *testing.T) {}

func TestOnProxyConnectResponse(t *testing.T) {}

// Issue 28012: verify that the Transport closes its TCP connection to http proxies
// when they're slow to reply to HTTPS CONNECT responses.
func TestTransportProxyHTTPSConnectLeak(t *testing.T) {}

// Issue 16997: test transport dial preserves typed errors
func TestTransportDialPreservesNetOpProxyError(t *testing.T) {}

// Issue 36431: calls to RoundTrip should not mutate t.ProxyConnectHeader.
//
// (A bug caused dialConn to instead write the per-request Proxy-Authorization
// header through to the shared Header instance, introducing a data race.)
func TestTransportProxyDialDoesNotMutateProxyConnectHeader(t *testing.T) {}

func testTransportProxyDialDoesNotMutateProxyConnectHeader(t *testing.T, mode testMode) {}

// TestTransportGzipRecursive sends a gzip quine and checks that the
// client gets the same value back. This is more cute than anything,
// but checks that we don't recurse forever, and checks that
// Content-Encoding is removed.
func TestTransportGzipRecursive(t *testing.T) {}

func testTransportGzipRecursive(t *testing.T, mode testMode) {}

// golang.org/issue/7750: request fails when server replies with
// a short gzip body
func TestTransportGzipShort(t *testing.T) {}

func testTransportGzipShort(t *testing.T, mode testMode) {}

// Wait until number of goroutines is no greater than nmax, or time out.
func waitNumGoroutine(nmax int) int {}

// tests that persistent goroutine connections shut down when no longer desired.
func TestTransportPersistConnLeak(t *testing.T) {}

func testTransportPersistConnLeak(t *testing.T, mode testMode) {}

// golang.org/issue/4531: Transport leaks goroutines when
// request.ContentLength is explicitly short
func TestTransportPersistConnLeakShortBody(t *testing.T) {}

func testTransportPersistConnLeakShortBody(t *testing.T, mode testMode) {}

type countedConn

type countingDialer

func (d *countingDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) {}

func (d *countingDialer) decrement(*countedConn) {}

func (d *countingDialer) Read() (total, live int64) {}

func TestTransportPersistConnLeakNeverIdle(t *testing.T) {}

func testTransportPersistConnLeakNeverIdle(t *testing.T, mode testMode) {}

type countedContext

type contextCounter

func (cc *contextCounter) Track(ctx context.Context) context.Context {}

func (cc *contextCounter) decrement(*countedContext) {}

func (cc *contextCounter) Read() (live int64) {}

func TestTransportPersistConnContextLeakMaxConnsPerHost(t *testing.T) {}

func testTransportPersistConnContextLeakMaxConnsPerHost(t *testing.T, mode testMode) {}

// This used to crash; https://golang.org/issue/3266
func TestTransportIdleConnCrash(t *testing.T) {}

func testTransportIdleConnCrash(t *testing.T, mode testMode) {}

// Test that the transport doesn't close the TCP connection early,
// before the response body has been read. This was a regression
// which sadly lacked a triggering test. The large response body made
// the old race easier to trigger.
func TestIssue3644(t *testing.T) {}

func testIssue3644(t *testing.T, mode testMode) {}

// Test that a client receives a server's reply, even if the server doesn't read
// the entire request body.
func TestIssue3595(t *testing.T) {}

func testIssue3595(t *testing.T, mode testMode) {}

// From https://golang.org/issue/4454 ,
// "client fails to handle requests with no body and chunked encoding"
func TestChunkedNoContent(t *testing.T) {}

func testChunkedNoContent(t *testing.T, mode testMode) {}

func TestTransportConcurrency(t *testing.T) {}

func testTransportConcurrency(t *testing.T, mode testMode) {}

func TestIssue4191_InfiniteGetTimeout(t *testing.T) {}

func testIssue4191_InfiniteGetTimeout(t *testing.T, mode testMode) {}

func TestIssue4191_InfiniteGetToPutTimeout(t *testing.T) {}

func testIssue4191_InfiniteGetToPutTimeout(t *testing.T, mode testMode) {}

func TestTransportResponseHeaderTimeout(t *testing.T) {}

func testTransportResponseHeaderTimeout(t *testing.T, mode testMode) {}

type cancelTest

// runCancelTestTransport uses Transport.CancelRequest.
func runCancelTestTransport(t *testing.T, mode testMode, f func(t *testing.T, test cancelTest)) {}

// runCancelTestChannel uses Request.Cancel.
func runCancelTestChannel(t *testing.T, mode testMode, f func(t *testing.T, test cancelTest)) {}

// runCancelTestContext uses a request context.
func runCancelTestContext(t *testing.T, mode testMode, f func(t *testing.T, test cancelTest)) {}

func runCancelTest(t *testing.T, f func(t *testing.T, test cancelTest), opts ...any) {}

func TestTransportCancelRequest(t *testing.T) {}

func testTransportCancelRequest(t *testing.T, test cancelTest) {}

func testTransportCancelRequestInDo(t *testing.T, test cancelTest, body io.Reader) {}

func TestTransportCancelRequestInDo(t *testing.T) {}

func TestTransportCancelRequestWithBodyInDo(t *testing.T) {}

func TestTransportCancelRequestInDial(t *testing.T) {}

func testTransportCancelRequestInDial(t *testing.T, test cancelTest) {}

// Issue 51354
func TestTransportCancelRequestWithBody(t *testing.T) {}

func testTransportCancelRequestWithBody(t *testing.T, test cancelTest) {}

func TestTransportCancelRequestBeforeDo(t *testing.T) {}

func testTransportCancelRequestBeforeDo(t *testing.T, test cancelTest) {}

// Issue 11020. The returned error message should be errRequestCanceled
func TestTransportCancelRequestBeforeResponseHeaders(t *testing.T) {}

func testTransportCancelRequestBeforeResponseHeaders(t *testing.T, test cancelTest) {}

// golang.org/issue/3672 -- Client can't close HTTP stream
// Calling Close on a Response.Body used to just read until EOF.
// Now it actually closes the TCP connection.
func TestTransportCloseResponseBody(t *testing.T) {}

func testTransportCloseResponseBody(t *testing.T, mode testMode) {}

type fooProto

func (fooProto) RoundTrip(req *Request) (*Response, error) {}

func TestTransportAltProto(t *testing.T) {}

func TestTransportNoHost(t *testing.T) {}

// Issue 13311
func TestTransportEmptyMethod(t *testing.T) {}

func TestTransportSocketLateBinding(t *testing.T) {}

func testTransportSocketLateBinding(t *testing.T, mode testMode) {}

// Issue 2184
func TestTransportReading100Continue(t *testing.T) {}

// Issue 17739: the HTTP client must ignore any unknown 1xx
// informational responses before the actual response.
func TestTransportIgnore1xxResponses(t *testing.T) {}

func testTransportIgnore1xxResponses(t *testing.T, mode testMode) {}

func TestTransportLimits1xxResponses(t *testing.T) {}

func testTransportLimits1xxResponses(t *testing.T, mode testMode) {}

func TestTransportDoesNotLimitDelivered1xxResponses(t *testing.T) {}

func testTransportDoesNotLimitDelivered1xxResponses(t *testing.T, mode testMode) {}

// Issue 26161: the HTTP client must treat 101 responses
// as the final response.
func TestTransportTreat101Terminal(t *testing.T) {}

func testTransportTreat101Terminal(t *testing.T, mode testMode) {}

type proxyFromEnvTest

func (t proxyFromEnvTest) String() string {}

var proxyFromEnvTests

func testProxyForRequest(t *testing.T, tt proxyFromEnvTest, proxyForRequest func(req *Request) (*url.URL, error)) {}

func TestProxyFromEnvironment(t *testing.T) {}

func TestProxyFromEnvironmentLowerCase(t *testing.T) {}

func TestIdleConnChannelLeak(t *testing.T) {}

func testIdleConnChannelLeak(t *testing.T, mode testMode) {}

// Verify the status quo: that the Client.Post function coerces its
// body into a ReadCloser if it's a Closer, and that the Transport
// then closes it.
func TestTransportClosesRequestBody(t *testing.T) {}

func testTransportClosesRequestBody(t *testing.T, mode testMode) {}

func TestTransportTLSHandshakeTimeout(t *testing.T) {}

// Trying to repro golang.org/issue/3514
func TestTLSServerClosesConnection(t *testing.T) {}

func testTLSServerClosesConnection(t *testing.T, mode testMode) {}

type byteFromChanReader

func (c byteFromChanReader) Read(p []byte) (n int, err error) {}

// Verifies that the Transport doesn't reuse a connection in the case
// where the server replies before the request has been fully
// written. We still honor that reply (see TestIssue3595), but don't
// send future requests on the connection because it's then in a
// questionable state.
// golang.org/issue/7569
func TestTransportNoReuseAfterEarlyResponse(t *testing.T) {}

func testTransportNoReuseAfterEarlyResponse(t *testing.T, mode testMode) {}

// Tests that we don't leak Transport persistConn.readLoop goroutines
// when a server hangs up immediately after saying it would keep-alive.
func TestTransportIssue10457(t *testing.T) {}

func testTransportIssue10457(t *testing.T, mode testMode) {}

type closerFunc

func (f closerFunc) Close() error {}

type writerFuncConn

func (c writerFuncConn) Write(p []byte) (n int, err error) {}

// Issues 4677, 18241, and 17844. If we try to reuse a connection that the
// server is in the process of closing, we may end up successfully writing out
// our request (or a portion of our request) only to find a connection error
// when we try to read from (or finish writing to) the socket.
//
// NOTE: we resend a request only if:
//   - we reused a keep-alive connection
//   - we haven't yet received any header data
//   - either we wrote no bytes to the server, or the request is idempotent
//
// This automatically prevents an infinite resend loop because we'll run out of
// the cached keep-alive connections eventually.
func TestRetryRequestsOnError(t *testing.T) {}

func testRetryRequestsOnError(t *testing.T, mode testMode) {}

// Issue 6981
func TestTransportClosesBodyOnError(t *testing.T) {}

func testTransportClosesBodyOnError(t *testing.T, mode testMode) {}

func TestTransportDialTLS(t *testing.T) {}

func testTransportDialTLS(t *testing.T, mode testMode) {}

func TestTransportDialContext(t *testing.T) {}

func testTransportDialContext(t *testing.T, mode testMode) {}

func TestTransportDialTLSContext(t *testing.T) {}

func testTransportDialTLSContext(t *testing.T, mode testMode) {}

// Test for issue 8755
// Ensure that if a proxy returns an error, it is exposed by RoundTrip
func TestRoundTripReturnsProxyError(t *testing.T) {}

// tests that putting an idle conn after a call to CloseIdleConns does return it
func TestTransportCloseIdleConnsThenReturn(t *testing.T) {}

// Test for issue 34282
// Ensure that getConn doesn't call the GotConn trace hook on an HTTP/2 idle conn
func TestTransportTraceGotConnH2IdleConns(t *testing.T) {}

func TestTransportRemovesH2ConnsAfterIdle(t *testing.T) {}

func testTransportRemovesH2ConnsAfterIdle(t *testing.T, mode testMode) {}

// This tests that a client requesting a content range won't also
// implicitly ask for gzip support. If they want that, they need to do it
// on their own.
// golang.org/issue/8923
func TestTransportRangeAndGzip(t *testing.T) {}

func testTransportRangeAndGzip(t *testing.T, mode testMode) {}

// Test for issue 10474
func TestTransportResponseCancelRace(t *testing.T) {}

func testTransportResponseCancelRace(t *testing.T, mode testMode) {}

// Test for issue 19248: Content-Encoding's value is case insensitive.
func TestTransportContentEncodingCaseInsensitive(t *testing.T) {}

func testTransportContentEncodingCaseInsensitive(t *testing.T, mode testMode) {}

// https://go.dev/issue/49621
func TestConnClosedBeforeRequestIsWritten(t *testing.T) {}

func testConnClosedBeforeRequestIsWritten(t *testing.T, mode testMode) {}

type logWritesConn

func (c *logWritesConn) Write(p []byte) (n int, err error) {}

func (c *logWritesConn) Read(p []byte) (n int, err error) {}

func (c *logWritesConn) Close() error {}

// Issue 6574
func TestTransportFlushesBodyChunks(t *testing.T) {}

// Issue 22088: flush Transport request headers if we're not sure the body won't block on read.
func TestTransportFlushesRequestHeader(t *testing.T) {}

func testTransportFlushesRequestHeader(t *testing.T, mode testMode) {}

type wgReadCloser

func (c *wgReadCloser) Close() error {}

// Issue 11745.
func TestTransportPrefersResponseOverWriteError(t *testing.T) {}

func testTransportPrefersResponseOverWriteError(t *testing.T, mode testMode) {}

func TestTransportAutomaticHTTP2(t *testing.T) {}

func TestTransportAutomaticHTTP2_DialerAndTLSConfigSupportsHTTP2AndTLSConfig(t *testing.T) {}

// golang.org/issue/14391: also check DefaultTransport
func TestTransportAutomaticHTTP2_DefaultTransport(t *testing.T) {}

func TestTransportAutomaticHTTP2_TLSNextProto(t *testing.T) {}

func TestTransportAutomaticHTTP2_TLSConfig(t *testing.T) {}

func TestTransportAutomaticHTTP2_ExpectContinueTimeout(t *testing.T) {}

func TestTransportAutomaticHTTP2_Dial(t *testing.T) {}

func TestTransportAutomaticHTTP2_DialContext(t *testing.T) {}

func TestTransportAutomaticHTTP2_DialTLS(t *testing.T) {}

func testTransportAutoHTTP(t *testing.T, tr *Transport, wantH2 bool) {}

// Issue 13633: there was a race where we returned bodyless responses
// to callers before recycling the persistent connection, which meant
// a client doing two subsequent requests could end up on different
// connections. It's somewhat harmless but enough tests assume it's
// not true in order to test other things that it's worth fixing.
// Plus it's nice to be consistent and not have timing-dependent
// behavior.
func TestTransportReuseConnEmptyResponseBody(t *testing.T) {}

func testTransportReuseConnEmptyResponseBody(t *testing.T, mode testMode) {}

// Issue 13839
func TestNoCrashReturningTransportAltConn(t *testing.T) {}

func TestTransportReuseConnection_Gzip_Chunked(t *testing.T) {}

func TestTransportReuseConnection_Gzip_ContentLength(t *testing.T) {}

// Make sure we re-use underlying TCP connection for gzipped responses too.
func testTransportReuseConnection_Gzip(t *testing.T, mode testMode, chunked bool) {}

func TestTransportResponseHeaderLength(t *testing.T) {}

func testTransportResponseHeaderLength(t *testing.T, mode testMode) {}

func TestTransportEventTrace(t *testing.T) {}

// test a non-nil httptrace.ClientTrace but with all hooks set to zero.
func TestTransportEventTrace_NoHooks(t *testing.T) {}

func testTransportEventTrace(t *testing.T, mode testMode, noHooks bool) {}

func TestTransportEventTraceTLSVerify(t *testing.T) {}

func testTransportEventTraceTLSVerify(t *testing.T, mode testMode) {}

var isDNSHijacked

func skipIfDNSHijacked(t *testing.T) {}

func TestTransportEventTraceRealDNS(t *testing.T) {}

// Issue 14353: port can only contain digits.
func TestTransportRejectsAlphaPort(t *testing.T) {}

// Test the httptrace.TLSHandshake{Start,Done} hooks with an https http1
// connections. The http2 test is done in TestTransportEventTrace_h2
func TestTLSHandshakeTrace(t *testing.T) {}

func testTLSHandshakeTrace(t *testing.T, mode testMode) {}

func TestTransportMaxIdleConns(t *testing.T) {}

func testTransportMaxIdleConns(t *testing.T, mode testMode) {}

func TestTransportIdleConnTimeout(t *testing.T) {}

func testTransportIdleConnTimeout(t *testing.T, mode testMode) {}

// Issue 16208: Go 1.7 crashed after Transport.IdleConnTimeout if an
// HTTP/2 connection was established but its caller no longer
// wanted it. (Assuming the connection cache was enabled, which it is
// by default)
//
// This test reproduced the crash by setting the IdleConnTimeout low
// (to make the test reasonable) and then making a request which is
// canceled by the DialTLS hook, which then also waits to return the
// real connection until after the RoundTrip saw the error.  Then we
// know the successful tls.Dial from DialTLS will need to go into the
// idle pool. Then we give it a of time to explode.
func TestIdleConnH2Crash(t *testing.T) {}

func testIdleConnH2Crash(t *testing.T, mode testMode) {}

type funcConn

func (c funcConn) Read(p []byte) (int, error)  {}

func (c funcConn) Write(p []byte) (int, error) {}

func (c funcConn) Close() error                {}

// Issue 16465: Transport.RoundTrip should return the raw net.Conn.Read error from Peek
// back to the caller.
func TestTransportReturnsPeekError(t *testing.T) {}

// Issue 13835: international domain names should work
func TestTransportIDNA(t *testing.T) {}

func testTransportIDNA(t *testing.T, mode testMode) {}

// Issue 13290: send User-Agent in proxy CONNECT
func TestTransportProxyConnectHeader(t *testing.T) {}

func testTransportProxyConnectHeader(t *testing.T, mode testMode) {}

func TestTransportProxyGetConnectHeader(t *testing.T) {}

func testTransportProxyGetConnectHeader(t *testing.T, mode testMode) {}

var errFakeRoundTrip

type funcRoundTripper

func (fn funcRoundTripper) RoundTrip(*Request) (*Response, error) {}

func wantBody(res *Response, err error, want string) error {}

func newLocalListener(t *testing.T) net.Listener {}

type countCloseReader

func (cr countCloseReader) Close() error {}

var rgz

// Ensure that a missing status doesn't make the server panic
// See Issue https://golang.org/issues/21701
func TestMissingStatusNoPanic(t *testing.T) {}

func doFetchCheckPanic(tr *Transport, req *Request) (res *Response, err error, panicked bool) {}

// Issue 22330: do not allow the response body to be read when the status code
// forbids a response body.
func TestNoBodyOnChunked304Response(t *testing.T) {}

func testNoBodyOnChunked304Response(t *testing.T, mode testMode) {}

type funcWriter

func (f funcWriter) Write(p []byte) (int, error) {}

type doneContext

func (doneContext) Done() <-chan struct{}

func (d doneContext) Err() error {}

// Issue 25852: Transport should check whether Context is done early.
func TestTransportCheckContextDoneEarly(t *testing.T) {}

// Issue 23399: verify that if a client request times out, the Transport's
// conn is closed so that it's not reused.
//
// This is the test variant that times out before the server replies with
// any response headers.
func TestClientTimeoutKillsConn_BeforeHeaders(t *testing.T) {}

func testClientTimeoutKillsConn_BeforeHeaders(t *testing.T, mode testMode) {}

// Issue 23399: verify that if a client request times out, the Transport's
// conn is closed so that it's not reused.
//
// This is the test variant that has the server send response headers
// first, and time out during the write of the response body.
func TestClientTimeoutKillsConn_AfterHeaders(t *testing.T) {}

func testClientTimeoutKillsConn_AfterHeaders(t *testing.T, mode testMode) {}

func TestTransportResponseBodyWritableOnProtocolSwitch(t *testing.T) {}

func testTransportResponseBodyWritableOnProtocolSwitch(t *testing.T, mode testMode) {}

func TestTransportCONNECTBidi(t *testing.T) {}

func testTransportCONNECTBidi(t *testing.T, mode testMode) {}

func TestTransportRequestReplayable(t *testing.T) {}

type testMockTCPConn

func (c *testMockTCPConn) ReadFrom(r io.Reader) (int64, error) {}

func TestTransportRequestWriteRoundTrip(t *testing.T) {}

func testTransportRequestWriteRoundTrip(t *testing.T, mode testMode) {}

func TestTransportClone(t *testing.T) {}

func TestIs408(t *testing.T) {}

func TestTransportIgnores408(t *testing.T) {}

func testTransportIgnores408(t *testing.T, mode testMode) {}

func TestInvalidHeaderResponse(t *testing.T) {}

func testInvalidHeaderResponse(t *testing.T, mode testMode) {}

type bodyCloser

func (bc *bodyCloser) Close() error {}

func (bc *bodyCloser) Read(b []byte) (n int, err error) {}

// Issue 35015: ensure that Transport closes the body on any error
// with an invalid request, as promised by Client.Do docs.
func TestTransportClosesBodyOnInvalidRequests(t *testing.T) {}

func testTransportClosesBodyOnInvalidRequests(t *testing.T, mode testMode) {}

type breakableConn

type brokenState

func (w *breakableConn) Write(b []byte) (n int, err error) {}

// Issue 34978: don't cache a broken HTTP/2 connection
func TestDontCacheBrokenHTTP2Conn(t *testing.T) {}

func testDontCacheBrokenHTTP2Conn(t *testing.T, mode testMode) {}

// Issue 34941
// When the client has too many concurrent requests on a single connection,
// http.http2noCachedConnError is reported on multiple requests. There should
// only be one decrement regardless of the number of failures.
func TestTransportDecrementConnWhenIdleConnRemoved(t *testing.T) {}

func testTransportDecrementConnWhenIdleConnRemoved(t *testing.T, mode testMode) {}

// Issue 36820
// Test that we use the older backward compatible cancellation protocol
// when a RoundTripper is registered via RegisterProtocol.
func TestAltProtoCancellation(t *testing.T) {}

var errCancelProto

type cancelProto

func (cancelProto) RoundTrip(req *Request) (*Response, error) {}

type roundTripFunc

func (f roundTripFunc) RoundTrip(r *Request) (*Response, error) {}

// Issue 32441: body is not reset after ErrSkipAltProtocol
func TestIssue32441(t *testing.T) {}

func testIssue32441(t *testing.T, mode testMode) {}

// Issue 39017. Ensure that HTTP/1 transports reject Content-Length headers
// that contain a sign (eg. "+3"), per RFC 2616, Section 14.13.
func TestTransportRejectsSignInContentLength(t *testing.T) {}

func testTransportRejectsSignInContentLength(t *testing.T, mode testMode) {}

type dumpConn

func (c *dumpConn) Close() error                       {}

func (c *dumpConn) LocalAddr() net.Addr                {}

func (c *dumpConn) RemoteAddr() net.Addr               {}

func (c *dumpConn) SetDeadline(t time.Time) error      {}

func (c *dumpConn) SetReadDeadline(t time.Time) error  {}

func (c *dumpConn) SetWriteDeadline(t time.Time) error {}

type delegateReader

func (r *delegateReader) Read(p []byte) (int, error) {}

func testTransportRace(req *Request) {}

// Issue 37669
// Test that a cancellation doesn't result in a data race due to the writeLoop
// goroutine being left running, if the caller mutates the processed Request
// upon completion.
func TestErrorWriteLoopRace(t *testing.T) {}

// Issue 41600
// Test that a new request which uses the connection of an active request
// cannot cause it to be canceled as well.
func TestCancelRequestWhenSharingConnection(t *testing.T) {}

func testCancelRequestWhenSharingConnection(t *testing.T, mode testMode) {}

func TestHandlerAbortRacesBodyRead(t *testing.T) {}

func testHandlerAbortRacesBodyRead(t *testing.T, mode testMode) {}

func TestRequestSanitization(t *testing.T) {}

func testRequestSanitization(t *testing.T, mode testMode) {}

func TestProxyAuthHeader(t *testing.T) {}

func testProxyAuthHeader(t *testing.T, mode testMode) {}

// Issue 61708
func TestTransportReqCancelerCleanupOnRequestBodyWriteError(t *testing.T) {}

func TestValidateClientRequestTrailers(t *testing.T) {}

func testValidateClientRequestTrailers(t *testing.T, mode testMode) {}