go/src/net/http/serve_test.go

type dummyAddr

type oneConnListener

func (l *oneConnListener) Accept() (c net.Conn, err error) {}

func (l *oneConnListener) Close() error {}

func (l *oneConnListener) Addr() net.Addr {}

func (a dummyAddr) Network() string {}

func (a dummyAddr) String() string {}

type noopConn

func (noopConn) LocalAddr() net.Addr                {}

func (noopConn) RemoteAddr() net.Addr               {}

func (noopConn) SetDeadline(t time.Time) error      {}

func (noopConn) SetReadDeadline(t time.Time) error  {}

func (noopConn) SetWriteDeadline(t time.Time) error {}

type rwTestConn

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

type testConn

func newTestConn() *testConn {}

func (c *testConn) Read(b []byte) (int, error) {}

func (c *testConn) Write(b []byte) (int, error) {}

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

// reqBytes treats req as a request (with \n delimiters) and returns it with \r\n delimiters,
// ending in \r\n\r\n
func reqBytes(req string) []byte {}

type handlerTest

func newHandlerTest(h Handler) handlerTest {}

func (ht *handlerTest) rawResponse(req string) string {}

func TestConsumingBodyOnNextConn(t *testing.T) {}

type stringHandler

func (s stringHandler) ServeHTTP(w ResponseWriter, r *Request) {}

var handlers

var vtests

func TestHostHandlers(t *testing.T) {}

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

var serveMuxRegister

// serve returns a handler that sends a response with the given code.
func serve(code int) HandlerFunc {}

// checkQueryStringHandler checks if r.URL.RawQuery has the same value
// as the URL excluding the scheme and the query string and sends 200
// response code if it is, 500 otherwise.
func checkQueryStringHandler(w ResponseWriter, r *Request) {}

var serveMuxTests

func TestServeMuxHandler(t *testing.T) {}

// Issue 24297
func TestServeMuxHandleFuncWithNilHandler(t *testing.T) {}

var serveMuxTests2

// TestServeMuxHandlerRedirects tests that automatic redirects generated by
// mux.Handler() shouldn't clear the request's query string.
func TestServeMuxHandlerRedirects(t *testing.T) {}

// Tests for https://golang.org/issue/900
func TestMuxRedirectLeadingSlashes(t *testing.T) {}

// Test that the special cased "/route" redirect
// implicitly created by a registered "/route/"
// properly sets the query string in the redirect URL.
// See Issue 17841.
func TestServeWithSlashRedirectKeepsQueryString(t *testing.T) {}

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

func TestServeWithSlashRedirectForHostPatterns(t *testing.T) {}

// Test that we don't attempt trailing-slash redirect on a path that already has
// a trailing slash.
// See issue #65624.
func TestMuxNoSlashRedirectWithTrailingSlash(t *testing.T) {}

// Test that we don't attempt trailing-slash response 405 on a path that already has
// a trailing slash.
// See issue #67657.
func TestMuxNoSlash405WithTrailingSlash(t *testing.T) {}

func TestShouldRedirectConcurrency(t *testing.T) {}

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

func BenchmarkServeMux(b *testing.B)           {}

func BenchmarkServeMux_SkipServe(b *testing.B) {}

func benchmarkServeMux(b *testing.B, runHandler bool) {}

func TestServerTimeouts(t *testing.T) {}

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

func testServerTimeoutsWithTimeout(t *testing.T, timeout time.Duration, mode testMode) error {}

func TestServerReadTimeout(t *testing.T) {}

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

func TestServerNoReadTimeout(t *testing.T) {}

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

func TestServerWriteTimeout(t *testing.T) {}

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

func TestServerNoWriteTimeout(t *testing.T) {}

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

// Test that the HTTP/2 server handles Server.WriteTimeout (Issue 18437)
func TestWriteDeadlineExtendedOnNewRequest(t *testing.T) {}

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

