kubernetes/vendor/golang.org/x/net/http2/server.go

const prefaceTimeout

const firstSettingsTimeout

const handlerChunkWriteSize

const defaultMaxStreams

const maxQueuedControlFrames

var errClientDisconnected

var errClosedBody

var errHandlerComplete

var errStreamClosed

var responseWriterStatePool

var testHookOnConn

var testHookGetServerConn

var testHookOnPanicMu

var testHookOnPanic

type Server

func (s *Server) markNewGoroutine() {}

func (s *Server) now() time.Time {}

// newTimer creates a new time.Timer, or a synthetic timer in tests.
func (s *Server) newTimer(d time.Duration) timer {}

// afterFunc creates a new time.AfterFunc timer, or a synthetic timer in tests.
func (s *Server) afterFunc(d time.Duration, f func()) timer {}

type serverInternalState

func (s *serverInternalState) registerConn(sc *serverConn) {}

func (s *serverInternalState) unregisterConn(sc *serverConn) {}

func (s *serverInternalState) startGracefulShutdown() {}

// ConfigureServer adds HTTP/2 support to a net/http Server.
//
// The configuration conf may be nil.
//
// ConfigureServer must be called before s begins serving.
func ConfigureServer(s *http.Server, conf *Server) error {}

type ServeConnOpts

func (o *ServeConnOpts) context() context.Context {}

func (o *ServeConnOpts) baseConfig() *http.Server {}

func (o *ServeConnOpts) handler() http.Handler {}

// ServeConn serves HTTP/2 requests on the provided connection and
// blocks until the connection is no longer readable.
//
// ServeConn starts speaking HTTP/2 assuming that c has not had any
// reads or writes. It writes its initial settings frame and expects
// to be able to read the preface and settings frame from the
// client. If c has a ConnectionState method like a *tls.Conn, the
// ConnectionState is used to verify the TLS ciphersuite and to set
// the Request.TLS field in Handlers.
//
// ServeConn does not support h2c by itself. Any h2c support must be
// implemented in terms of providing a suitably-behaving net.Conn.
//
// The opts parameter is optional. If nil, default values are used.
func (s *Server) ServeConn(c net.Conn, opts *ServeConnOpts) {}

func (s *Server) serveConn(c net.Conn, opts *ServeConnOpts, newf func(*serverConn)) {}

func serverConnBaseContext(c net.Conn, opts *ServeConnOpts) (ctx context.Context, cancel func()) {}

func (sc *serverConn) rejectConn(err ErrCode, debug string) {}

type serverConn

func (sc *serverConn) maxHeaderListSize() uint32 {}

func (sc *serverConn) curOpenStreams() uint32 {}

type stream

func (sc *serverConn) Framer() *Framer  {}

func (sc *serverConn) CloseConn() error {}

func (sc *serverConn) Flush() error     {}

func (sc *serverConn) HeaderEncoder() (*hpack.Encoder, *bytes.Buffer) {}

func (sc *serverConn) state(streamID uint32) (streamState, *stream) {}

// setConnState calls the net/http ConnState hook for this connection, if configured.
// Note that the net/http package does StateNew and StateClosed for us.
// There is currently no plan for StateHijacked or hijacking HTTP/2 connections.
func (sc *serverConn) setConnState(state http.ConnState) {}