// tryTimeouts runs testFunc with increasing timeouts. Test passes on first success,
// and fails if all timeouts fail.
func tryTimeouts(t *testing.T, testFunc func(timeout time.Duration) error) {}

// Test that the HTTP/2 server RSTs stream on slow write.
func TestWriteDeadlineEnforcedPerStream(t *testing.T) {}

func testWriteDeadlineEnforcedPerStream(t *testing.T, mode testMode, timeout time.Duration) error {}

// Test that the HTTP/2 server does not send RST when WriteDeadline not set.
func TestNoWriteDeadline(t *testing.T) {}

func testNoWriteDeadline(t *testing.T, mode testMode, timeout time.Duration) error {}

// golang.org/issue/4741 -- setting only a write timeout that triggers
// shouldn't cause a handler to block forever on reads (next HTTP
// request) that will never happen.
func TestOnlyWriteTimeout(t *testing.T) {}

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

type trackLastConnListener

func (l trackLastConnListener) Accept() (c net.Conn, err error) {}

// TestIdentityResponse verifies that a handler can unset
func TestIdentityResponse(t *testing.T) {}

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

func testTCPConnectionCloses(t *testing.T, req string, h Handler) {}

func testTCPConnectionStaysOpen(t *testing.T, req string, handler Handler) {}

// TestServeHTTP10Close verifies that HTTP/1.0 requests won't be kept alive.
func TestServeHTTP10Close(t *testing.T) {}

// TestClientCanClose verifies that clients can also force a connection to close.
func TestClientCanClose(t *testing.T) {}

// TestHandlersCanSetConnectionClose verifies that handlers can force a connection to close,
// even for HTTP/1.1 requests.
func TestHandlersCanSetConnectionClose11(t *testing.T) {}

func TestHandlersCanSetConnectionClose10(t *testing.T) {}

func TestHTTP2UpgradeClosesConnection(t *testing.T) {}

func send204(w ResponseWriter, r *Request) {}

func send304(w ResponseWriter, r *Request) {}

// Issue 15647: 204 responses can't have bodies, so HTTP/1.0 keep-alive conns should stay open.
func TestHTTP10KeepAlive204Response(t *testing.T) {}

func TestHTTP11KeepAlive204Response(t *testing.T) {}

func TestHTTP10KeepAlive304Response(t *testing.T) {}

// Issue 15703
func TestKeepAliveFinalChunkWithEOF(t *testing.T) {}

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

func TestSetsRemoteAddr(t *testing.T) {}

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

type blockingRemoteAddrListener

func (l *blockingRemoteAddrListener) Accept() (net.Conn, error) {}

type blockingRemoteAddrConn

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

// Issue 12943
func TestServerAllowsBlockingRemoteAddr(t *testing.T) {}

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

// TestHeadResponses verifies that all MIME type sniffing and Content-Length
// counting of GET requests also happens on HEAD requests.
func TestHeadResponses(t *testing.T) {}

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

// Ensure ResponseWriter.ReadFrom doesn't write a body in response to a HEAD request.
// https://go.dev/issue/68609
func TestHeadReaderFrom(t *testing.T) {}

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

func TestTLSHandshakeTimeout(t *testing.T) {}

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

func TestTLSServer(t *testing.T) {}

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

func TestServeTLS(t *testing.T) {}

// Test that the HTTPS server nicely rejects plaintext HTTP/1.x requests.
func TestTLSServerRejectHTTPRequests(t *testing.T) {}

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

// Issue 15908
func TestAutomaticHTTP2_Serve_NoTLSConfig(t *testing.T) {}

func TestAutomaticHTTP2_Serve_NonH2TLSConfig(t *testing.T) {}

func TestAutomaticHTTP2_Serve_H2TLSConfig(t *testing.T) {}

func testAutomaticHTTP2_Serve(t *testing.T, tlsConf *tls.Config, wantH2 bool) {}

func TestAutomaticHTTP2_Serve_WithTLSConfig(t *testing.T) {}

func TestAutomaticHTTP2_ListenAndServe(t *testing.T) {}

func TestAutomaticHTTP2_ListenAndServe_GetCertificate(t *testing.T) {}

func TestAutomaticHTTP2_ListenAndServe_GetConfigForClient(t *testing.T) {}

func testAutomaticHTTP2_ListenAndServe(t *testing.T, tlsConf *tls.Config) {}

type serverExpectTest

func expectTest(contentLength int, expectation string, readBody bool, expectedResponse string) serverExpectTest {}

var serverExpectTests

// Tests that the server responds to the "Expect" request header
// correctly.
func TestServerExpect(t *testing.T) {}

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

// Under a ~256KB (maxPostHandlerReadBytes) threshold, the server
// should consume client request bodies that a handler didn't read.
func TestServerUnreadRequestBodyLittle(t *testing.T) {}

// Over a ~256KB (maxPostHandlerReadBytes) threshold, the server
// should ignore client request bodies that a handler didn't read
// and close the connection.
func TestServerUnreadRequestBodyLarge(t *testing.T) {}

type handlerBodyCloseTest

func (t handlerBodyCloseTest) connectionHeader() string {}

var handlerBodyCloseTests

func TestHandlerBodyClose(t *testing.T) {}

func testHandlerBodyClose(t *testing.T, i int, tt handlerBodyCloseTest) {}

type testHandlerBodyConsumer

var testHandlerBodyConsumers

func TestRequestBodyReadErrorClosesConnection(t *testing.T) {}

func TestInvalidTrailerClosesConnection(t *testing.T) {}

type slowTestConn

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

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

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

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

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

func (c *slowTestConn) Write(b []byte) (int, error) {}

func TestRequestBodyTimeoutClosesConnection(t *testing.T) {}

type cancelableTimeoutContext

func (c cancelableTimeoutContext) Err() error {}

func TestTimeoutHandler(t *testing.T) {}

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

// See issues 8209 and 8414.
func TestTimeoutHandlerRace(t *testing.T) {}

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

// See issues 8209 and 8414.
// Both issues involved panics in the implementation of TimeoutHandler.
func TestTimeoutHandlerRaceHeader(t *testing.T) {}

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

// Issue 9162
func TestTimeoutHandlerRaceHeaderTimeout(t *testing.T) {}

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

// Issue 14568.
func TestTimeoutHandlerStartTimerWhenServing(t *testing.T) {}

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

func TestTimeoutHandlerContextCanceled(t *testing.T) {}

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

// https://golang.org/issue/15948
func TestTimeoutHandlerEmptyResponse(t *testing.T) {}

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

// https://golang.org/issues/22084
func TestTimeoutHandlerPanicRecovery(t *testing.T) {}

func TestRedirectBadPath(t *testing.T) {}

// Test different URL formats and schemes
func TestRedirect(t *testing.T) {}

// Test that Redirect sets Content-Type header for GET and HEAD requests
// and writes a short HTML body, unless the request already has a Content-Type header.
func TestRedirectContentTypeAndBody(t *testing.T) {}

// TestZeroLengthPostAndResponse exercises an optimization done by the Transport:
// when there is no body (either because the method doesn't permit a body, or an
// explicit Content-Length of zero is present), then the transport can re-use the
// connection immediately. But when it re-uses the connection, it typically closes
// the previous request's body, which is not optimal for zero-lengthed bodies,
// as the client would then see http.ErrBodyReadAfterClose and not 0, io.EOF.
func TestZeroLengthPostAndResponse(t *testing.T) {}

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

func TestHandlerPanicNil(t *testing.T) {}

func TestHandlerPanic(t *testing.T) {}

func TestHandlerPanicWithHijack(t *testing.T) {}

func testHandlerPanic(t *testing.T, withHijack bool, mode testMode, wrapper func(Handler) Handler, panicValue any) {}

type terrorWriter

func (w terrorWriter) Write(p []byte) (int, error) {}

// Issue 16456: allow writing 0 bytes on hijacked conn to test hijack
// without any log spam.
func TestServerWriteHijackZeroBytes(t *testing.T) {}

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