func (sc *serverConn) vlogf(format string, args ...interface{}

func (sc *serverConn) logf(format string, args ...interface{}

// errno returns v's underlying uintptr, else 0.
//
// TODO: remove this helper function once http2 can use build
// tags. See comment in isClosedConnError.
func errno(v error) uintptr {}

// isClosedConnError reports whether err is an error from use of a closed
// network connection.
func isClosedConnError(err error) bool {}

func (sc *serverConn) condlogf(err error, format string, args ...interface{}

const maxCachedCanonicalHeadersKeysSize

func (sc *serverConn) canonicalHeader(v string) string {}

type readFrameResult

// readFrames is the loop that reads incoming frames.
// It takes care to only read one frame at a time, blocking until the
// consumer is done with the frame.
// It's run on its own goroutine.
func (sc *serverConn) readFrames() {}

type frameWriteResult

// writeFrameAsync runs in its own goroutine and writes a single frame
// and then reports when it's done.
// At most one goroutine can be running writeFrameAsync at a time per
// serverConn.
func (sc *serverConn) writeFrameAsync(wr FrameWriteRequest, wd *writeData) {}

func (sc *serverConn) closeAllStreamsOnConnClose() {}

func (sc *serverConn) stopShutdownTimer() {}

func (sc *serverConn) notePanic() {}

func (sc *serverConn) serve(conf http2Config) {}

func (sc *serverConn) handlePingTimer(lastFrameReadTime time.Time) {}

type serverMessage

var settingsTimerMsg

var idleTimerMsg

var readIdleTimerMsg

var shutdownTimerMsg

var gracefulShutdownMsg

var handlerDoneMsg

func (sc *serverConn) onSettingsTimer() {}

func (sc *serverConn) onIdleTimer()     {}

func (sc *serverConn) onReadIdleTimer() {}

func (sc *serverConn) onShutdownTimer() {}

func (sc *serverConn) sendServeMsg(msg interface{}

var errPrefaceTimeout

// readPreface reads the ClientPreface greeting from the peer or
// returns errPrefaceTimeout on timeout, or an error if the greeting
// is invalid.
func (sc *serverConn) readPreface() error {}

var errChanPool

var writeDataPool

// writeDataFromHandler writes DATA response frames from a handler on
// the given stream.
func (sc *serverConn) writeDataFromHandler(stream *stream, data []byte, endStream bool) error {}

// writeFrameFromHandler sends wr to sc.wantWriteFrameCh, but aborts
// if the connection has gone away.
//
// This must not be run from the serve goroutine itself, else it might
// deadlock writing to sc.wantWriteFrameCh (which is only mildly
// buffered and is read by serve itself). If you're on the serve
// goroutine, call writeFrame instead.
func (sc *serverConn) writeFrameFromHandler(wr FrameWriteRequest) error {}

// writeFrame schedules a frame to write and sends it if there's nothing
// already being written.
//
// There is no pushback here (the serve goroutine never blocks). It's
// the http.Handlers that block, waiting for their previous frames to
// make it onto the wire
//
// If you're not on the serve goroutine, use writeFrameFromHandler instead.
func (sc *serverConn) writeFrame(wr FrameWriteRequest) {}

// startFrameWrite starts a goroutine to write wr (in a separate
// goroutine since that might block on the network), and updates the
// serve goroutine's state about the world, updated from info in wr.
func (sc *serverConn) startFrameWrite(wr FrameWriteRequest) {}

var errHandlerPanicked

// wroteFrame is called on the serve goroutine with the result of
// whatever happened on writeFrameAsync.
func (sc *serverConn) wroteFrame(res frameWriteResult) {}

// scheduleFrameWrite tickles the frame writing scheduler.
//
// If a frame is already being written, nothing happens. This will be called again
// when the frame is done being written.
//
// If a frame isn't being written and we need to send one, the best frame
// to send is selected by writeSched.
//
// If a frame isn't being written and there's nothing else to send, we
// flush the write buffer.
func (sc *serverConn) scheduleFrameWrite() {}

// startGracefulShutdown gracefully shuts down a connection. This
// sends GOAWAY with ErrCodeNo to tell the client we're gracefully
// shutting down. The connection isn't closed until all current
// streams are done.
//
// startGracefulShutdown returns immediately; it does not wait until
// the connection has shut down.
func (sc *serverConn) startGracefulShutdown() {}

var goAwayTimeout

func (sc *serverConn) startGracefulShutdownInternal() {}

func (sc *serverConn) goAway(code ErrCode) {}

func (sc *serverConn) shutDownIn(d time.Duration) {}

func (sc *serverConn) resetStream(se StreamError) {}

// processFrameFromReader processes the serve loop's read from readFrameCh from the
// frame-reading goroutine.
// processFrameFromReader returns whether the connection should be kept open.
func (sc *serverConn) processFrameFromReader(res readFrameResult) bool {}

func (sc *serverConn) processFrame(f Frame) error {}

func (sc *serverConn) processPing(f *PingFrame) error {}

func (sc *serverConn) processWindowUpdate(f *WindowUpdateFrame) error {}

func (sc *serverConn) processResetStream(f *RSTStreamFrame) error {}

func (sc *serverConn) closeStream(st *stream, err error) {}

func (sc *serverConn) processSettings(f *SettingsFrame) error {}

func (sc *serverConn) processSetting(s Setting) error {}

func (sc *serverConn) processSettingInitialWindowSize(val uint32) error {}

func (sc *serverConn) processData(f *DataFrame) error {}

func (sc *serverConn) processGoAway(f *GoAwayFrame) error {}

// isPushed reports whether the stream is server-initiated.
func (st *stream) isPushed() bool {}

// endStream closes a Request.Body's pipe. It is called when a DATA
// frame says a request body is over (or after trailers).
func (st *stream) endStream() {}

// copyTrailersToHandlerRequest is run in the Handler's goroutine in
// its Request.Body.Read just before it gets io.EOF.
func (st *stream) copyTrailersToHandlerRequest() {}

// onReadTimeout is run on its own goroutine (from time.AfterFunc)
// when the stream's ReadTimeout has fired.
func (st *stream) onReadTimeout() {}

// onWriteTimeout is run on its own goroutine (from time.AfterFunc)
// when the stream's WriteTimeout has fired.
func (st *stream) onWriteTimeout() {}

func (sc *serverConn) processHeaders(f *MetaHeadersFrame) error {}

func (sc *serverConn) upgradeRequest(req *http.Request) {}

func (st *stream) processTrailerHeaders(f *MetaHeadersFrame) error {}

func (sc *serverConn) checkPriority(streamID uint32, p PriorityParam) error {}

func (sc *serverConn) processPriority(f *PriorityFrame) error {}

func (sc *serverConn) newStream(id, pusherID uint32, state streamState) *stream {}

func (sc *serverConn) newWriterAndRequest(st *stream, f *MetaHeadersFrame) (*responseWriter, *http.Request, error) {}

type requestParam

func (sc *serverConn) newWriterAndRequestNoBody(st *stream, rp requestParam) (*responseWriter, *http.Request, error) {}

func (sc *serverConn) newResponseWriter(st *stream, req *http.Request) *responseWriter {}

type unstartedHandler

// scheduleHandler starts a handler goroutine,
// or schedules one to start as soon as an existing handler finishes.
func (sc *serverConn) scheduleHandler(streamID uint32, rw *responseWriter, req *http.Request, handler func(http.ResponseWriter, *http.Request)) error {}

func (sc *serverConn) handlerDone() {}

// Run on its own goroutine.
func (sc *serverConn) runHandler(rw *responseWriter, req *http.Request, handler func(http.ResponseWriter, *http.Request)) {}

func handleHeaderListTooLong(w http.ResponseWriter, r *http.Request) {}

// called from handler goroutines.
// h may be nil.
func (sc *serverConn) writeHeaders(st *stream, headerData *writeResHeaders) error {}

// called from handler goroutines.
func (sc *serverConn) write100ContinueHeaders(st *stream) {}

type bodyReadMsg

// called from handler goroutines.
// Notes that the handler for the given stream ID read n bytes of its body
// and schedules flow control tokens to be sent.
func (sc *serverConn) noteBodyReadFromHandler(st *stream, n int, err error) {}

func (sc *serverConn) noteBodyRead(st *stream, n int) {}

// st may be nil for conn-level
func (sc *serverConn) sendWindowUpdate32(st *stream, n int32) {}

// st may be nil for conn-level
func (sc *serverConn) sendWindowUpdate(st *stream, n int) {}

type requestBody

func (b *requestBody) Close() error {}

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

type responseWriter

var _

var _

var _

type responseWriterState

type chunkWriter

func (cw chunkWriter) Write(p []byte) (n int, err error) {}

func (rws *responseWriterState) hasTrailers() bool {}

func (rws *responseWriterState) hasNonemptyTrailers() bool {}

// declareTrailer is called for each Trailer header when the
// response header is written. It notes that a header will need to be
// written in the trailers at the end of the response.
func (rws *responseWriterState) declareTrailer(k string) {}

// writeChunk writes chunks from the bufio.Writer. But because
// bufio.Writer may bypass its chunking, sometimes p may be
// arbitrarily large.
//
// writeChunk is also responsible (on the first chunk) for sending the
// HEADER response.
func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) {}

const TrailerPrefix

// promoteUndeclaredTrailers permits http.Handlers to set trailers
// after the header has already been flushed. Because the Go
// ResponseWriter interface has no way to set Trailers (only the
// Header), and because we didn't want to expand the ResponseWriter
// interface, and because nobody used trailers, and because RFC 7230
// says you SHOULD (but not must) predeclare any trailers in the
// header, the official ResponseWriter rules said trailers in Go must
// be predeclared, and then we reuse the same ResponseWriter.Header()
// map to mean both Headers and Trailers. When it's time to write the
// Trailers, we pick out the fields of Headers that were declared as
// trailers. That worked for a while, until we found the first major
// user of Trailers in the wild: gRPC (using them only over http2),
// and gRPC libraries permit setting trailers mid-stream without
// predeclaring them. So: change of plans. We still permit the old
// way, but we also permit this hack: if a Header() key begins with
// "Trailer:", the suffix of that key is a Trailer. Because ':' is an
// invalid token byte anyway, there is no ambiguity. (And it's already
// filtered out) It's mildly hacky, but not terrible.
//
// This method runs after the Handler is done and promotes any Header
// fields to be trailers.
func (rws *responseWriterState) promoteUndeclaredTrailers() {}

func (w *responseWriter) SetReadDeadline(deadline time.Time) error {}

func (w *responseWriter) SetWriteDeadline(deadline time.Time) error {}

func (w *responseWriter) Flush() {}

func (w *responseWriter) FlushError() error {}

func (w *responseWriter) CloseNotify() <-chan bool {}

func (w *responseWriter) Header() http.Header {}

// checkWriteHeaderCode is a copy of net/http's checkWriteHeaderCode.
func checkWriteHeaderCode(code int) {}

func (w *responseWriter) WriteHeader(code int) {}

func (rws *responseWriterState) writeHeader(code int) {}

func cloneHeader(h http.Header) http.Header {}

// The Life Of A Write is like this:
//
// * Handler calls w.Write or w.WriteString ->
// * -> rws.bw (*bufio.Writer) ->
// * (Handler might call Flush)
// * -> chunkWriter{rws}
// * -> responseWriterState.writeChunk(p []byte)
// * -> responseWriterState.writeChunk (most of the magic; see comment there)
func (w *responseWriter) Write(p []byte) (n int, err error) {}

func (w *responseWriter) WriteString(s string) (n int, err error) {}

// either dataB or dataS is non-zero.
func (w *responseWriter) write(lenData int, dataB []byte, dataS string) (n int, err error) {}

func (w *responseWriter) handlerDone() {}

var ErrRecursivePush

var ErrPushLimitReached

var _

func (w *responseWriter) Push(target string, opts *http.PushOptions) error {}

type startPushRequest

func (sc *serverConn) startPush(msg *startPushRequest) {}

// foreachHeaderElement splits v according to the "#rule" construction
// in RFC 7230 section 7 and calls fn for each non-empty element.
func foreachHeaderElement(v string, fn func(string)) {}

var connHeaders

// checkValidHTTP2RequestHeaders checks whether h is a valid HTTP/2 request,
// per RFC 7540 Section 8.1.2.2.
// The returned error is reported to users.
func checkValidHTTP2RequestHeaders(h http.Header) error {}

func new400Handler(err error) http.HandlerFunc {}

// h1ServerKeepAlivesDisabled reports whether hs has its keep-alives
// disabled. See comments on h1ServerShutdownChan above for why
// the code is written this way.
func h1ServerKeepAlivesDisabled(hs *http.Server) bool {}

func (sc *serverConn) countError(name string, err error) error {}