func TestServerNoDate(t *testing.T) {}

func TestServerContentType(t *testing.T) {}

func testServerNoHeader(t *testing.T, mode testMode, header string) {}

func TestStripPrefix(t *testing.T) {}

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

// https://golang.org/issue/18952.
func TestStripPrefixNotModifyRequest(t *testing.T) {}

func TestRequestLimit(t *testing.T) {}

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

type neverEnding

func (b neverEnding) Read(p []byte) (n int, err error) {}

type bodyLimitReader

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

func (r *bodyLimitReader) Close() error {}

func TestRequestBodyLimit(t *testing.T) {}

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

// TestClientWriteShutdown tests that if the client shuts down the write
// side of their TCP connection, the server doesn't send a 400 Bad Request.
func TestClientWriteShutdown(t *testing.T) {}

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

// Tests that chunked server responses that write 1 byte at a time are
// buffered before chunk headers are added, not after chunk headers.
func TestServerBufferedChunking(t *testing.T) {}

// Tests that the server flushes its response headers out when it's
// ignoring the response body and waits a bit before forcefully
// closing the TCP connection, causing the client to get a RST.
// See https://golang.org/issue/3595
func TestServerGracefulClose(t *testing.T) {}

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

func TestCaseSensitiveMethod(t *testing.T) {}

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

// TestContentLengthZero tests that for both an HTTP/1.0 and HTTP/1.1
// request (both keep-alive), when a Handler never writes any
// response, the net/http package adds a "Content-Length: 0" response
// header.
func TestContentLengthZero(t *testing.T) {}

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

func TestCloseNotifier(t *testing.T) {}

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

// Tests that a pipelined request does not cause the first request's
// Handler's CloseNotify channel to fire.
//
// Issue 13165 (where it used to deadlock), but behavior changed in Issue 23921.
func TestCloseNotifierPipelined(t *testing.T) {}

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

func TestCloseNotifierChanLeak(t *testing.T) {}

// Tests that we can use CloseNotifier in one request, and later call Hijack
// on a second request on the same connection.
//
// It also tests that the connReader stitches together its background
// 1-byte read for CloseNotifier when CloseNotifier doesn't fire with
// the rest of the second HTTP later.
//
// Issue 9763.
// HTTP/1-only test. (http2 doesn't have Hijack)
func TestHijackAfterCloseNotifier(t *testing.T) {}

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

func TestHijackBeforeRequestBodyRead(t *testing.T) {}

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

func TestOptions(t *testing.T) {}

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

func TestOptionsHandler(t *testing.T) {}

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

// Tests regarding the ordering of Write, WriteHeader, Header, and
// Flush calls. In Go 1.0, rw.WriteHeader immediately flushed the
// (*response).header to the wire. In Go 1.1, the actual wire flush is
// delayed, so we could maybe tack on a Content-Length and better
// Content-Type after we see more (or all) of the output. To preserve
// compatibility with Go 1, we need to be careful to track which
// headers were live at the time of WriteHeader, so we write the same
// ones, even if the handler modifies them (~erroneously) after the
// first Write.
func TestHeaderToWire(t *testing.T) {}

type errorListener

func (l *errorListener) Accept() (c net.Conn, err error) {}

func (l *errorListener) Close() error {}

func (l *errorListener) Addr() net.Addr {}

func TestAcceptMaxFds(t *testing.T) {}

func TestWriteAfterHijack(t *testing.T) {}

func TestDoubleHijack(t *testing.T) {}

// https://golang.org/issue/5955
// Note that this does not test the "request too large"
// exit path from the http server. This is intentional;
// not sending Connection: close is just a minor wire
// optimization and is pointless if dealing with a
// badly behaved client.
func TestHTTP10ConnectionHeader(t *testing.T) {}

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

// See golang.org/issue/5660
func TestServerReaderFromOrder(t *testing.T) {}

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

// Issue 6157, Issue 6685
func TestCodesPreventingContentTypeAndBody(t *testing.T) {}

func TestContentTypeOkayOn204(t *testing.T) {}

// Issue 6995
// A server Handler can receive a Request, and then turn around and
// give a copy of that Request.Body out to the Transport (e.g. any
// proxy).  So then two people own that Request.Body (both the server
// and the http client), and both think they can close it on failure.
// Therefore, all incoming server requests Bodies need to be thread-safe.
func TestTransportAndServerSharedBodyRace(t *testing.T) {}

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

// Test that a hanging Request.Body.Read from another goroutine can't
// cause the Handler goroutine's Request.Body.Close to block.
// See issue 7121.
func TestRequestBodyCloseDoesntBlock(t *testing.T) {}

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

// test that ResponseWriter implements io.StringWriter.
func TestResponseWriterWriteString(t *testing.T) {}

func TestAppendTime(t *testing.T) {}

func TestServerConnState(t *testing.T) {}

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

func TestServerKeepAlivesEnabledResultClose(t *testing.T) {}

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

// golang.org/issue/7856
func TestServerEmptyBodyRace(t *testing.T) {}

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

func TestServerConnStateNew(t *testing.T) {}

type closeWriteTestConn

func (c *closeWriteTestConn) CloseWrite() error {}

func TestCloseWrite(t *testing.T) {}

// This verifies that a handler can Flush and then Hijack.
//
// A similar test crashed once during development, but it was only
// testing this tangentially and temporarily until another TODO was
// fixed.
//
// So add an explicit test for this.
func TestServerFlushAndHijack(t *testing.T) {}

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

// golang.org/issue/8534 -- the Server shouldn't reuse a connection
// for keep-alive after it's seen any Write error (e.g. a timeout) on
// that net.Conn.
//
// To test, verify we don't timeout or see fewer unique client
// addresses (== unique connections) than requests.
func TestServerKeepAliveAfterWriteError(t *testing.T) {}

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

// Issue 9987: shouldn't add automatic Content-Length (or
// Content-Type) if a Transfer-Encoding was set by the handler.
func TestNoContentLengthIfTransferEncoding(t *testing.T) {}

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

// tolerate extra CRLF(s) before Request-Line on subsequent requests on a conn
// Issue 10876.
func TestTolerateCRLFBeforeRequestLine(t *testing.T) {}

func TestIssue13893_Expect100(t *testing.T) {}

func TestIssue11549_Expect100(t *testing.T) {}

// If a Handler finishes and there's an unread request body,
// verify the server implicitly tries to do a read on it before replying.
func TestHandlerFinishSkipBigContentLengthRead(t *testing.T) {}

func TestHandlerSetsBodyNil(t *testing.T) {}

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

// Test that we validate the Host header.
// Issue 11206 (invalid bytes in Host) and 13624 (Host present in HTTP/1.1)
func TestServerValidatesHostHeader(t *testing.T) {}

func TestServerHandlersCanHandleH2PRI(t *testing.T) {}

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

// Test that we validate the valid bytes in HTTP/1 headers.
// Issue 11207.
func TestServerValidatesHeaders(t *testing.T) {}

func TestServerRequestContextCancel_ServeHTTPDone(t *testing.T) {}

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

// Tests that the Request.Context available to the Handler is canceled
// if the peer closes their TCP connection. This requires that the server
// is always blocked in a Read call so it notices the EOF from the client.
// See issues 15927 and 15224.
func TestServerRequestContextCancel_ConnClose(t *testing.T) {}

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

func TestServerContext_ServerContextKey(t *testing.T) {}

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

func TestServerContext_LocalAddrContextKey(t *testing.T) {}

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

// https://golang.org/issue/15960
func TestHandlerSetTransferEncodingChunked(t *testing.T) {}

// https://golang.org/issue/16063
func TestHandlerSetTransferEncodingGzip(t *testing.T) {}

func BenchmarkClientServer(b *testing.B) {}

func benchmarkClientServer(b *testing.B, mode testMode) {}

func BenchmarkClientServerParallel(b *testing.B) {}

func benchmarkClientServerParallel(b *testing.B, parallelism int, mode testMode) {}

// A benchmark for profiling the server without the HTTP client code.
// The client code runs in a subprocess.
//
// For use like:
//
//	$ go test -c
//	$ ./http.test -test.run='^$' -test.bench='^BenchmarkServer$' -test.benchtime=15s -test.cpuprofile=http.prof
//	$ go tool pprof http.test http.prof
//	(pprof) web
func BenchmarkServer(b *testing.B) {}

// getNoBody wraps Get but closes any Response.Body before returning the response.
func getNoBody(urlStr string) (*Response, error) {}

// A benchmark for profiling the client without the HTTP server code.
// The server code runs in a subprocess.
func BenchmarkClient(b *testing.B) {}

func BenchmarkServerFakeConnNoKeepAlive(b *testing.B) {}

type repeatReader

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

func BenchmarkServerFakeConnWithKeepAlive(b *testing.B) {}

// same as above, but representing the most simple possible request
// and handler. Notably: the handler does not call rw.Header().
func BenchmarkServerFakeConnWithKeepAliveLite(b *testing.B) {}

const someResponse

var response

// Both Content-Type and Content-Length set. Should be no buffering.
func BenchmarkServerHandlerTypeLen(b *testing.B) {}

// A Content-Type is set, but no length. No sniffing, but will count the Content-Length.
func BenchmarkServerHandlerNoLen(b *testing.B) {}

// A Content-Length is set, but the Content-Type will be sniffed.
func BenchmarkServerHandlerNoType(b *testing.B) {}

// Neither a Content-Type or Content-Length, so sniffed and counted.
func BenchmarkServerHandlerNoHeader(b *testing.B) {}

func benchmarkHandler(b *testing.B, h Handler) {}

func BenchmarkServerHijack(b *testing.B) {}

func BenchmarkCloseNotifier(b *testing.B) {}

func benchmarkCloseNotifier(b *testing.B, mode testMode) {}

// Verify this doesn't race (Issue 16505)
func TestConcurrentServerServe(t *testing.T) {}

func TestServerIdleTimeout(t *testing.T) {}

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

func get(t *testing.T, c *Client, url string) string {}

// Tests that calls to Server.SetKeepAlivesEnabled(false) closes any
// currently-open connections.
func TestServerSetKeepAlivesEnabledClosesConns(t *testing.T) {}

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

func TestServerShutdown(t *testing.T) {}

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

func TestServerShutdownStateNew(t *testing.T) {}

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

// Issue 17878: tests that we can call Close twice.
func TestServerCloseDeadlock(t *testing.T) {}

// Issue 17717: tests that Server.SetKeepAlivesEnabled is respected by
// both HTTP/1 and HTTP/2.
func TestServerKeepAlivesEnabled(t *testing.T) {}

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

// Issue 18447: test that the Server's ReadTimeout is stopped while
// the server's doing its 1-byte background read between requests,
// waiting for the connection to maybe close.
func TestServerCancelsReadTimeoutWhenIdle(t *testing.T) {}

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

// Issue 54784: test that the Server's ReadHeaderTimeout only starts once the
// beginning of a request has been received, rather than including time the
// connection spent idle.
func TestServerCancelsReadHeaderTimeoutWhenIdle(t *testing.T) {}

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

// runTimeSensitiveTest runs test with the provided durations until one passes.
// If they all fail, t.Fatal is called with the last one's duration and error value.
func runTimeSensitiveTest(t *testing.T, durations []time.Duration, test func(t *testing.T, d time.Duration) error) {}

// Issue 18535: test that the Server doesn't try to do a background
// read if it's already done one.
func TestServerDuplicateBackgroundRead(t *testing.T) {}

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

// Test that the bufio.Reader returned by Hijack includes any buffered
// byte (from the Server's backgroundRead) in its buffer. We want the
// Handler code to be able to tell that a byte is available via
// bufio.Reader.Buffered(), without resorting to Reading it
// (potentially blocking) to get at it.
func TestServerHijackGetsBackgroundByte(t *testing.T) {}

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

// Like TestServerHijackGetsBackgroundByte above but sending a
// immediate 1MB of data to the server to fill up the server's 4KB
// buffer.
func TestServerHijackGetsBackgroundByte_big(t *testing.T) {}

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

// Issue 18319: test that the Server validates the request method.
func TestServerValidatesMethod(t *testing.T) {}

type eofListenerNotComparable

func (eofListenerNotComparable) Accept() (net.Conn, error) {}

func (eofListenerNotComparable) Addr() net.Addr            {}

func (eofListenerNotComparable) Close() error              {}

// Issue 24812: don't crash on non-comparable Listener
func TestServerListenNotComparableListener(t *testing.T) {}

type countCloseListener

func (p *countCloseListener) Close() error {}

// Issue 24803: don't call Listener.Close on Server.Shutdown.
func TestServerCloseListenerOnce(t *testing.T) {}

// Issue 20239: don't block in Serve if Shutdown is called first.
func TestServerShutdownThenServe(t *testing.T) {}

// Issue 23351: document and test behavior of ServeMux with ports
func TestStripPortFromHost(t *testing.T) {}

func TestServerContexts(t *testing.T) {}

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

// Issue 35750: check ConnContext not modifying context for other connections
func TestConnContextNotModifyingAllContexts(t *testing.T) {}

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

// Issue 30710: ensure that as per the spec, a server responds
// with 501 Not Implemented for unsupported transfer-encodings.
func TestUnsupportedTransferEncodingsReturn501(t *testing.T) {}

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

// Issue 31753: don't sniff when Content-Encoding is set
func TestContentEncodingNoSniffing(t *testing.T) {}

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

// Issue 30803: ensure that TimeoutHandler logs spurious
// WriteHeader calls, for consistency with other Handlers.
func TestTimeoutHandlerSuperfluousLogs(t *testing.T) {}

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

// fetchWireResponse is a helper for dialing to host,
// sending http1ReqBody as the payload and retrieving
// the response as it was sent on the wire.
func fetchWireResponse(host string, http1ReqBody []byte) ([]byte, error) {}

func BenchmarkResponseStatusLine(b *testing.B) {}

func TestDisableKeepAliveUpgrade(t *testing.T) {}

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

type tlogWriter

func (w tlogWriter) Write(p []byte) (int, error) {}

func TestWriteHeaderSwitchingProtocols(t *testing.T) {}

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

func TestMuxRedirectRelative(t *testing.T) {}

// TestQuerySemicolon tests the behavior of semicolons in queries. See Issue 25192.
func TestQuerySemicolon(t *testing.T) {}

func testQuerySemicolon(t *testing.T, mode testMode, query string, wantX string, allowSemicolons, expectParseFormErr bool) {}

func TestMaxBytesHandler(t *testing.T) {}

func testMaxBytesHandler(t *testing.T, mode testMode, maxSize, requestSize int64) {}

func TestEarlyHints(t *testing.T) {}

func TestProcessing(t *testing.T) {}

func TestParseFormCleanup(t *testing.T) {}

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

func TestHeadBody(t *testing.T) {}

func TestGetBody(t *testing.T) {}

func testHeadBody(t *testing.T, mode testMode, chunked bool, method string) {}

// TestDisableContentLength verifies that the Content-Length is set by default
// or disabled when the header is set to nil.
func TestDisableContentLength(t *testing.T) {}

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

func TestErrorContentLength(t *testing.T) {}

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

func TestError(t *testing.T) {}

func TestServerReadAfterWriteHeader100Continue(t *testing.T) {}

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

func TestServerReadAfterHandlerDone100Continue(t *testing.T) {}

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

func TestServerReadAfterHandlerAbort100Continue(t *testing.T) {}

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