Constants & Variables
DefaultClient
var
#
var DefaultClient = *ast.UnaryExpr
DefaultMaxIdleConnsPerHost
const
#
const DefaultMaxIdleConnsPerHost = 2
DefaultServeMux
var
#
var DefaultServeMux = *ast.UnaryExpr
DefaultTransport
var
#
var DefaultTransport RoundTripper = *ast.UnaryExpr
ErrAbortHandler
var
#
var ErrAbortHandler = *ast.CallExpr
ErrBodyNotAllowed
var
#
var ErrBodyNotAllowed = *ast.CallExpr
ErrBodyReadAfterClose
var
#
var ErrBodyReadAfterClose = *ast.CallExpr
ErrContentLength
var
#
var ErrContentLength = *ast.CallExpr
ErrHandlerTimeout
var
#
var ErrHandlerTimeout = *ast.CallExpr
ErrHijacked
var
#
var ErrHijacked = *ast.CallExpr
ErrLineTooLong
var
#
var ErrLineTooLong = internal.ErrLineTooLong
ErrMissingBoundary
var
#
var ErrMissingBoundary = *ast.UnaryExpr
ErrMissingContentLength
var
#
var ErrMissingContentLength = *ast.UnaryExpr
ErrMissingFile
var
#
var ErrMissingFile = *ast.CallExpr
ErrNoCookie
var
#
var ErrNoCookie = *ast.CallExpr
ErrNoLocation
var
#
var ErrNoLocation = *ast.CallExpr
ErrNotMultipart
var
#
var ErrNotMultipart = *ast.UnaryExpr
ErrNotSupported
var
#
var ErrNotSupported = *ast.UnaryExpr
ErrSchemeMismatch
var
#
var ErrSchemeMismatch = *ast.CallExpr
ErrServerClosed
var
#
var ErrServerClosed = *ast.CallExpr
ErrShortBody
var
#
var ErrShortBody = *ast.UnaryExpr
ErrSkipAltProtocol
var
#
var ErrSkipAltProtocol = *ast.CallExpr
ErrUnexpectedTrailer
var
#
var ErrUnexpectedTrailer = *ast.UnaryExpr
ErrUseLastResponse
var
#
var ErrUseLastResponse = *ast.CallExpr
ErrWriteAfterFlush
var
#
var ErrWriteAfterFlush = *ast.CallExpr
LocalAddrContextKey
var
#
var LocalAddrContextKey = *ast.UnaryExpr
MethodConnect
const
#
const MethodConnect = "CONNECT"
MethodDelete
const
#
const MethodDelete = "DELETE"
MethodGet
const
#
const MethodGet = "GET"
MethodHead
const
#
const MethodHead = "HEAD"
MethodOptions
const
#
const MethodOptions = "OPTIONS"
MethodPatch
const
#
const MethodPatch = "PATCH"
MethodPost
const
#
const MethodPost = "POST"
MethodPut
const
#
const MethodPut = "PUT"
MethodTrace
const
#
const MethodTrace = "TRACE"
NoBody
var
#
var NoBody = noBody{...}
SameSiteDefaultMode
const
#
const SameSiteDefaultMode SameSite = *ast.BinaryExpr
SameSiteLaxMode
const
#
const SameSiteLaxMode
SameSiteNoneMode
const
#
const SameSiteNoneMode
SameSiteStrictMode
const
#
const SameSiteStrictMode
ServerContextKey
var
#
var ServerContextKey = *ast.UnaryExpr
StateActive
const
#
const StateActive
StateClosed
const
#
const StateClosed
StateHijacked
const
#
const StateHijacked
StateIdle
const
#
const StateIdle
StateNew
const
#
const StateNew ConnState = iota
StatusAccepted
const
#
const StatusAccepted = 202
StatusAlreadyReported
const
#
const StatusAlreadyReported = 208
StatusBadGateway
const
#
const StatusBadGateway = 502
StatusBadRequest
const
#
const StatusBadRequest = 400
StatusConflict
const
#
const StatusConflict = 409
StatusContinue
const
#
const StatusContinue = 100
StatusCreated
const
#
const StatusCreated = 201
StatusEarlyHints
const
#
const StatusEarlyHints = 103
StatusExpectationFailed
const
#
const StatusExpectationFailed = 417
StatusFailedDependency
const
#
const StatusFailedDependency = 424
StatusForbidden
const
#
const StatusForbidden = 403
StatusFound
const
#
const StatusFound = 302
StatusGatewayTimeout
const
#
const StatusGatewayTimeout = 504
StatusGone
const
#
const StatusGone = 410
StatusHTTPVersionNotSupported
const
#
const StatusHTTPVersionNotSupported = 505
StatusIMUsed
const
#
const StatusIMUsed = 226
StatusInsufficientStorage
const
#
const StatusInsufficientStorage = 507
StatusInternalServerError
const
#
const StatusInternalServerError = 500
StatusLengthRequired
const
#
const StatusLengthRequired = 411
StatusLocked
const
#
const StatusLocked = 423
StatusLoopDetected
const
#
const StatusLoopDetected = 508
StatusMethodNotAllowed
const
#
const StatusMethodNotAllowed = 405
StatusMisdirectedRequest
const
#
const StatusMisdirectedRequest = 421
StatusMovedPermanently
const
#
const StatusMovedPermanently = 301
StatusMultiStatus
const
#
const StatusMultiStatus = 207
StatusMultipleChoices
const
#
const StatusMultipleChoices = 300
StatusNetworkAuthenticationRequired
const
#
const StatusNetworkAuthenticationRequired = 511
StatusNoContent
const
#
const StatusNoContent = 204
StatusNonAuthoritativeInfo
const
#
const StatusNonAuthoritativeInfo = 203
StatusNotAcceptable
const
#
const StatusNotAcceptable = 406
StatusNotExtended
const
#
const StatusNotExtended = 510
StatusNotFound
const
#
const StatusNotFound = 404
StatusNotImplemented
const
#
const StatusNotImplemented = 501
StatusNotModified
const
#
const StatusNotModified = 304
StatusOK
const
#
const StatusOK = 200
StatusPartialContent
const
#
const StatusPartialContent = 206
StatusPaymentRequired
const
#
const StatusPaymentRequired = 402
StatusPermanentRedirect
const
#
const StatusPermanentRedirect = 308
StatusPreconditionFailed
const
#
const StatusPreconditionFailed = 412
StatusPreconditionRequired
const
#
const StatusPreconditionRequired = 428
StatusProcessing
const
#
const StatusProcessing = 102
StatusProxyAuthRequired
const
#
const StatusProxyAuthRequired = 407
StatusRequestEntityTooLarge
const
#
const StatusRequestEntityTooLarge = 413
StatusRequestTimeout
const
#
const StatusRequestTimeout = 408
StatusRequestURITooLong
const
#
const StatusRequestURITooLong = 414
StatusRequestedRangeNotSatisfiable
const
#
const StatusRequestedRangeNotSatisfiable = 416
StatusResetContent
const
#
const StatusResetContent = 205
StatusSeeOther
const
#
const StatusSeeOther = 303
StatusServiceUnavailable
const
#
const StatusServiceUnavailable = 503
StatusSwitchingProtocols
const
#
const StatusSwitchingProtocols = 101
StatusTeapot
const
#
const StatusTeapot = 418
StatusTemporaryRedirect
const
#
const StatusTemporaryRedirect = 307
StatusTooEarly
const
#
const StatusTooEarly = 425
StatusTooManyRequests
const
#
const StatusTooManyRequests = 429
StatusUnauthorized
const
#
const StatusUnauthorized = 401
StatusUnavailableForLegalReasons
const
#
const StatusUnavailableForLegalReasons = 451
StatusUnprocessableEntity
const
#
const StatusUnprocessableEntity = 422
StatusUnsupportedMediaType
const
#
const StatusUnsupportedMediaType = 415
StatusUpgradeRequired
const
#
const StatusUpgradeRequired = 426
StatusUseProxy
const
#
const StatusUseProxy = 305
StatusVariantAlsoNegotiates
const
#
const StatusVariantAlsoNegotiates = 506
TimeFormat
const
#
const TimeFormat = "Mon, 02 Jan 2006 15:04:05 GMT"
TrailerPrefix
const
#
const TrailerPrefix = "Trailer:"
_
var
#
var _ Pusher = *ast.CallExpr
_
var
#
var _ Pusher = *ast.CallExpr
_
var
#
var _ http2clientConnPoolIdleCloser = http2noDialClientConnPool{...}
_
var
#
var _ Flusher = *ast.CallExpr
_
var
#
var _ CloseNotifier = *ast.CallExpr
_
var
#
var _ io.ReaderFrom = *ast.CallExpr
_
var
#
var _ io.WriterTo = NoBody
_
var
#
var _ http2stringWriter = *ast.CallExpr
_
const
#
const _ = 306
_
var
#
var _ http2clientConnPoolIdleCloser = *ast.CallExpr
_
var
#
var _ closeWriter = *ast.CallExpr
_
var
#
var _ io.ReadCloser = NoBody
aLongTimeAgo
var
#
var aLongTimeAgo = *ast.CallExpr
bufferBeforeChunkingSize
const
#
const bufferBeforeChunkingSize = 2048
bufioReaderPool
var
#
var bufioReaderPool sync.Pool
bufioWriter2kPool
var
#
var bufioWriter2kPool sync.Pool
bufioWriter4kPool
var
#
var bufioWriter4kPool sync.Pool
colonSpace
var
#
var colonSpace = *ast.CallExpr
condFalse
const
#
const condFalse
condNone
const
#
const condNone condResult = iota
condTrue
const
#
const condTrue
cookieNameSanitizer
var
#
var cookieNameSanitizer = *ast.CallExpr
copyBufPool
var
#
var copyBufPool = sync.Pool{...}
copyBufPoolSize
const
#
const copyBufPoolSize = *ast.BinaryExpr
crlf
var
#
var crlf = *ast.CallExpr
debugServerConnections
const
#
const debugServerConnections = false
defaultMaxMemory
const
#
const defaultMaxMemory = *ast.BinaryExpr
defaultServeMux
var
#
var defaultServeMux ServeMux
defaultUserAgent
const
#
const defaultUserAgent = "Go-http-client/1.1"
disjoint
const
#
const disjoint relationship = "disjoint"
doubleCRLF
var
#
var doubleCRLF = *ast.CallExpr
envProxyFuncValue
var
#
var envProxyFuncValue func(*url.URL) (*url.URL, error)
envProxyOnce
var
#
var envProxyOnce sync.Once
equivalent
const
#
const equivalent relationship = "equivalent"
errBlankCookie
var
#
var errBlankCookie = *ast.CallExpr
errCallerOwnsConn
var
#
var errCallerOwnsConn = *ast.CallExpr
errCannotRewind
var
#
var errCannotRewind = *ast.CallExpr
errCloseIdle
var
#
var errCloseIdle = *ast.CallExpr
errCloseIdleConns
var
#
var errCloseIdleConns = *ast.CallExpr
errClosed
var
#
var errClosed = *ast.CallExpr
errConnBroken
var
#
var errConnBroken = *ast.CallExpr
errEqualNotFoundInCookie
var
#
var errEqualNotFoundInCookie = *ast.CallExpr
errIdleConnTimeout
var
#
var errIdleConnTimeout = *ast.CallExpr
errInvalidCookieName
var
#
var errInvalidCookieName = *ast.CallExpr
errInvalidCookieValue
var
#
var errInvalidCookieValue = *ast.CallExpr
errKeepAlivesDisabled
var
#
var errKeepAlivesDisabled = *ast.CallExpr
errMissingHost
var
#
var errMissingHost = *ast.CallExpr
errMissingReadDir
var
#
var errMissingReadDir = *ast.CallExpr
errMissingSeek
var
#
var errMissingSeek = *ast.CallExpr
errNoOverlap
var
#
var errNoOverlap = *ast.CallExpr
errReadLoopExiting
var
#
var errReadLoopExiting = *ast.CallExpr
errReadOnClosedResBody
var
#
var errReadOnClosedResBody = *ast.CallExpr
errRequestCanceled
var
#
var errRequestCanceled = http2errRequestCanceled
errRequestCanceledConn
var
#
var errRequestCanceledConn = *ast.CallExpr
errRequestDone
var
#
var errRequestDone = *ast.CallExpr
errSeeker
var
#
var errSeeker = *ast.CallExpr
errServerClosedIdle
var
#
var errServerClosedIdle = *ast.CallExpr
errTimeout
var
#
var errTimeout error = *ast.UnaryExpr
errTooLarge
var
#
var errTooLarge = *ast.CallExpr
errTooManyIdle
var
#
var errTooManyIdle = *ast.CallExpr
errTooManyIdleHost
var
#
var errTooManyIdleHost = *ast.CallExpr
errTrailerEOF
var
#
var errTrailerEOF = *ast.CallExpr
excludedHeadersNoBody
var
#
var excludedHeadersNoBody = map[string]bool{...}
htmlReplacer
var
#
var htmlReplacer = *ast.CallExpr
http2ClientPreface
const
#
const http2ClientPreface = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
http2DebugGoroutines
var
#
var http2DebugGoroutines = *ast.BinaryExpr
http2ErrCodeCancel
const
#
const http2ErrCodeCancel http2ErrCode = 0x8
http2ErrCodeCompression
const
#
const http2ErrCodeCompression http2ErrCode = 0x9
http2ErrCodeConnect
const
#
const http2ErrCodeConnect http2ErrCode = 0xa
http2ErrCodeEnhanceYourCalm
const
#
const http2ErrCodeEnhanceYourCalm http2ErrCode = 0xb
http2ErrCodeFlowControl
const
#
const http2ErrCodeFlowControl http2ErrCode = 0x3
http2ErrCodeFrameSize
const
#
const http2ErrCodeFrameSize http2ErrCode = 0x6
http2ErrCodeHTTP11Required
const
#
const http2ErrCodeHTTP11Required http2ErrCode = 0xd
http2ErrCodeInadequateSecurity
const
#
const http2ErrCodeInadequateSecurity http2ErrCode = 0xc
http2ErrCodeInternal
const
#
const http2ErrCodeInternal http2ErrCode = 0x2
http2ErrCodeNo
const
#
const http2ErrCodeNo http2ErrCode = 0x0
http2ErrCodeProtocol
const
#
const http2ErrCodeProtocol http2ErrCode = 0x1
http2ErrCodeRefusedStream
const
#
const http2ErrCodeRefusedStream http2ErrCode = 0x7
http2ErrCodeSettingsTimeout
const
#
const http2ErrCodeSettingsTimeout http2ErrCode = 0x4
http2ErrCodeStreamClosed
const
#
const http2ErrCodeStreamClosed http2ErrCode = 0x5
http2ErrFrameTooLarge
var
#
var http2ErrFrameTooLarge = *ast.CallExpr
http2ErrNoCachedConn
var
#
var http2ErrNoCachedConn error = http2noCachedConnError{...}
http2ErrNoCachedConn
var
#
var http2ErrNoCachedConn = http2noCachedConnError{...}
http2ErrPushLimitReached
var
#
var http2ErrPushLimitReached = *ast.CallExpr
http2ErrRecursivePush
var
#
var http2ErrRecursivePush = *ast.CallExpr
http2FlagDataEndStream
const
#
const http2FlagDataEndStream http2Flags = 0x1
http2FlagDataPadded
const
#
const http2FlagDataPadded http2Flags = 0x8
http2FlagPingAck
const
#
const http2FlagPingAck http2Flags = 0x1
http2FlagPushPromisePadded
const
#
const http2FlagPushPromisePadded http2Flags = 0x8
http2FlagSettingsAck
const
#
const http2FlagSettingsAck http2Flags = 0x1
http2FrameContinuation
const
#
const http2FrameContinuation http2FrameType = 0x9
http2FrameData
const
#
const http2FrameData http2FrameType = 0x0
http2FrameGoAway
const
#
const http2FrameGoAway http2FrameType = 0x7
http2FramePing
const
#
const http2FramePing http2FrameType = 0x6
http2FramePriority
const
#
const http2FramePriority http2FrameType = 0x2
http2FramePushPromise
const
#
const http2FramePushPromise http2FrameType = 0x5
http2FrameRSTStream
const
#
const http2FrameRSTStream http2FrameType = 0x3
http2FrameSettings
const
#
const http2FrameSettings http2FrameType = 0x4
http2FrameWindowUpdate
const
#
const http2FrameWindowUpdate http2FrameType = 0x8
http2NextProtoTLS
const
#
const http2NextProtoTLS = "h2"
http2NextProtoTLS
const
#
const http2NextProtoTLS = "h2"
http2SettingEnableConnectProtocol
const
#
const http2SettingEnableConnectProtocol http2SettingID = 0x8
http2SettingEnablePush
const
#
const http2SettingEnablePush http2SettingID = 0x2
http2SettingInitialWindowSize
const
#
const http2SettingInitialWindowSize http2SettingID = 0x4
http2SettingMaxConcurrentStreams
const
#
const http2SettingMaxConcurrentStreams http2SettingID = 0x3
http2SettingMaxFrameSize
const
#
const http2SettingMaxFrameSize http2SettingID = 0x5
http2TrailerPrefix
const
#
const http2TrailerPrefix = "Trailer:"
http2VerboseLogs
var
#
var http2VerboseLogs bool
http2bufPools
var
#
var http2bufPools [7]sync.Pool
http2bufWriterPool
var
#
var http2bufWriterPool = sync.Pool{...}
http2bufWriterPoolBufferSize
const
#
const http2bufWriterPoolBufferSize = *ast.BinaryExpr
http2cipher_TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA
const
#
const http2cipher_TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA uint16 = 0x0011
http2cipher_TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA
const
#
const http2cipher_TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA uint16 = 0x0013
http2cipher_TLS_DHE_DSS_WITH_AES_128_CBC_SHA
const
#
const http2cipher_TLS_DHE_DSS_WITH_AES_128_CBC_SHA uint16 = 0x0032
http2cipher_TLS_DHE_DSS_WITH_AES_128_CBC_SHA256
const
#
const http2cipher_TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 uint16 = 0x0040
http2cipher_TLS_DHE_DSS_WITH_AES_128_GCM_SHA256
const
#
const http2cipher_TLS_DHE_DSS_WITH_AES_128_GCM_SHA256 uint16 = 0x00A2
http2cipher_TLS_DHE_DSS_WITH_AES_256_CBC_SHA
const
#
const http2cipher_TLS_DHE_DSS_WITH_AES_256_CBC_SHA uint16 = 0x0038
http2cipher_TLS_DHE_DSS_WITH_AES_256_CBC_SHA256
const
#
const http2cipher_TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 uint16 = 0x006A
http2cipher_TLS_DHE_DSS_WITH_AES_256_GCM_SHA384
const
#
const http2cipher_TLS_DHE_DSS_WITH_AES_256_GCM_SHA384 uint16 = 0x00A3
http2cipher_TLS_DHE_DSS_WITH_ARIA_128_CBC_SHA256
const
#
const http2cipher_TLS_DHE_DSS_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC042
http2cipher_TLS_DHE_DSS_WITH_ARIA_128_GCM_SHA256
const
#
const http2cipher_TLS_DHE_DSS_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC056
http2cipher_TLS_DHE_DSS_WITH_ARIA_256_CBC_SHA384
const
#
const http2cipher_TLS_DHE_DSS_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC043
http2cipher_TLS_DHE_DSS_WITH_ARIA_256_GCM_SHA384
const
#
const http2cipher_TLS_DHE_DSS_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC057
http2cipher_TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA
const
#
const http2cipher_TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA uint16 = 0x0044
http2cipher_TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256
const
#
const http2cipher_TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0x00BD
http2cipher_TLS_DHE_DSS_WITH_CAMELLIA_128_GCM_SHA256
const
#
const http2cipher_TLS_DHE_DSS_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC080
http2cipher_TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA
const
#
const http2cipher_TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA uint16 = 0x0087
http2cipher_TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256
const
#
const http2cipher_TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 uint16 = 0x00C3
http2cipher_TLS_DHE_DSS_WITH_CAMELLIA_256_GCM_SHA384
const
#
const http2cipher_TLS_DHE_DSS_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC081
http2cipher_TLS_DHE_DSS_WITH_DES_CBC_SHA
const
#
const http2cipher_TLS_DHE_DSS_WITH_DES_CBC_SHA uint16 = 0x0012
http2cipher_TLS_DHE_DSS_WITH_SEED_CBC_SHA
const
#
const http2cipher_TLS_DHE_DSS_WITH_SEED_CBC_SHA uint16 = 0x0099
http2cipher_TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA
const
#
const http2cipher_TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA uint16 = 0x008F
http2cipher_TLS_DHE_PSK_WITH_AES_128_CBC_SHA
const
#
const http2cipher_TLS_DHE_PSK_WITH_AES_128_CBC_SHA uint16 = 0x0090
http2cipher_TLS_DHE_PSK_WITH_AES_128_CBC_SHA256
const
#
const http2cipher_TLS_DHE_PSK_WITH_AES_128_CBC_SHA256 uint16 = 0x00B2
http2cipher_TLS_DHE_PSK_WITH_AES_128_CCM
const
#
const http2cipher_TLS_DHE_PSK_WITH_AES_128_CCM uint16 = 0xC0A6
http2cipher_TLS_DHE_PSK_WITH_AES_128_GCM_SHA256
const
#
const http2cipher_TLS_DHE_PSK_WITH_AES_128_GCM_SHA256 uint16 = 0x00AA
http2cipher_TLS_DHE_PSK_WITH_AES_256_CBC_SHA
const
#
const http2cipher_TLS_DHE_PSK_WITH_AES_256_CBC_SHA uint16 = 0x0091
http2cipher_TLS_DHE_PSK_WITH_AES_256_CBC_SHA384
const
#
const http2cipher_TLS_DHE_PSK_WITH_AES_256_CBC_SHA384 uint16 = 0x00B3
http2cipher_TLS_DHE_PSK_WITH_AES_256_CCM
const
#
const http2cipher_TLS_DHE_PSK_WITH_AES_256_CCM uint16 = 0xC0A7
http2cipher_TLS_DHE_PSK_WITH_AES_256_GCM_SHA384
const
#
const http2cipher_TLS_DHE_PSK_WITH_AES_256_GCM_SHA384 uint16 = 0x00AB
http2cipher_TLS_DHE_PSK_WITH_ARIA_128_CBC_SHA256
const
#
const http2cipher_TLS_DHE_PSK_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC066
http2cipher_TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256
const
#
const http2cipher_TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC06C
http2cipher_TLS_DHE_PSK_WITH_ARIA_256_CBC_SHA384
const
#
const http2cipher_TLS_DHE_PSK_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC067
http2cipher_TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384
const
#
const http2cipher_TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC06D
http2cipher_TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256
const
#
const http2cipher_TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0xC096
http2cipher_TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256
const
#
const http2cipher_TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC090
http2cipher_TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384
const
#
const http2cipher_TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 uint16 = 0xC097
http2cipher_TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384
const
#
const http2cipher_TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC091
http2cipher_TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256
const
#
const http2cipher_TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256 uint16 = 0xCCAD
http2cipher_TLS_DHE_PSK_WITH_NULL_SHA
const
#
const http2cipher_TLS_DHE_PSK_WITH_NULL_SHA uint16 = 0x002D
http2cipher_TLS_DHE_PSK_WITH_NULL_SHA256
const
#
const http2cipher_TLS_DHE_PSK_WITH_NULL_SHA256 uint16 = 0x00B4
http2cipher_TLS_DHE_PSK_WITH_NULL_SHA384
const
#
const http2cipher_TLS_DHE_PSK_WITH_NULL_SHA384 uint16 = 0x00B5
http2cipher_TLS_DHE_PSK_WITH_RC4_128_SHA
const
#
const http2cipher_TLS_DHE_PSK_WITH_RC4_128_SHA uint16 = 0x008E
http2cipher_TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA
const
#
const http2cipher_TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA uint16 = 0x0014
http2cipher_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
const
#
const http2cipher_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0x0016
http2cipher_TLS_DHE_RSA_WITH_AES_128_CBC_SHA
const
#
const http2cipher_TLS_DHE_RSA_WITH_AES_128_CBC_SHA uint16 = 0x0033
http2cipher_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
const
#
const http2cipher_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 uint16 = 0x0067
http2cipher_TLS_DHE_RSA_WITH_AES_128_CCM
const
#
const http2cipher_TLS_DHE_RSA_WITH_AES_128_CCM uint16 = 0xC09E
http2cipher_TLS_DHE_RSA_WITH_AES_128_CCM_8
const
#
const http2cipher_TLS_DHE_RSA_WITH_AES_128_CCM_8 uint16 = 0xC0A2
http2cipher_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
const
#
const http2cipher_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0x009E
http2cipher_TLS_DHE_RSA_WITH_AES_256_CBC_SHA
const
#
const http2cipher_TLS_DHE_RSA_WITH_AES_256_CBC_SHA uint16 = 0x0039
http2cipher_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
const
#
const http2cipher_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 uint16 = 0x006B
http2cipher_TLS_DHE_RSA_WITH_AES_256_CCM
const
#
const http2cipher_TLS_DHE_RSA_WITH_AES_256_CCM uint16 = 0xC09F
http2cipher_TLS_DHE_RSA_WITH_AES_256_CCM_8
const
#
const http2cipher_TLS_DHE_RSA_WITH_AES_256_CCM_8 uint16 = 0xC0A3
http2cipher_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
const
#
const http2cipher_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 uint16 = 0x009F
http2cipher_TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256
const
#
const http2cipher_TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC044
http2cipher_TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256
const
#
const http2cipher_TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC052
http2cipher_TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384
const
#
const http2cipher_TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC045
http2cipher_TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384
const
#
const http2cipher_TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC053
http2cipher_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA
const
#
const http2cipher_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA uint16 = 0x0045
http2cipher_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256
const
#
const http2cipher_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0x00BE
http2cipher_TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256
const
#
const http2cipher_TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC07C
http2cipher_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA
const
#
const http2cipher_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA uint16 = 0x0088
http2cipher_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256
const
#
const http2cipher_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 uint16 = 0x00C4
http2cipher_TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384
const
#
const http2cipher_TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC07D
http2cipher_TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256
const
#
const http2cipher_TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256 uint16 = 0xCCAA
http2cipher_TLS_DHE_RSA_WITH_DES_CBC_SHA
const
#
const http2cipher_TLS_DHE_RSA_WITH_DES_CBC_SHA uint16 = 0x0015
http2cipher_TLS_DHE_RSA_WITH_SEED_CBC_SHA
const
#
const http2cipher_TLS_DHE_RSA_WITH_SEED_CBC_SHA uint16 = 0x009A
http2cipher_TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA
const
#
const http2cipher_TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA uint16 = 0x000B
http2cipher_TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA
const
#
const http2cipher_TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA uint16 = 0x000D
http2cipher_TLS_DH_DSS_WITH_AES_128_CBC_SHA
const
#
const http2cipher_TLS_DH_DSS_WITH_AES_128_CBC_SHA uint16 = 0x0030
http2cipher_TLS_DH_DSS_WITH_AES_128_CBC_SHA256
const
#
const http2cipher_TLS_DH_DSS_WITH_AES_128_CBC_SHA256 uint16 = 0x003E
http2cipher_TLS_DH_DSS_WITH_AES_128_GCM_SHA256
const
#
const http2cipher_TLS_DH_DSS_WITH_AES_128_GCM_SHA256 uint16 = 0x00A4
http2cipher_TLS_DH_DSS_WITH_AES_256_CBC_SHA
const
#
const http2cipher_TLS_DH_DSS_WITH_AES_256_CBC_SHA uint16 = 0x0036
http2cipher_TLS_DH_DSS_WITH_AES_256_CBC_SHA256
const
#
const http2cipher_TLS_DH_DSS_WITH_AES_256_CBC_SHA256 uint16 = 0x0068
http2cipher_TLS_DH_DSS_WITH_AES_256_GCM_SHA384
const
#
const http2cipher_TLS_DH_DSS_WITH_AES_256_GCM_SHA384 uint16 = 0x00A5
http2cipher_TLS_DH_DSS_WITH_ARIA_128_CBC_SHA256
const
#
const http2cipher_TLS_DH_DSS_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC03E
http2cipher_TLS_DH_DSS_WITH_ARIA_128_GCM_SHA256
const
#
const http2cipher_TLS_DH_DSS_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC058
http2cipher_TLS_DH_DSS_WITH_ARIA_256_CBC_SHA384
const
#
const http2cipher_TLS_DH_DSS_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC03F
http2cipher_TLS_DH_DSS_WITH_ARIA_256_GCM_SHA384
const
#
const http2cipher_TLS_DH_DSS_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC059
http2cipher_TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA
const
#
const http2cipher_TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA uint16 = 0x0042
http2cipher_TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256
const
#
const http2cipher_TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0x00BB
http2cipher_TLS_DH_DSS_WITH_CAMELLIA_128_GCM_SHA256
const
#
const http2cipher_TLS_DH_DSS_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC082
http2cipher_TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA
const
#
const http2cipher_TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA uint16 = 0x0085
http2cipher_TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256
const
#
const http2cipher_TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256 uint16 = 0x00C1
http2cipher_TLS_DH_DSS_WITH_CAMELLIA_256_GCM_SHA384
const
#
const http2cipher_TLS_DH_DSS_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC083
http2cipher_TLS_DH_DSS_WITH_DES_CBC_SHA
const
#
const http2cipher_TLS_DH_DSS_WITH_DES_CBC_SHA uint16 = 0x000C
http2cipher_TLS_DH_DSS_WITH_SEED_CBC_SHA
const
#
const http2cipher_TLS_DH_DSS_WITH_SEED_CBC_SHA uint16 = 0x0097
http2cipher_TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA
const
#
const http2cipher_TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA uint16 = 0x000E
http2cipher_TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA
const
#
const http2cipher_TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0x0010
http2cipher_TLS_DH_RSA_WITH_AES_128_CBC_SHA
const
#
const http2cipher_TLS_DH_RSA_WITH_AES_128_CBC_SHA uint16 = 0x0031
http2cipher_TLS_DH_RSA_WITH_AES_128_CBC_SHA256
const
#
const http2cipher_TLS_DH_RSA_WITH_AES_128_CBC_SHA256 uint16 = 0x003F
http2cipher_TLS_DH_RSA_WITH_AES_128_GCM_SHA256
const
#
const http2cipher_TLS_DH_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0x00A0
http2cipher_TLS_DH_RSA_WITH_AES_256_CBC_SHA
const
#
const http2cipher_TLS_DH_RSA_WITH_AES_256_CBC_SHA uint16 = 0x0037
http2cipher_TLS_DH_RSA_WITH_AES_256_CBC_SHA256
const
#
const http2cipher_TLS_DH_RSA_WITH_AES_256_CBC_SHA256 uint16 = 0x0069
http2cipher_TLS_DH_RSA_WITH_AES_256_GCM_SHA384
const
#
const http2cipher_TLS_DH_RSA_WITH_AES_256_GCM_SHA384 uint16 = 0x00A1
http2cipher_TLS_DH_RSA_WITH_ARIA_128_CBC_SHA256
const
#
const http2cipher_TLS_DH_RSA_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC040
http2cipher_TLS_DH_RSA_WITH_ARIA_128_GCM_SHA256
const
#
const http2cipher_TLS_DH_RSA_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC054
http2cipher_TLS_DH_RSA_WITH_ARIA_256_CBC_SHA384
const
#
const http2cipher_TLS_DH_RSA_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC041
http2cipher_TLS_DH_RSA_WITH_ARIA_256_GCM_SHA384
const
#
const http2cipher_TLS_DH_RSA_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC055
http2cipher_TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA
const
#
const http2cipher_TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA uint16 = 0x0043
http2cipher_TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256
const
#
const http2cipher_TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0x00BC
http2cipher_TLS_DH_RSA_WITH_CAMELLIA_128_GCM_SHA256
const
#
const http2cipher_TLS_DH_RSA_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC07E
http2cipher_TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA
const
#
const http2cipher_TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA uint16 = 0x0086
http2cipher_TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256
const
#
const http2cipher_TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256 uint16 = 0x00C2
http2cipher_TLS_DH_RSA_WITH_CAMELLIA_256_GCM_SHA384
const
#
const http2cipher_TLS_DH_RSA_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC07F
http2cipher_TLS_DH_RSA_WITH_DES_CBC_SHA
const
#
const http2cipher_TLS_DH_RSA_WITH_DES_CBC_SHA uint16 = 0x000F
http2cipher_TLS_DH_RSA_WITH_SEED_CBC_SHA
const
#
const http2cipher_TLS_DH_RSA_WITH_SEED_CBC_SHA uint16 = 0x0098
http2cipher_TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA
const
#
const http2cipher_TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA uint16 = 0x0019
http2cipher_TLS_DH_anon_EXPORT_WITH_RC4_40_MD5
const
#
const http2cipher_TLS_DH_anon_EXPORT_WITH_RC4_40_MD5 uint16 = 0x0017
http2cipher_TLS_DH_anon_WITH_3DES_EDE_CBC_SHA
const
#
const http2cipher_TLS_DH_anon_WITH_3DES_EDE_CBC_SHA uint16 = 0x001B
http2cipher_TLS_DH_anon_WITH_AES_128_CBC_SHA
const
#
const http2cipher_TLS_DH_anon_WITH_AES_128_CBC_SHA uint16 = 0x0034
http2cipher_TLS_DH_anon_WITH_AES_128_CBC_SHA256
const
#
const http2cipher_TLS_DH_anon_WITH_AES_128_CBC_SHA256 uint16 = 0x006C
http2cipher_TLS_DH_anon_WITH_AES_128_GCM_SHA256
const
#
const http2cipher_TLS_DH_anon_WITH_AES_128_GCM_SHA256 uint16 = 0x00A6
http2cipher_TLS_DH_anon_WITH_AES_256_CBC_SHA
const
#
const http2cipher_TLS_DH_anon_WITH_AES_256_CBC_SHA uint16 = 0x003A
http2cipher_TLS_DH_anon_WITH_AES_256_CBC_SHA256
const
#
const http2cipher_TLS_DH_anon_WITH_AES_256_CBC_SHA256 uint16 = 0x006D
http2cipher_TLS_DH_anon_WITH_AES_256_GCM_SHA384
const
#
const http2cipher_TLS_DH_anon_WITH_AES_256_GCM_SHA384 uint16 = 0x00A7
http2cipher_TLS_DH_anon_WITH_ARIA_128_CBC_SHA256
const
#
const http2cipher_TLS_DH_anon_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC046
http2cipher_TLS_DH_anon_WITH_ARIA_128_GCM_SHA256
const
#
const http2cipher_TLS_DH_anon_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC05A
http2cipher_TLS_DH_anon_WITH_ARIA_256_CBC_SHA384
const
#
const http2cipher_TLS_DH_anon_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC047
http2cipher_TLS_DH_anon_WITH_ARIA_256_GCM_SHA384
const
#
const http2cipher_TLS_DH_anon_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC05B
http2cipher_TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA
const
#
const http2cipher_TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA uint16 = 0x0046
http2cipher_TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA256
const
#
const http2cipher_TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0x00BF
http2cipher_TLS_DH_anon_WITH_CAMELLIA_128_GCM_SHA256
const
#
const http2cipher_TLS_DH_anon_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC084
http2cipher_TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA
const
#
const http2cipher_TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA uint16 = 0x0089
http2cipher_TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256
const
#
const http2cipher_TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256 uint16 = 0x00C5
http2cipher_TLS_DH_anon_WITH_CAMELLIA_256_GCM_SHA384
const
#
const http2cipher_TLS_DH_anon_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC085
http2cipher_TLS_DH_anon_WITH_DES_CBC_SHA
const
#
const http2cipher_TLS_DH_anon_WITH_DES_CBC_SHA uint16 = 0x001A
http2cipher_TLS_DH_anon_WITH_RC4_128_MD5
const
#
const http2cipher_TLS_DH_anon_WITH_RC4_128_MD5 uint16 = 0x0018
http2cipher_TLS_DH_anon_WITH_SEED_CBC_SHA
const
#
const http2cipher_TLS_DH_anon_WITH_SEED_CBC_SHA uint16 = 0x009B
http2cipher_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA
const
#
const http2cipher_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA uint16 = 0xC008
http2cipher_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
const
#
const http2cipher_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA uint16 = 0xC009
http2cipher_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
const
#
const http2cipher_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 uint16 = 0xC023
http2cipher_TLS_ECDHE_ECDSA_WITH_AES_128_CCM
const
#
const http2cipher_TLS_ECDHE_ECDSA_WITH_AES_128_CCM uint16 = 0xC0AC
http2cipher_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8
const
#
const http2cipher_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 uint16 = 0xC0AE
http2cipher_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
const
#
const http2cipher_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 uint16 = 0xC02B
http2cipher_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
const
#
const http2cipher_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA uint16 = 0xC00A
http2cipher_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
const
#
const http2cipher_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 uint16 = 0xC024
http2cipher_TLS_ECDHE_ECDSA_WITH_AES_256_CCM
const
#
const http2cipher_TLS_ECDHE_ECDSA_WITH_AES_256_CCM uint16 = 0xC0AD
http2cipher_TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8
const
#
const http2cipher_TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8 uint16 = 0xC0AF
http2cipher_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
const
#
const http2cipher_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 uint16 = 0xC02C
http2cipher_TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256
const
#
const http2cipher_TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC048
http2cipher_TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256
const
#
const http2cipher_TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC05C
http2cipher_TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384
const
#
const http2cipher_TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC049
http2cipher_TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384
const
#
const http2cipher_TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC05D
http2cipher_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256
const
#
const http2cipher_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0xC072
http2cipher_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
const
#
const http2cipher_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC086
http2cipher_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384
const
#
const http2cipher_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 uint16 = 0xC073
http2cipher_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384
const
#
const http2cipher_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC087
http2cipher_TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
const
#
const http2cipher_TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 uint16 = 0xCCA9
http2cipher_TLS_ECDHE_ECDSA_WITH_NULL_SHA
const
#
const http2cipher_TLS_ECDHE_ECDSA_WITH_NULL_SHA uint16 = 0xC006
http2cipher_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA
const
#
const http2cipher_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA uint16 = 0xC007
http2cipher_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA
const
#
const http2cipher_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA uint16 = 0xC034
http2cipher_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA
const
#
const http2cipher_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA uint16 = 0xC035
http2cipher_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256
const
#
const http2cipher_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 uint16 = 0xC037
http2cipher_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA
const
#
const http2cipher_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA uint16 = 0xC036
http2cipher_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384
const
#
const http2cipher_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384 uint16 = 0xC038
http2cipher_TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256
const
#
const http2cipher_TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC070
http2cipher_TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384
const
#
const http2cipher_TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC071
http2cipher_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256
const
#
const http2cipher_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0xC09A
http2cipher_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384
const
#
const http2cipher_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 uint16 = 0xC09B
http2cipher_TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256
const
#
const http2cipher_TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256 uint16 = 0xCCAC
http2cipher_TLS_ECDHE_PSK_WITH_NULL_SHA
const
#
const http2cipher_TLS_ECDHE_PSK_WITH_NULL_SHA uint16 = 0xC039
http2cipher_TLS_ECDHE_PSK_WITH_NULL_SHA256
const
#
const http2cipher_TLS_ECDHE_PSK_WITH_NULL_SHA256 uint16 = 0xC03A
http2cipher_TLS_ECDHE_PSK_WITH_NULL_SHA384
const
#
const http2cipher_TLS_ECDHE_PSK_WITH_NULL_SHA384 uint16 = 0xC03B
http2cipher_TLS_ECDHE_PSK_WITH_RC4_128_SHA
const
#
const http2cipher_TLS_ECDHE_PSK_WITH_RC4_128_SHA uint16 = 0xC033
http2cipher_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
const
#
const http2cipher_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0xC012
http2cipher_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
const
#
const http2cipher_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA uint16 = 0xC013
http2cipher_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
const
#
const http2cipher_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 uint16 = 0xC027
http2cipher_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
const
#
const http2cipher_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0xC02F
http2cipher_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
const
#
const http2cipher_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA uint16 = 0xC014
http2cipher_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
const
#
const http2cipher_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 uint16 = 0xC028
http2cipher_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
const
#
const http2cipher_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 uint16 = 0xC030
http2cipher_TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256
const
#
const http2cipher_TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC04C
http2cipher_TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256
const
#
const http2cipher_TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC060
http2cipher_TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384
const
#
const http2cipher_TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC04D
http2cipher_TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384
const
#
const http2cipher_TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC061
http2cipher_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256
const
#
const http2cipher_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0xC076
http2cipher_TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256
const
#
const http2cipher_TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC08A
http2cipher_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384
const
#
const http2cipher_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 uint16 = 0xC077
http2cipher_TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384
const
#
const http2cipher_TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC08B
http2cipher_TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
const
#
const http2cipher_TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 uint16 = 0xCCA8
http2cipher_TLS_ECDHE_RSA_WITH_NULL_SHA
const
#
const http2cipher_TLS_ECDHE_RSA_WITH_NULL_SHA uint16 = 0xC010
http2cipher_TLS_ECDHE_RSA_WITH_RC4_128_SHA
const
#
const http2cipher_TLS_ECDHE_RSA_WITH_RC4_128_SHA uint16 = 0xC011
http2cipher_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA
const
#
const http2cipher_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA uint16 = 0xC003
http2cipher_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
const
#
const http2cipher_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA uint16 = 0xC004
http2cipher_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256
const
#
const http2cipher_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 uint16 = 0xC025
http2cipher_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
const
#
const http2cipher_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 uint16 = 0xC02D
http2cipher_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
const
#
const http2cipher_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA uint16 = 0xC005
http2cipher_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384
const
#
const http2cipher_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 uint16 = 0xC026
http2cipher_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384
const
#
const http2cipher_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 uint16 = 0xC02E
http2cipher_TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256
const
#
const http2cipher_TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC04A
http2cipher_TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256
const
#
const http2cipher_TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC05E
http2cipher_TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384
const
#
const http2cipher_TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC04B
http2cipher_TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384
const
#
const http2cipher_TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC05F
http2cipher_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256
const
#
const http2cipher_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0xC074
http2cipher_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
const
#
const http2cipher_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC088
http2cipher_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384
const
#
const http2cipher_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 uint16 = 0xC075
http2cipher_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384
const
#
const http2cipher_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC089
http2cipher_TLS_ECDH_ECDSA_WITH_NULL_SHA
const
#
const http2cipher_TLS_ECDH_ECDSA_WITH_NULL_SHA uint16 = 0xC001
http2cipher_TLS_ECDH_ECDSA_WITH_RC4_128_SHA
const
#
const http2cipher_TLS_ECDH_ECDSA_WITH_RC4_128_SHA uint16 = 0xC002
http2cipher_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA
const
#
const http2cipher_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0xC00D
http2cipher_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA
const
#
const http2cipher_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA uint16 = 0xC00E
http2cipher_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256
const
#
const http2cipher_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 uint16 = 0xC029
http2cipher_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256
const
#
const http2cipher_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0xC031
http2cipher_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
const
#
const http2cipher_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA uint16 = 0xC00F
http2cipher_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384
const
#
const http2cipher_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 uint16 = 0xC02A
http2cipher_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384
const
#
const http2cipher_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 uint16 = 0xC032
http2cipher_TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256
const
#
const http2cipher_TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC04E
http2cipher_TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256
const
#
const http2cipher_TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC062
http2cipher_TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384
const
#
const http2cipher_TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC04F
http2cipher_TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384
const
#
const http2cipher_TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC063
http2cipher_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256
const
#
const http2cipher_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0xC078
http2cipher_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256
const
#
const http2cipher_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC08C
http2cipher_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384
const
#
const http2cipher_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 uint16 = 0xC079
http2cipher_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384
const
#
const http2cipher_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC08D
http2cipher_TLS_ECDH_RSA_WITH_NULL_SHA
const
#
const http2cipher_TLS_ECDH_RSA_WITH_NULL_SHA uint16 = 0xC00B
http2cipher_TLS_ECDH_RSA_WITH_RC4_128_SHA
const
#
const http2cipher_TLS_ECDH_RSA_WITH_RC4_128_SHA uint16 = 0xC00C
http2cipher_TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA
const
#
const http2cipher_TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA uint16 = 0xC017
http2cipher_TLS_ECDH_anon_WITH_AES_128_CBC_SHA
const
#
const http2cipher_TLS_ECDH_anon_WITH_AES_128_CBC_SHA uint16 = 0xC018
http2cipher_TLS_ECDH_anon_WITH_AES_256_CBC_SHA
const
#
const http2cipher_TLS_ECDH_anon_WITH_AES_256_CBC_SHA uint16 = 0xC019
http2cipher_TLS_ECDH_anon_WITH_NULL_SHA
const
#
const http2cipher_TLS_ECDH_anon_WITH_NULL_SHA uint16 = 0xC015
http2cipher_TLS_ECDH_anon_WITH_RC4_128_SHA
const
#
const http2cipher_TLS_ECDH_anon_WITH_RC4_128_SHA uint16 = 0xC016
http2cipher_TLS_EMPTY_RENEGOTIATION_INFO_SCSV
const
#
const http2cipher_TLS_EMPTY_RENEGOTIATION_INFO_SCSV uint16 = 0x00FF
http2cipher_TLS_FALLBACK_SCSV
const
#
const http2cipher_TLS_FALLBACK_SCSV uint16 = 0x5600
http2cipher_TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5
const
#
const http2cipher_TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5 uint16 = 0x0029
http2cipher_TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA
const
#
const http2cipher_TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA uint16 = 0x0026
http2cipher_TLS_KRB5_EXPORT_WITH_RC2_CBC_40_MD5
const
#
const http2cipher_TLS_KRB5_EXPORT_WITH_RC2_CBC_40_MD5 uint16 = 0x002A
http2cipher_TLS_KRB5_EXPORT_WITH_RC2_CBC_40_SHA
const
#
const http2cipher_TLS_KRB5_EXPORT_WITH_RC2_CBC_40_SHA uint16 = 0x0027
http2cipher_TLS_KRB5_EXPORT_WITH_RC4_40_MD5
const
#
const http2cipher_TLS_KRB5_EXPORT_WITH_RC4_40_MD5 uint16 = 0x002B
http2cipher_TLS_KRB5_EXPORT_WITH_RC4_40_SHA
const
#
const http2cipher_TLS_KRB5_EXPORT_WITH_RC4_40_SHA uint16 = 0x0028
http2cipher_TLS_KRB5_WITH_3DES_EDE_CBC_MD5
const
#
const http2cipher_TLS_KRB5_WITH_3DES_EDE_CBC_MD5 uint16 = 0x0023
http2cipher_TLS_KRB5_WITH_3DES_EDE_CBC_SHA
const
#
const http2cipher_TLS_KRB5_WITH_3DES_EDE_CBC_SHA uint16 = 0x001F
http2cipher_TLS_KRB5_WITH_DES_CBC_MD5
const
#
const http2cipher_TLS_KRB5_WITH_DES_CBC_MD5 uint16 = 0x0022
http2cipher_TLS_KRB5_WITH_DES_CBC_SHA
const
#
const http2cipher_TLS_KRB5_WITH_DES_CBC_SHA uint16 = 0x001E
http2cipher_TLS_KRB5_WITH_IDEA_CBC_MD5
const
#
const http2cipher_TLS_KRB5_WITH_IDEA_CBC_MD5 uint16 = 0x0025
http2cipher_TLS_KRB5_WITH_IDEA_CBC_SHA
const
#
const http2cipher_TLS_KRB5_WITH_IDEA_CBC_SHA uint16 = 0x0021
http2cipher_TLS_KRB5_WITH_RC4_128_MD5
const
#
const http2cipher_TLS_KRB5_WITH_RC4_128_MD5 uint16 = 0x0024
http2cipher_TLS_KRB5_WITH_RC4_128_SHA
const
#
const http2cipher_TLS_KRB5_WITH_RC4_128_SHA uint16 = 0x0020
http2cipher_TLS_NULL_WITH_NULL_NULL
const
#
const http2cipher_TLS_NULL_WITH_NULL_NULL uint16 = 0x0000
http2cipher_TLS_PSK_DHE_WITH_AES_128_CCM_8
const
#
const http2cipher_TLS_PSK_DHE_WITH_AES_128_CCM_8 uint16 = 0xC0AA
http2cipher_TLS_PSK_DHE_WITH_AES_256_CCM_8
const
#
const http2cipher_TLS_PSK_DHE_WITH_AES_256_CCM_8 uint16 = 0xC0AB
http2cipher_TLS_PSK_WITH_3DES_EDE_CBC_SHA
const
#
const http2cipher_TLS_PSK_WITH_3DES_EDE_CBC_SHA uint16 = 0x008B
http2cipher_TLS_PSK_WITH_AES_128_CBC_SHA
const
#
const http2cipher_TLS_PSK_WITH_AES_128_CBC_SHA uint16 = 0x008C
http2cipher_TLS_PSK_WITH_AES_128_CBC_SHA256
const
#
const http2cipher_TLS_PSK_WITH_AES_128_CBC_SHA256 uint16 = 0x00AE
http2cipher_TLS_PSK_WITH_AES_128_CCM
const
#
const http2cipher_TLS_PSK_WITH_AES_128_CCM uint16 = 0xC0A4
http2cipher_TLS_PSK_WITH_AES_128_CCM_8
const
#
const http2cipher_TLS_PSK_WITH_AES_128_CCM_8 uint16 = 0xC0A8
http2cipher_TLS_PSK_WITH_AES_128_GCM_SHA256
const
#
const http2cipher_TLS_PSK_WITH_AES_128_GCM_SHA256 uint16 = 0x00A8
http2cipher_TLS_PSK_WITH_AES_256_CBC_SHA
const
#
const http2cipher_TLS_PSK_WITH_AES_256_CBC_SHA uint16 = 0x008D
http2cipher_TLS_PSK_WITH_AES_256_CBC_SHA384
const
#
const http2cipher_TLS_PSK_WITH_AES_256_CBC_SHA384 uint16 = 0x00AF
http2cipher_TLS_PSK_WITH_AES_256_CCM
const
#
const http2cipher_TLS_PSK_WITH_AES_256_CCM uint16 = 0xC0A5
http2cipher_TLS_PSK_WITH_AES_256_CCM_8
const
#
const http2cipher_TLS_PSK_WITH_AES_256_CCM_8 uint16 = 0xC0A9
http2cipher_TLS_PSK_WITH_AES_256_GCM_SHA384
const
#
const http2cipher_TLS_PSK_WITH_AES_256_GCM_SHA384 uint16 = 0x00A9
http2cipher_TLS_PSK_WITH_ARIA_128_CBC_SHA256
const
#
const http2cipher_TLS_PSK_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC064
http2cipher_TLS_PSK_WITH_ARIA_128_GCM_SHA256
const
#
const http2cipher_TLS_PSK_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC06A
http2cipher_TLS_PSK_WITH_ARIA_256_CBC_SHA384
const
#
const http2cipher_TLS_PSK_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC065
http2cipher_TLS_PSK_WITH_ARIA_256_GCM_SHA384
const
#
const http2cipher_TLS_PSK_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC06B
http2cipher_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256
const
#
const http2cipher_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0xC094
http2cipher_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256
const
#
const http2cipher_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC08E
http2cipher_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384
const
#
const http2cipher_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384 uint16 = 0xC095
http2cipher_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384
const
#
const http2cipher_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC08F
http2cipher_TLS_PSK_WITH_CHACHA20_POLY1305_SHA256
const
#
const http2cipher_TLS_PSK_WITH_CHACHA20_POLY1305_SHA256 uint16 = 0xCCAB
http2cipher_TLS_PSK_WITH_NULL_SHA
const
#
const http2cipher_TLS_PSK_WITH_NULL_SHA uint16 = 0x002C
http2cipher_TLS_PSK_WITH_NULL_SHA256
const
#
const http2cipher_TLS_PSK_WITH_NULL_SHA256 uint16 = 0x00B0
http2cipher_TLS_PSK_WITH_NULL_SHA384
const
#
const http2cipher_TLS_PSK_WITH_NULL_SHA384 uint16 = 0x00B1
http2cipher_TLS_PSK_WITH_RC4_128_SHA
const
#
const http2cipher_TLS_PSK_WITH_RC4_128_SHA uint16 = 0x008A
http2cipher_TLS_RSA_EXPORT_WITH_DES40_CBC_SHA
const
#
const http2cipher_TLS_RSA_EXPORT_WITH_DES40_CBC_SHA uint16 = 0x0008
http2cipher_TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5
const
#
const http2cipher_TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5 uint16 = 0x0006
http2cipher_TLS_RSA_EXPORT_WITH_RC4_40_MD5
const
#
const http2cipher_TLS_RSA_EXPORT_WITH_RC4_40_MD5 uint16 = 0x0003
http2cipher_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA
const
#
const http2cipher_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA uint16 = 0x0093
http2cipher_TLS_RSA_PSK_WITH_AES_128_CBC_SHA
const
#
const http2cipher_TLS_RSA_PSK_WITH_AES_128_CBC_SHA uint16 = 0x0094
http2cipher_TLS_RSA_PSK_WITH_AES_128_CBC_SHA256
const
#
const http2cipher_TLS_RSA_PSK_WITH_AES_128_CBC_SHA256 uint16 = 0x00B6
http2cipher_TLS_RSA_PSK_WITH_AES_128_GCM_SHA256
const
#
const http2cipher_TLS_RSA_PSK_WITH_AES_128_GCM_SHA256 uint16 = 0x00AC
http2cipher_TLS_RSA_PSK_WITH_AES_256_CBC_SHA
const
#
const http2cipher_TLS_RSA_PSK_WITH_AES_256_CBC_SHA uint16 = 0x0095
http2cipher_TLS_RSA_PSK_WITH_AES_256_CBC_SHA384
const
#
const http2cipher_TLS_RSA_PSK_WITH_AES_256_CBC_SHA384 uint16 = 0x00B7
http2cipher_TLS_RSA_PSK_WITH_AES_256_GCM_SHA384
const
#
const http2cipher_TLS_RSA_PSK_WITH_AES_256_GCM_SHA384 uint16 = 0x00AD
http2cipher_TLS_RSA_PSK_WITH_ARIA_128_CBC_SHA256
const
#
const http2cipher_TLS_RSA_PSK_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC068
http2cipher_TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256
const
#
const http2cipher_TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC06E
http2cipher_TLS_RSA_PSK_WITH_ARIA_256_CBC_SHA384
const
#
const http2cipher_TLS_RSA_PSK_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC069
http2cipher_TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384
const
#
const http2cipher_TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC06F
http2cipher_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256
const
#
const http2cipher_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0xC098
http2cipher_TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256
const
#
const http2cipher_TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC092
http2cipher_TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384
const
#
const http2cipher_TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 uint16 = 0xC099
http2cipher_TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384
const
#
const http2cipher_TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC093
http2cipher_TLS_RSA_PSK_WITH_CHACHA20_POLY1305_SHA256
const
#
const http2cipher_TLS_RSA_PSK_WITH_CHACHA20_POLY1305_SHA256 uint16 = 0xCCAE
http2cipher_TLS_RSA_PSK_WITH_NULL_SHA
const
#
const http2cipher_TLS_RSA_PSK_WITH_NULL_SHA uint16 = 0x002E
http2cipher_TLS_RSA_PSK_WITH_NULL_SHA256
const
#
const http2cipher_TLS_RSA_PSK_WITH_NULL_SHA256 uint16 = 0x00B8
http2cipher_TLS_RSA_PSK_WITH_NULL_SHA384
const
#
const http2cipher_TLS_RSA_PSK_WITH_NULL_SHA384 uint16 = 0x00B9
http2cipher_TLS_RSA_PSK_WITH_RC4_128_SHA
const
#
const http2cipher_TLS_RSA_PSK_WITH_RC4_128_SHA uint16 = 0x0092
http2cipher_TLS_RSA_WITH_3DES_EDE_CBC_SHA
const
#
const http2cipher_TLS_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0x000A
http2cipher_TLS_RSA_WITH_AES_128_CBC_SHA
const
#
const http2cipher_TLS_RSA_WITH_AES_128_CBC_SHA uint16 = 0x002F
http2cipher_TLS_RSA_WITH_AES_128_CBC_SHA256
const
#
const http2cipher_TLS_RSA_WITH_AES_128_CBC_SHA256 uint16 = 0x003C
http2cipher_TLS_RSA_WITH_AES_128_CCM
const
#
const http2cipher_TLS_RSA_WITH_AES_128_CCM uint16 = 0xC09C
http2cipher_TLS_RSA_WITH_AES_128_CCM_8
const
#
const http2cipher_TLS_RSA_WITH_AES_128_CCM_8 uint16 = 0xC0A0
http2cipher_TLS_RSA_WITH_AES_128_GCM_SHA256
const
#
const http2cipher_TLS_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0x009C
http2cipher_TLS_RSA_WITH_AES_256_CBC_SHA
const
#
const http2cipher_TLS_RSA_WITH_AES_256_CBC_SHA uint16 = 0x0035
http2cipher_TLS_RSA_WITH_AES_256_CBC_SHA256
const
#
const http2cipher_TLS_RSA_WITH_AES_256_CBC_SHA256 uint16 = 0x003D
http2cipher_TLS_RSA_WITH_AES_256_CCM
const
#
const http2cipher_TLS_RSA_WITH_AES_256_CCM uint16 = 0xC09D
http2cipher_TLS_RSA_WITH_AES_256_CCM_8
const
#
const http2cipher_TLS_RSA_WITH_AES_256_CCM_8 uint16 = 0xC0A1
http2cipher_TLS_RSA_WITH_AES_256_GCM_SHA384
const
#
const http2cipher_TLS_RSA_WITH_AES_256_GCM_SHA384 uint16 = 0x009D
http2cipher_TLS_RSA_WITH_ARIA_128_CBC_SHA256
const
#
const http2cipher_TLS_RSA_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC03C
http2cipher_TLS_RSA_WITH_ARIA_128_GCM_SHA256
const
#
const http2cipher_TLS_RSA_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC050
http2cipher_TLS_RSA_WITH_ARIA_256_CBC_SHA384
const
#
const http2cipher_TLS_RSA_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC03D
http2cipher_TLS_RSA_WITH_ARIA_256_GCM_SHA384
const
#
const http2cipher_TLS_RSA_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC051
http2cipher_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA
const
#
const http2cipher_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA uint16 = 0x0041
http2cipher_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256
const
#
const http2cipher_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0x00BA
http2cipher_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256
const
#
const http2cipher_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC07A
http2cipher_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA
const
#
const http2cipher_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA uint16 = 0x0084
http2cipher_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256
const
#
const http2cipher_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256 uint16 = 0x00C0
http2cipher_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384
const
#
const http2cipher_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC07B
http2cipher_TLS_RSA_WITH_DES_CBC_SHA
const
#
const http2cipher_TLS_RSA_WITH_DES_CBC_SHA uint16 = 0x0009
http2cipher_TLS_RSA_WITH_IDEA_CBC_SHA
const
#
const http2cipher_TLS_RSA_WITH_IDEA_CBC_SHA uint16 = 0x0007
http2cipher_TLS_RSA_WITH_NULL_MD5
const
#
const http2cipher_TLS_RSA_WITH_NULL_MD5 uint16 = 0x0001
http2cipher_TLS_RSA_WITH_NULL_SHA
const
#
const http2cipher_TLS_RSA_WITH_NULL_SHA uint16 = 0x0002
http2cipher_TLS_RSA_WITH_NULL_SHA256
const
#
const http2cipher_TLS_RSA_WITH_NULL_SHA256 uint16 = 0x003B
http2cipher_TLS_RSA_WITH_RC4_128_MD5
const
#
const http2cipher_TLS_RSA_WITH_RC4_128_MD5 uint16 = 0x0004
http2cipher_TLS_RSA_WITH_RC4_128_SHA
const
#
const http2cipher_TLS_RSA_WITH_RC4_128_SHA uint16 = 0x0005
http2cipher_TLS_RSA_WITH_SEED_CBC_SHA
const
#
const http2cipher_TLS_RSA_WITH_SEED_CBC_SHA uint16 = 0x0096
http2cipher_TLS_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA
const
#
const http2cipher_TLS_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA uint16 = 0xC01C
http2cipher_TLS_SRP_SHA_DSS_WITH_AES_128_CBC_SHA
const
#
const http2cipher_TLS_SRP_SHA_DSS_WITH_AES_128_CBC_SHA uint16 = 0xC01F
http2cipher_TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA
const
#
const http2cipher_TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA uint16 = 0xC022
http2cipher_TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA
const
#
const http2cipher_TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0xC01B
http2cipher_TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA
const
#
const http2cipher_TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA uint16 = 0xC01E
http2cipher_TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA
const
#
const http2cipher_TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA uint16 = 0xC021
http2cipher_TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA
const
#
const http2cipher_TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA uint16 = 0xC01A
http2cipher_TLS_SRP_SHA_WITH_AES_128_CBC_SHA
const
#
const http2cipher_TLS_SRP_SHA_WITH_AES_128_CBC_SHA uint16 = 0xC01D
http2cipher_TLS_SRP_SHA_WITH_AES_256_CBC_SHA
const
#
const http2cipher_TLS_SRP_SHA_WITH_AES_256_CBC_SHA uint16 = 0xC020
http2client
var
#
var http2client = *ast.CallExpr
http2clientPreface
var
#
var http2clientPreface = *ast.CallExpr
http2commonBuildOnce
var
#
var http2commonBuildOnce sync.Once
http2dataChunkPools
var
#
var http2dataChunkPools = [...]sync.Pool{...}
http2defaultMaxConcurrentStreams
const
#
const http2defaultMaxConcurrentStreams = 1000
http2defaultMaxReadFrameSize
const
#
const http2defaultMaxReadFrameSize = *ast.BinaryExpr
http2defaultMaxStreams
const
#
const http2defaultMaxStreams = 250
http2defaultUserAgent
const
#
const http2defaultUserAgent = "Go-http-client/2.0"
http2dialOnMiss
const
#
const http2dialOnMiss = true
http2disableExtendedConnectProtocol
var
#
var http2disableExtendedConnectProtocol = true
http2errChanPool
var
#
var http2errChanPool = sync.Pool{...}
http2errClientConnClosed
var
#
var http2errClientConnClosed = *ast.CallExpr
http2errClientConnGotGoAway
var
#
var http2errClientConnGotGoAway = *ast.CallExpr
http2errClientConnNotEstablished
var
#
var http2errClientConnNotEstablished = *ast.CallExpr
http2errClientConnUnusable
var
#
var http2errClientConnUnusable = *ast.CallExpr
http2errClientDisconnected
var
#
var http2errClientDisconnected = *ast.CallExpr
http2errClosedBody
var
#
var http2errClosedBody = *ast.CallExpr
http2errClosedPipeWrite
var
#
var http2errClosedPipeWrite = *ast.CallExpr
http2errClosedResponseBody
var
#
var http2errClosedResponseBody = *ast.CallExpr
http2errCodeName
var
#
var http2errCodeName = map[http2ErrCode]string{...}
http2errDepStreamID
var
#
var http2errDepStreamID = *ast.CallExpr
http2errExtendedConnectNotSupported
var
#
var http2errExtendedConnectNotSupported = *ast.CallExpr
http2errFromPeer
var
#
var http2errFromPeer = *ast.CallExpr
http2errHandlerComplete
var
#
var http2errHandlerComplete = *ast.CallExpr
http2errHandlerPanicked
var
#
var http2errHandlerPanicked = *ast.CallExpr
http2errNilRequestURL
var
#
var http2errNilRequestURL = *ast.CallExpr
http2errPadBytes
var
#
var http2errPadBytes = *ast.CallExpr
http2errPadLength
var
#
var http2errPadLength = *ast.CallExpr
http2errPrefaceTimeout
var
#
var http2errPrefaceTimeout = *ast.CallExpr
http2errPseudoAfterRegular
var
#
var http2errPseudoAfterRegular = *ast.CallExpr
http2errReadEmpty
var
#
var http2errReadEmpty = *ast.CallExpr
http2errReqBodyTooLong
var
#
var http2errReqBodyTooLong = *ast.CallExpr
http2errRequestCanceled
var
#
var http2errRequestCanceled = *ast.CallExpr
http2errRequestCanceled
var
#
var http2errRequestCanceled = *ast.CallExpr
http2errStopReqBodyWrite
var
#
var http2errStopReqBodyWrite = *ast.CallExpr
http2errStopReqBodyWriteAndCancel
var
#
var http2errStopReqBodyWriteAndCancel = *ast.CallExpr
http2errStreamClosed
var
#
var http2errStreamClosed = *ast.CallExpr
http2errStreamID
var
#
var http2errStreamID = *ast.CallExpr
http2errTimeout
var
#
var http2errTimeout error = *ast.UnaryExpr
http2errUninitializedPipeWrite
var
#
var http2errUninitializedPipeWrite = *ast.CallExpr
http2fhBytes
var
#
var http2fhBytes = sync.Pool{...}
http2firstSettingsTimeout
const
#
const http2firstSettingsTimeout = *ast.BinaryExpr
http2flagName
var
#
var http2flagName = map[http2FrameType]map[http2Flags]string{...}
http2frameName
var
#
var http2frameName = map[http2FrameType]string{...}
http2frameParsers
var
#
var http2frameParsers = map[http2FrameType]http2frameParser{...}
http2goAwayTimeout
var
#
var http2goAwayTimeout = *ast.BinaryExpr
http2goAwayTimeout
var
#
var http2goAwayTimeout = *ast.BinaryExpr
http2goroutineSpace
var
#
var http2goroutineSpace = *ast.CallExpr
http2got1xxFuncForTests
var
#
var http2got1xxFuncForTests func(int, textproto.MIMEHeader) error
http2gracefulShutdownMsg
var
#
var http2gracefulShutdownMsg = *ast.CallExpr
http2handlerChunkWriteSize
const
#
const http2handlerChunkWriteSize = *ast.BinaryExpr
http2handlerDoneMsg
var
#
var http2handlerDoneMsg = *ast.CallExpr
http2idleTimerMsg
var
#
var http2idleTimerMsg = *ast.CallExpr
http2inTests
var
#
var http2inTests bool
http2inflowMinRefresh
const
#
const http2inflowMinRefresh = *ast.BinaryExpr
http2initialMaxConcurrentStreams
const
#
const http2initialMaxConcurrentStreams = 100
http2initialMaxFrameSize
const
#
const http2initialMaxFrameSize = 16384
http2initialWindowSize
const
#
const http2initialWindowSize = 65535
http2littleBuf
var
#
var http2littleBuf = sync.Pool{...}
http2logFrameReads
var
#
var http2logFrameReads bool
http2logFrameWrites
var
#
var http2logFrameWrites bool
http2maxFrameSize
const
#
const http2maxFrameSize = *ast.BinaryExpr
http2maxQueuedControlFrames
const
#
const http2maxQueuedControlFrames = 10000
http2minMaxFrameSize
const
#
const http2minMaxFrameSize = *ast.BinaryExpr
http2nextProtoUnencryptedHTTP2
const
#
const http2nextProtoUnencryptedHTTP2 = "unencrypted_http2"
http2noBody
var
#
var http2noBody io.ReadCloser = http2noBodyReader{...}
http2noDialOnMiss
const
#
const http2noDialOnMiss = false
http2padZeros
var
#
var http2padZeros = *ast.CallExpr
http2prefaceTimeout
const
#
const http2prefaceTimeout = *ast.BinaryExpr
http2priorityDefaultWeight
const
#
const http2priorityDefaultWeight = 15
http2priorityNodeClosed
const
#
const http2priorityNodeClosed
http2priorityNodeIdle
const
#
const http2priorityNodeIdle
http2priorityNodeOpen
const
#
const http2priorityNodeOpen http2priorityNodeState = iota
http2readIdleTimerMsg
var
#
var http2readIdleTimerMsg = *ast.CallExpr
http2responseWriterStatePool
var
#
var http2responseWriterStatePool = sync.Pool{...}
http2server
var
#
var http2server = *ast.CallExpr
http2settingName
var
#
var http2settingName = map[http2SettingID]string{...}
http2settingsTimerMsg
var
#
var http2settingsTimerMsg = *ast.CallExpr
http2shutdownEnterWaitStateHook
var
#
var http2shutdownEnterWaitStateHook = *ast.FuncLit
http2shutdownTimerMsg
var
#
var http2shutdownTimerMsg = *ast.CallExpr
http2sorterPool
var
#
var http2sorterPool = sync.Pool{...}
http2stateClosed
const
#
const http2stateClosed
http2stateHalfClosedLocal
const
#
const http2stateHalfClosedLocal
http2stateHalfClosedRemote
const
#
const http2stateHalfClosedRemote
http2stateIdle
const
#
const http2stateIdle http2streamState = iota
http2stateName
var
#
var http2stateName = [...]string{...}
http2stateOpen
const
#
const http2stateOpen
http2testHookGetServerConn
var
#
var http2testHookGetServerConn func(*http2serverConn)
http2testHookOnConn
var
#
var http2testHookOnConn func()
http2testHookOnPanic
var
#
var http2testHookOnPanic func(sc *http2serverConn, panicVal interface{}) rePanic bool
http2testHookOnPanicMu
var
#
var http2testHookOnPanicMu *sync.Mutex
http2transportDefaultConnFlow
const
#
const http2transportDefaultConnFlow = *ast.BinaryExpr
http2transportDefaultStreamFlow
const
#
const http2transportDefaultStreamFlow = *ast.BinaryExpr
http2writeDataPool
var
#
var http2writeDataPool = sync.Pool{...}
httplaxcontentlength
var
#
var httplaxcontentlength = *ast.CallExpr
httpmuxgo121
var
#
var httpmuxgo121 = *ast.CallExpr
jsFetchCreds
const
#
const jsFetchCreds = "js.fetch:credentials"
jsFetchDisabled
var
#
var jsFetchDisabled = *ast.BinaryExpr
jsFetchMissing
var
#
var jsFetchMissing = *ast.CallExpr
jsFetchMode
const
#
const jsFetchMode = "js.fetch:mode"
jsFetchRedirect
const
#
const jsFetchRedirect = "js.fetch:redirect"
maxInt64
const
#
const maxInt64 = *ast.BinaryExpr
maxPostHandlerReadBytes
const
#
const maxPostHandlerReadBytes = *ast.BinaryExpr
maxSlice
var
#
var maxSlice int = 8
maxWriteWaitBeforeConnReuse
var
#
var maxWriteWaitBeforeConnReuse = *ast.BinaryExpr
moreGeneral
const
#
const moreGeneral relationship = "moreGeneral"
moreSpecific
const
#
const moreSpecific relationship = "moreSpecific"
mp4
var
#
var mp4 = *ast.CallExpr
mp4ftype
var
#
var mp4ftype = *ast.CallExpr
multipartByReader
var
#
var multipartByReader = *ast.UnaryExpr
nextProtoUnencryptedHTTP2
const
#
const nextProtoUnencryptedHTTP2 = "unencrypted_http2"
noHTTP2
const
#
const noHTTP2 = "no bundled HTTP/2"
nopCloserType
var
#
var nopCloserType = *ast.CallExpr
nopCloserWriterToType
var
#
var nopCloserWriterToType = *ast.CallExpr
omitBundledHTTP2
var
#
var omitBundledHTTP2 bool
overlaps
const
#
const overlaps relationship = "overlaps"
portMap
var
#
var portMap = map[string]string{...}
protoHTTP1
const
#
const protoHTTP1 = *ast.BinaryExpr
protoHTTP2
const
#
const protoHTTP2
protoUnencryptedHTTP2
const
#
const protoUnencryptedHTTP2
rstAvoidanceDelay
var
#
var rstAvoidanceDelay = *ast.BinaryExpr
runHooks
const
#
const runHooks = true
shutdownPollIntervalMax
const
#
const shutdownPollIntervalMax = *ast.BinaryExpr
singleCRLF
var
#
var singleCRLF = *ast.CallExpr
skipHooks
const
#
const skipHooks = false
sniffLen
const
#
const sniffLen = 512
sniffSignatures
var
#
var sniffSignatures = []sniffSig{...}
socksAddrTypeFQDN
const
#
const socksAddrTypeFQDN = 0x03
socksAddrTypeIPv4
const
#
const socksAddrTypeIPv4 = 0x01
socksAddrTypeIPv6
const
#
const socksAddrTypeIPv6 = 0x04
socksAuthMethodNoAcceptableMethods
const
#
const socksAuthMethodNoAcceptableMethods socksAuthMethod = 0xff
socksAuthMethodNotRequired
const
#
const socksAuthMethodNotRequired socksAuthMethod = 0x00
socksAuthMethodUsernamePassword
const
#
const socksAuthMethodUsernamePassword socksAuthMethod = 0x02
socksCmdConnect
const
#
const socksCmdConnect socksCommand = 0x01
socksStatusSucceeded
const
#
const socksStatusSucceeded socksReply = 0x00
socksVersion5
const
#
const socksVersion5 = 0x05
socksaLongTimeAgo
var
#
var socksaLongTimeAgo = *ast.CallExpr
socksauthStatusSucceeded
const
#
const socksauthStatusSucceeded = 0x00
socksauthUsernamePasswordVersion
const
#
const socksauthUsernamePasswordVersion = 0x01
sockscmdBind
const
#
const sockscmdBind socksCommand = 0x02
socksnoDeadline
var
#
var socksnoDeadline = time.Time{...}
stateName
var
#
var stateName = map[ConnState]string{...}
suppressedHeadersNoBody
var
#
var suppressedHeadersNoBody = []string{...}
testHookClientDoResult
var
#
var testHookClientDoResult func(retres *Response, reterr error)
testHookEnterRoundTrip
var
#
var testHookEnterRoundTrip = nop
testHookMu
var
#
var testHookMu sync.Locker = fakeLocker{...}
testHookPostPendingDial
var
#
var testHookPostPendingDial = nop
testHookPrePendingDial
var
#
var testHookPrePendingDial = nop
testHookProxyConnectTimeout
var
#
var testHookProxyConnectTimeout = context.WithTimeout
testHookReadLoopBeforeNextRead
var
#
var testHookReadLoopBeforeNextRead = nop
testHookRoundTripRetried
var
#
var testHookRoundTripRetried = nop
testHookServerServe
var
#
var testHookServerServe func(*Server, net.Listener)
testHookWaitResLoop
var
#
var testHookWaitResLoop = nop
textprotoReaderPool
var
#
var textprotoReaderPool sync.Pool
timeFormats
var
#
var timeFormats = []string{...}
uint8Array
var
#
var uint8Array = *ast.CallExpr
uniqNameMu
var
#
var uniqNameMu sync.Mutex
uniqNameNext
var
#
var uniqNameNext = *ast.CallExpr
unixEpochTime
var
#
var unixEpochTime = *ast.CallExpr
use121
var
#
var use121 bool
zeroDialer
var
#
var zeroDialer net.Dialer
Structs
Client
struct
#
A Client is an HTTP client. Its zero value ([DefaultClient]) is a
usable client that uses [DefaultTransport].
The [Client.Transport] typically has internal state (cached TCP
connections), so Clients should be reused instead of created as
needed. Clients are safe for concurrent use by multiple goroutines.
A Client is higher-level than a [RoundTripper] (such as [Transport])
and additionally handles HTTP details such as cookies and
redirects.
When following redirects, the Client will forward all headers set on the
initial [Request] except:
- when forwarding sensitive headers like "Authorization",
"WWW-Authenticate", and "Cookie" to untrusted targets.
These headers will be ignored when following a redirect to a domain
that is not a subdomain match or exact match of the initial domain.
For example, a redirect from "foo.com" to either "foo.com" or "sub.foo.com"
will forward the sensitive headers, but a redirect to "bar.com" will not.
- when forwarding the "Cookie" header with a non-nil cookie Jar.
Since each redirect may mutate the state of the cookie jar,
a redirect may possibly alter a cookie set in the initial request.
When forwarding the "Cookie" header, any mutated cookies will be omitted,
with the expectation that the Jar will insert those mutated cookies
with the updated values (assuming the origin matches).
If Jar is nil, the initial cookies are forwarded without change.
type Client struct {
Transport RoundTripper
CheckRedirect func(req *Request, via []*Request) error
Jar CookieJar
Timeout time.Duration
}
Cookie
struct
#
A Cookie represents an HTTP cookie as sent in the Set-Cookie header of an
HTTP response or the Cookie header of an HTTP request.
See https://tools.ietf.org/html/rfc6265 for details.
type Cookie struct {
Name string
Value string
Quoted bool
Path string
Domain string
Expires time.Time
RawExpires string
MaxAge int
Secure bool
HttpOnly bool
SameSite SameSite
Partitioned bool
Raw string
Unparsed []string
}
HTTP2Config
struct
#
HTTP2Config defines HTTP/2 configuration parameters common to
both [Transport] and [Server].
type HTTP2Config struct {
MaxConcurrentStreams int
MaxDecoderHeaderTableSize int
MaxEncoderHeaderTableSize int
MaxReadFrameSize int
MaxReceiveBufferPerConnection int
MaxReceiveBufferPerStream int
SendPingTimeout time.Duration
PingTimeout time.Duration
WriteByteTimeout time.Duration
PermitProhibitedCipherSuites bool
CountError func(errType string)
}
MaxBytesError
struct
#
MaxBytesError is returned by [MaxBytesReader] when its read limit is exceeded.
type MaxBytesError struct {
Limit int64
}
ProtocolError
struct
#
ProtocolError represents an HTTP protocol error.
Deprecated: Not all errors in the http package related to protocol errors
are of type ProtocolError.
type ProtocolError struct {
ErrorString string
}
Protocols
struct
#
Protocols is a set of HTTP protocols.
The zero value is an empty set of protocols.
The supported protocols are:
- HTTP1 is the HTTP/1.0 and HTTP/1.1 protocols.
HTTP1 is supported on both unsecured TCP and secured TLS connections.
- HTTP2 is the HTTP/2 protcol over a TLS connection.
- UnencryptedHTTP2 is the HTTP/2 protocol over an unsecured TCP connection.
type Protocols struct {
bits uint8
}
PushOptions
struct
#
PushOptions describes options for [Pusher.Push].
type PushOptions struct {
Method string
Header Header
}
Request
struct
#
A Request represents an HTTP request received by a server
or to be sent by a client.
The field semantics differ slightly between client and server
usage. In addition to the notes on the fields below, see the
documentation for [Request.Write] and [RoundTripper].
type Request struct {
Method string
URL *url.URL
Proto string
ProtoMajor int
ProtoMinor int
Header Header
Body io.ReadCloser
GetBody func() (io.ReadCloser, error)
ContentLength int64
TransferEncoding []string
Close bool
Host string
Form url.Values
PostForm url.Values
MultipartForm *multipart.Form
Trailer Header
RemoteAddr string
RequestURI string
TLS *tls.ConnectionState
Cancel <-chan struct{...}
Response *Response
Pattern string
ctx context.Context
pat *pattern
matches []string
otherValues map[string]string
}
Response
struct
#
Response represents the response from an HTTP request.
The [Client] and [Transport] return Responses from servers once
the response headers have been received. The response body
is streamed on demand as the Body field is read.
type Response struct {
Status string
StatusCode int
Proto string
ProtoMajor int
ProtoMinor int
Header Header
Body io.ReadCloser
ContentLength int64
TransferEncoding []string
Close bool
Uncompressed bool
Trailer Header
Request *Request
TLS *tls.ConnectionState
}
ResponseController
struct
#
A ResponseController is used by an HTTP handler to control the response.
A ResponseController may not be used after the [Handler.ServeHTTP] method has returned.
type ResponseController struct {
rw ResponseWriter
}
ServeMux
struct
#
ServeMux is an HTTP request multiplexer.
It matches the URL of each incoming request against a list of registered
patterns and calls the handler for the pattern that
most closely matches the URL.
# Patterns
Patterns can match the method, host and path of a request.
Some examples:
- "/index.html" matches the path "/index.html" for any host and method.
- "GET /static/" matches a GET request whose path begins with "/static/".
- "example.com/" matches any request to the host "example.com".
- "example.com/{$}" matches requests with host "example.com" and path "/".
- "/b/{bucket}/o/{objectname...}" matches paths whose first segment is "b"
and whose third segment is "o". The name "bucket" denotes the second
segment and "objectname" denotes the remainder of the path.
In general, a pattern looks like
[METHOD ][HOST]/[PATH]
All three parts are optional; "/" is a valid pattern.
If METHOD is present, it must be followed by at least one space or tab.
Literal (that is, non-wildcard) parts of a pattern match
the corresponding parts of a request case-sensitively.
A pattern with no method matches every method. A pattern
with the method GET matches both GET and HEAD requests.
Otherwise, the method must match exactly.
A pattern with no host matches every host.
A pattern with a host matches URLs on that host only.
A path can include wildcard segments of the form {NAME} or {NAME...}.
For example, "/b/{bucket}/o/{objectname...}".
The wildcard name must be a valid Go identifier.
Wildcards must be full path segments: they must be preceded by a slash and followed by
either a slash or the end of the string.
For example, "/b_{bucket}" is not a valid pattern.
Normally a wildcard matches only a single path segment,
ending at the next literal slash (not %2F) in the request URL.
But if the "..." is present, then the wildcard matches the remainder of the URL path, including slashes.
(Therefore it is invalid for a "..." wildcard to appear anywhere but at the end of a pattern.)
The match for a wildcard can be obtained by calling [Request.PathValue] with the wildcard's name.
A trailing slash in a path acts as an anonymous "..." wildcard.
The special wildcard {$} matches only the end of the URL.
For example, the pattern "/{$}" matches only the path "/",
whereas the pattern "/" matches every path.
For matching, both pattern paths and incoming request paths are unescaped segment by segment.
So, for example, the path "/a%2Fb/100%25" is treated as having two segments, "a/b" and "100%".
The pattern "/a%2fb/" matches it, but the pattern "/a/b/" does not.
# Precedence
If two or more patterns match a request, then the most specific pattern takes precedence.
A pattern P1 is more specific than P2 if P1 matches a strict subset of P2’s requests;
that is, if P2 matches all the requests of P1 and more.
If neither is more specific, then the patterns conflict.
There is one exception to this rule, for backwards compatibility:
if two patterns would otherwise conflict and one has a host while the other does not,
then the pattern with the host takes precedence.
If a pattern passed to [ServeMux.Handle] or [ServeMux.HandleFunc] conflicts with
another pattern that is already registered, those functions panic.
As an example of the general rule, "/images/thumbnails/" is more specific than "/images/",
so both can be registered.
The former matches paths beginning with "/images/thumbnails/"
and the latter will match any other path in the "/images/" subtree.
As another example, consider the patterns "GET /" and "/index.html":
both match a GET request for "/index.html", but the former pattern
matches all other GET and HEAD requests, while the latter matches any
request for "/index.html" that uses a different method.
The patterns conflict.
# Trailing-slash redirection
Consider a [ServeMux] with a handler for a subtree, registered using a trailing slash or "..." wildcard.
If the ServeMux receives a request for the subtree root without a trailing slash,
it redirects the request by adding the trailing slash.
This behavior can be overridden with a separate registration for the path without
the trailing slash or "..." wildcard. For example, registering "/images/" causes ServeMux
to redirect a request for "/images" to "/images/", unless "/images" has
been registered separately.
# Request sanitizing
ServeMux also takes care of sanitizing the URL request path and the Host
header, stripping the port number and redirecting any request containing . or
.. segments or repeated slashes to an equivalent, cleaner URL.
Escaped path elements such as "%2e" for "." and "%2f" for "/" are preserved
and aren't considered separators for request routing.
# Compatibility
The pattern syntax and matching behavior of ServeMux changed significantly
in Go 1.22. To restore the old behavior, set the GODEBUG environment variable
to "httpmuxgo121=1". This setting is read once, at program startup; changes
during execution will be ignored.
The backwards-incompatible changes include:
- Wildcards are just ordinary literal path segments in 1.21.
For example, the pattern "/{x}" will match only that path in 1.21,
but will match any one-segment path in 1.22.
- In 1.21, no pattern was rejected, unless it was empty or conflicted with an existing pattern.
In 1.22, syntactically invalid patterns will cause [ServeMux.Handle] and [ServeMux.HandleFunc] to panic.
For example, in 1.21, the patterns "/{" and "/a{x}" match themselves,
but in 1.22 they are invalid and will cause a panic when registered.
- In 1.22, each segment of a pattern is unescaped; this was not done in 1.21.
For example, in 1.22 the pattern "/%61" matches the path "/a" ("%61" being the URL escape sequence for "a"),
but in 1.21 it would match only the path "/%2561" (where "%25" is the escape for the percent sign).
- When matching patterns to paths, in 1.22 each segment of the path is unescaped; in 1.21, the entire path is unescaped.
This change mostly affects how paths with %2F escapes adjacent to slashes are treated.
See https://go.dev/issue/21955 for details.
type ServeMux struct {
mu sync.RWMutex
tree routingNode
index routingIndex
mux121 serveMux121
}
Server
struct
#
A Server defines parameters for running an HTTP server.
The zero value for Server is a valid configuration.
type Server struct {
Addr string
Handler Handler
DisableGeneralOptionsHandler bool
TLSConfig *tls.Config
ReadTimeout time.Duration
ReadHeaderTimeout time.Duration
WriteTimeout time.Duration
IdleTimeout time.Duration
MaxHeaderBytes int
TLSNextProto map[string]func(*Server, *tls.Conn, Handler)
ConnState func(net.Conn, ConnState)
ErrorLog *log.Logger
BaseContext func(net.Listener) context.Context
ConnContext func(ctx context.Context, c net.Conn) context.Context
HTTP2 *HTTP2Config
Protocols *Protocols
inShutdown atomic.Bool
disableKeepAlives atomic.Bool
nextProtoOnce sync.Once
nextProtoErr error
mu sync.Mutex
listeners map[*net.Listener]struct{...}
activeConn map[*conn]struct{...}
onShutdown []func()
listenerGroup sync.WaitGroup
}
Transport
struct
#
Transport is an implementation of [RoundTripper] that supports HTTP,
HTTPS, and HTTP proxies (for either HTTP or HTTPS with CONNECT).
By default, Transport caches connections for future re-use.
This may leave many open connections when accessing many hosts.
This behavior can be managed using [Transport.CloseIdleConnections] method
and the [Transport.MaxIdleConnsPerHost] and [Transport.DisableKeepAlives] fields.
Transports should be reused instead of created as needed.
Transports are safe for concurrent use by multiple goroutines.
A Transport is a low-level primitive for making HTTP and HTTPS requests.
For high-level functionality, such as cookies and redirects, see [Client].
Transport uses HTTP/1.1 for HTTP URLs and either HTTP/1.1 or HTTP/2
for HTTPS URLs, depending on whether the server supports HTTP/2,
and how the Transport is configured. The [DefaultTransport] supports HTTP/2.
To explicitly enable HTTP/2 on a transport, set [Transport.Protocols].
Responses with status codes in the 1xx range are either handled
automatically (100 expect-continue) or ignored. The one
exception is HTTP status code 101 (Switching Protocols), which is
considered a terminal status and returned by [Transport.RoundTrip]. To see the
ignored 1xx responses, use the httptrace trace package's
ClientTrace.Got1xxResponse.
Transport only retries a request upon encountering a network error
if the connection has been already been used successfully and if the
request is idempotent and either has no body or has its [Request.GetBody]
defined. HTTP requests are considered idempotent if they have HTTP methods
GET, HEAD, OPTIONS, or TRACE; or if their [Header] map contains an
"Idempotency-Key" or "X-Idempotency-Key" entry. If the idempotency key
value is a zero-length slice, the request is treated as idempotent but the
header is not sent on the wire.
type Transport struct {
idleMu sync.Mutex
closeIdle bool
idleConn map[connectMethodKey][]*persistConn
idleConnWait map[connectMethodKey]wantConnQueue
idleLRU connLRU
reqMu sync.Mutex
reqCanceler map[*Request]context.CancelCauseFunc
altMu sync.Mutex
altProto atomic.Value
connsPerHostMu sync.Mutex
connsPerHost map[connectMethodKey]int
connsPerHostWait map[connectMethodKey]wantConnQueue
dialsInProgress wantConnQueue
Proxy func(*Request) (*url.URL, error)
OnProxyConnectResponse func(ctx context.Context, proxyURL *url.URL, connectReq *Request, connectRes *Response) error
DialContext func(ctx context.Context, network string, addr string) (net.Conn, error)
Dial func(network string, addr string) (net.Conn, error)
DialTLSContext func(ctx context.Context, network string, addr string) (net.Conn, error)
DialTLS func(network string, addr string) (net.Conn, error)
TLSClientConfig *tls.Config
TLSHandshakeTimeout time.Duration
DisableKeepAlives bool
DisableCompression bool
MaxIdleConns int
MaxIdleConnsPerHost int
MaxConnsPerHost int
IdleConnTimeout time.Duration
ResponseHeaderTimeout time.Duration
ExpectContinueTimeout time.Duration
TLSNextProto map[string]func(authority string, c *tls.Conn) RoundTripper
ProxyConnectHeader Header
GetProxyConnectHeader func(ctx context.Context, proxyURL *url.URL, target string) (Header, error)
MaxResponseHeaderBytes int64
WriteBufferSize int
ReadBufferSize int
nextProtoOnce sync.Once
h2transport h2Transport
tlsNextProtoWasNil bool
ForceAttemptHTTP2 bool
HTTP2 *HTTP2Config
Protocols *Protocols
}
arrayReader
struct
#
arrayReader implements an io.ReadCloser wrapper for ArrayBuffer.
https://developer.mozilla.org/en-US/docs/Web/API/Body/arrayBuffer.
type arrayReader struct {
arrayPromise js.Value
pending []byte
read bool
err error
}
body
struct
#
body turns a Reader into a ReadCloser.
Close ensures that the body has been fully read
and then reads the trailer if necessary.
type body struct {
src io.Reader
hdr any
r *bufio.Reader
closing bool
doEarlyClose bool
mu sync.Mutex
sawEOF bool
closed bool
earlyClose bool
onHitEOF func()
}
bodyEOFSignal
struct
#
bodyEOFSignal is used by the HTTP/1 transport when reading response
bodies to make sure we see the end of a response body before
proceeding and reading on the connection again.
It wraps a ReadCloser but runs fn (if non-nil) at most
once, right before its final (error-producing) Read or Close call
returns. fn should return the new error to return from Read or Close.
If earlyCloseFn is non-nil and Close is called before io.EOF is
seen, earlyCloseFn is called instead of fn, and its return value is
the return value from Close.
type bodyEOFSignal struct {
body io.ReadCloser
mu sync.Mutex
closed bool
rerr error
fn func(error) error
earlyCloseFn func() error
}
bodyLocked
struct
#
bodyLocked is an io.Reader reading from a *body when its mutex is
already held.
type bodyLocked struct {
b *body
}
bufioFlushWriter
struct
#
bufioFlushWriter is an io.Writer wrapper that flushes all writes
on its wrapped writer if it's a *bufio.Writer.
type bufioFlushWriter struct {
w io.Writer
}
byteReader
struct
#
type byteReader struct {
b byte
done bool
}
cancelTimerBody
struct
#
cancelTimerBody is an io.ReadCloser that wraps rc with two features:
1. On Read error or close, the stop func is called.
2. On Read failure, if reqDidTimeout is true, the error is wrapped and
marked as net.Error that hit its timeout.
type cancelTimerBody struct {
stop func()
rc io.ReadCloser
reqDidTimeout func() bool
}
checkConnErrorWriter
struct
#
checkConnErrorWriter writes to c.rwc and records any write errors to c.werr.
It only contains one field (and a pointer field at that), so it
fits in an interface value without an extra allocation.
type checkConnErrorWriter struct {
c *conn
}
chunkWriter
struct
#
chunkWriter writes to a response's conn buffer, and is the writer
wrapped by the response.w buffered writer.
chunkWriter also is responsible for finalizing the Header, including
conditionally setting the Content-Type and setting a Content-Length
in cases where the handler's final output is smaller than the buffer
size. It also conditionally adds chunk headers, when in chunking mode.
See the comment above (*response).Write for the entire write flow.
type chunkWriter struct {
res *response
header Header
wroteHeader bool
chunking bool
}
conn
struct
#
A conn represents the server side of an HTTP connection.
type conn struct {
server *Server
cancelCtx context.CancelFunc
rwc net.Conn
remoteAddr string
tlsState *tls.ConnectionState
werr error
r *connReader
bufr *bufio.Reader
bufw *bufio.Writer
lastMethod string
curReq *ast.IndexExpr
curState atomic.Uint64
mu sync.Mutex
hijackedv bool
}
connLRU
struct
#
type connLRU struct {
ll *list.List
m map[*persistConn]*list.Element
}
connOrError
struct
#
type connOrError struct {
pc *persistConn
err error
idleAt time.Time
}
connReader
struct
#
connReader is the io.Reader wrapper used by *conn. It combines a
selectively-activated io.LimitedReader (to bound request header
read sizes) with support for selectively keeping an io.Reader.Read
call blocked in a background goroutine to wait for activity and
trigger a CloseNotifier channel.
type connReader struct {
conn *conn
mu sync.Mutex
hasByte bool
byteBuf [1]byte
cond *sync.Cond
inRead bool
aborted bool
remain int64
}
connectMethod
struct
#
connectMethod is the map key (in its String form) for keeping persistent
TCP connections alive for subsequent HTTP requests.
A connect method may be of the following types:
connectMethod.key().String() Description
------------------------------ -------------------------
|http|foo.com http directly to server, no proxy
|https|foo.com https directly to server, no proxy
|https,h1|foo.com https directly to server w/o HTTP/2, no proxy
http://proxy.com|https|foo.com http to proxy, then CONNECT to foo.com
http://proxy.com|http http to proxy, http to anywhere after that
socks5://proxy.com|http|foo.com socks5 to proxy, then http to foo.com
socks5://proxy.com|https|foo.com socks5 to proxy, then https to foo.com
https://proxy.com|https|foo.com https to proxy, then CONNECT to foo.com
https://proxy.com|http https to proxy, http to anywhere after that
type connectMethod struct {
_ incomparable
proxyURL *url.URL
targetScheme string
targetAddr string
onlyH1 bool
}
connectMethodKey
struct
#
connectMethodKey is the map key version of connectMethod, with a
stringified proxy URL (or the empty string) instead of a pointer to
a URL.
type connectMethodKey struct {
proxy string
scheme string
addr string
onlyH1 bool
}
contextKey
struct
#
contextKey is a value for use with context.WithValue. It's used as
a pointer so it fits in an interface{} without allocation.
type contextKey struct {
name string
}
entry
struct
#
type entry struct {
key K
value V
}
errorReader
struct
#
type errorReader struct {
err error
}
exactSig
struct
#
type exactSig struct {
sig []byte
ct string
}
expectContinueReader
struct
#
wrapper around io.ReadCloser which on first read, sends an
HTTP/1.1 100 Continue header
type expectContinueReader struct {
resp *response
readCloser io.ReadCloser
closed atomic.Bool
sawEOF atomic.Bool
}
fakeLocker
struct
#
fakeLocker is a sync.Locker which does nothing. It's used to guard
test-only fields when not under test, to avoid runtime atomic
overhead.
type fakeLocker struct {
}
fileHandler
struct
#
type fileHandler struct {
root FileSystem
}
fileTransport
struct
#
fileTransport implements RoundTripper for the 'file' protocol.
type fileTransport struct {
fh fileHandler
}
finishAsyncByteRead
struct
#
finishAsyncByteRead finishes reading the 1-byte sniff
from the ContentLength==0, Body!=nil case.
type finishAsyncByteRead struct {
tw *transferWriter
}
globalOptionsHandler
struct
#
globalOptionsHandler responds to "OPTIONS *" requests.
type globalOptionsHandler struct {
}
gzipReader
struct
#
gzipReader wraps a response body so it can lazily
call gzip.NewReader on the first call to Read
type gzipReader struct {
_ incomparable
body *bodyEOFSignal
zr *gzip.Reader
zerr error
}
http2ClientConn
struct
#
ClientConn is the state of a single HTTP/2 client connection to an
HTTP/2 server.
type http2ClientConn struct {
t *http2Transport
tconn net.Conn
tlsState *tls.ConnectionState
atomicReused uint32
singleUse bool
getConnCalled bool
readerDone chan struct{...}
readerErr error
idleTimeout time.Duration
idleTimer http2timer
mu sync.Mutex
cond *sync.Cond
flow http2outflow
inflow http2inflow
doNotReuse bool
closing bool
closed bool
seenSettings bool
seenSettingsChan chan struct{...}
wantSettingsAck bool
goAway *http2GoAwayFrame
goAwayDebug string
streams map[uint32]*http2clientStream
streamsReserved int
nextStreamID uint32
pendingRequests int
pings map[[8]byte]chan struct{...}
br *bufio.Reader
lastActive time.Time
lastIdle time.Time
maxFrameSize uint32
maxConcurrentStreams uint32
peerMaxHeaderListSize uint64
peerMaxHeaderTableSize uint32
initialWindowSize uint32
initialStreamRecvWindowSize int32
readIdleTimeout time.Duration
pingTimeout time.Duration
extendedConnectAllowed bool
rstStreamPingsBlocked bool
pendingResets int
reqHeaderMu chan struct{...}
wmu sync.Mutex
bw *bufio.Writer
fr *http2Framer
werr error
hbuf bytes.Buffer
henc *hpack.Encoder
}
http2ClientConnState
struct
#
ClientConnState describes the state of a ClientConn.
type http2ClientConnState struct {
Closed bool
Closing bool
StreamsActive int
StreamsReserved int
StreamsPending int
MaxConcurrentStreams uint32
LastIdle time.Time
}
http2ContinuationFrame
struct
#
A ContinuationFrame is used to continue a sequence of header block fragments.
See https://httpwg.org/specs/rfc7540.html#rfc.section.6.10
type http2ContinuationFrame struct {
http2FrameHeader
headerFragBuf []byte
}
http2DataFrame
struct
#
A DataFrame conveys arbitrary, variable-length sequences of octets
associated with a stream.
See https://httpwg.org/specs/rfc7540.html#rfc.section.6.1
type http2DataFrame struct {
http2FrameHeader
data []byte
}
http2FrameWriteRequest
struct
#
FrameWriteRequest is a request to write a frame.
type http2FrameWriteRequest struct {
write http2writeFramer
stream *http2stream
done chan error
}
http2Framer
struct
#
A Framer reads and writes Frames.
type http2Framer struct {
r io.Reader
lastFrame http2Frame
errDetail error
countError func(errToken string)
lastHeaderStream uint32
maxReadSize uint32
headerBuf [http2frameHeaderLen]byte
getReadBuf func(size uint32) []byte
readBuf []byte
maxWriteSize uint32
w io.Writer
wbuf []byte
AllowIllegalWrites bool
AllowIllegalReads bool
ReadMetaHeaders *hpack.Decoder
MaxHeaderListSize uint32
logReads bool
logWrites bool
debugFramer *http2Framer
debugFramerBuf *bytes.Buffer
debugReadLoggerf func(string, ...interface{})
debugWriteLoggerf func(string, ...interface{})
frameCache *http2frameCache
}
http2GoAwayError
struct
#
GoAwayError is returned by the Transport when the server closes the
TCP connection after sending a GOAWAY frame.
type http2GoAwayError struct {
LastStreamID uint32
ErrCode http2ErrCode
DebugData string
}
http2GoAwayFrame
struct
#
A GoAwayFrame informs the remote peer to stop creating streams on this connection.
See https://httpwg.org/specs/rfc7540.html#rfc.section.6.8
type http2GoAwayFrame struct {
http2FrameHeader
LastStreamID uint32
ErrCode http2ErrCode
debugData []byte
}
http2OpenStreamOptions
struct
#
OpenStreamOptions specifies extra options for WriteScheduler.OpenStream.
type http2OpenStreamOptions struct {
PusherID uint32
}
http2PingFrame
struct
#
A PingFrame is a mechanism for measuring a minimal round trip time
from the sender, as well as determining whether an idle connection
is still functional.
See https://httpwg.org/specs/rfc7540.html#rfc.section.6.7
type http2PingFrame struct {
http2FrameHeader
Data [8]byte
}
http2PriorityFrame
struct
#
A PriorityFrame specifies the sender-advised priority of a stream.
See https://httpwg.org/specs/rfc7540.html#rfc.section.6.3
type http2PriorityFrame struct {
http2FrameHeader
http2PriorityParam
}
http2PriorityParam
struct
#
PriorityParam are the stream prioritzation parameters.
type http2PriorityParam struct {
StreamDep uint32
Exclusive bool
Weight uint8
}
http2PriorityWriteSchedulerConfig
struct
#
PriorityWriteSchedulerConfig configures a priorityWriteScheduler.
type http2PriorityWriteSchedulerConfig struct {
MaxClosedNodesInTree int
MaxIdleNodesInTree int
ThrottleOutOfOrderWrites bool
}
http2PushPromiseFrame
struct
#
A PushPromiseFrame is used to initiate a server stream.
See https://httpwg.org/specs/rfc7540.html#rfc.section.6.6
type http2PushPromiseFrame struct {
http2FrameHeader
PromiseID uint32
headerFragBuf []byte
}
http2PushPromiseParam
struct
#
PushPromiseParam are the parameters for writing a PUSH_PROMISE frame.
type http2PushPromiseParam struct {
StreamID uint32
PromiseID uint32
BlockFragment []byte
EndHeaders bool
PadLength uint8
}
http2RSTStreamFrame
struct
#
A RSTStreamFrame allows for abnormal termination of a stream.
See https://httpwg.org/specs/rfc7540.html#rfc.section.6.4
type http2RSTStreamFrame struct {
http2FrameHeader
ErrCode http2ErrCode
}
http2RoundTripOpt
struct
#
RoundTripOpt are options for the Transport.RoundTripOpt method.
type http2RoundTripOpt struct {
OnlyCachedConn bool
allowHTTP bool
}
http2ServeConnOpts
struct
#
ServeConnOpts are options for the Server.ServeConn method.
type http2ServeConnOpts struct {
Context context.Context
BaseConfig *Server
Handler Handler
UpgradeRequest *Request
Settings []byte
SawClientPreface bool
}
http2Server
struct
#
Server is an HTTP/2 server.
type http2Server struct {
MaxHandlers int
MaxConcurrentStreams uint32
MaxDecoderHeaderTableSize uint32
MaxEncoderHeaderTableSize uint32
MaxReadFrameSize uint32
PermitProhibitedCipherSuites bool
IdleTimeout time.Duration
ReadIdleTimeout time.Duration
PingTimeout time.Duration
WriteByteTimeout time.Duration
MaxUploadBufferPerConnection int32
MaxUploadBufferPerStream int32
NewWriteScheduler func() http2WriteScheduler
CountError func(errType string)
state *http2serverInternalState
group http2synctestGroupInterface
}
http2Server
struct
#
type http2Server struct {
NewWriteScheduler func() http2WriteScheduler
}
http2Setting
struct
#
Setting is a setting parameter: which setting it is, and its value.
type http2Setting struct {
ID http2SettingID
Val uint32
}
http2SettingsFrame
struct
#
A SettingsFrame conveys configuration parameters that affect how
endpoints communicate, such as preferences and constraints on peer
behavior.
See https://httpwg.org/specs/rfc7540.html#SETTINGS
type http2SettingsFrame struct {
http2FrameHeader
p []byte
}
http2StreamError
struct
#
StreamError is an error that only affects one stream within an
HTTP/2 connection.
type http2StreamError struct {
StreamID uint32
Code http2ErrCode
Cause error
}
http2Transport
struct
#
Transport is an HTTP/2 Transport.
A Transport internally caches connections to servers. It is safe
for concurrent use by multiple goroutines.
type http2Transport struct {
DialTLSContext func(ctx context.Context, network string, addr string, cfg *tls.Config) (net.Conn, error)
DialTLS func(network string, addr string, cfg *tls.Config) (net.Conn, error)
TLSClientConfig *tls.Config
ConnPool http2ClientConnPool
DisableCompression bool
AllowHTTP bool
MaxHeaderListSize uint32
MaxReadFrameSize uint32
MaxDecoderHeaderTableSize uint32
MaxEncoderHeaderTableSize uint32
StrictMaxConcurrentStreams bool
IdleConnTimeout time.Duration
ReadIdleTimeout time.Duration
PingTimeout time.Duration
WriteByteTimeout time.Duration
CountError func(errType string)
t1 *Transport
connPoolOnce sync.Once
connPoolOrDef http2ClientConnPool
*http2transportTestHooks
}
http2Transport
struct
#
type http2Transport struct {
MaxHeaderListSize uint32
ConnPool any
}
http2UnknownFrame
struct
#
An UnknownFrame is the frame type returned when the frame type is unknown
or no specific frame type parser exists.
type http2UnknownFrame struct {
http2FrameHeader
p []byte
}
http2WindowUpdateFrame
struct
#
A WindowUpdateFrame is used to implement flow control.
See https://httpwg.org/specs/rfc7540.html#rfc.section.6.9
type http2WindowUpdateFrame struct {
http2FrameHeader
Increment uint32
}
http2addConnCall
struct
#
type http2addConnCall struct {
_ http2incomparable
p *http2clientConnPool
done chan struct{...}
err error
}
http2bodyReadMsg
struct
#
A bodyReadMsg tells the server loop that the http.Handler read n
bytes of the DATA from the client on the given stream.
type http2bodyReadMsg struct {
st *http2stream
n int
}
http2bufferedWriter
struct
#
bufferedWriter is a buffered writer that writes to w.
Its buffered writer is lazily allocated as needed, to minimize
idle memory usage with many connections.
type http2bufferedWriter struct {
_ http2incomparable
group http2synctestGroupInterface
conn net.Conn
bw *bufio.Writer
byteTimeout time.Duration
}
http2chunkWriter
struct
#
type http2chunkWriter struct {
rws *http2responseWriterState
}
http2clientConn
struct
#
type http2clientConn struct {
}
http2clientConnIdleState
struct
#
type http2clientConnIdleState struct {
canTakeNewRequest bool
}
http2clientConnIdleState
struct
#
clientConnIdleState describes the suitability of a client
connection to initiate a new RoundTrip request.
type http2clientConnIdleState struct {
canTakeNewRequest bool
}
http2clientConnPool
struct
#
TODO: use singleflight for dialing and addConnCalls?
type http2clientConnPool struct {
t *http2Transport
mu sync.Mutex
conns map[string][]*http2ClientConn
dialing map[string]*http2dialCall
keys map[*http2ClientConn][]string
addConnCalls map[string]*http2addConnCall
}
http2clientConnPool
struct
#
type http2clientConnPool struct {
mu *sync.Mutex
conns map[string][]*http2clientConn
}
http2clientConnReadLoop
struct
#
clientConnReadLoop is the state owned by the clientConn's frame-reading readLoop.
type http2clientConnReadLoop struct {
_ http2incomparable
cc *http2ClientConn
}
http2clientStream
struct
#
clientStream is the state for a single HTTP/2 stream. One of these
is created for each Transport.RoundTrip call.
type http2clientStream struct {
cc *http2ClientConn
ctx context.Context
reqCancel <-chan struct{...}
trace *httptrace.ClientTrace
ID uint32
bufPipe http2pipe
requestedGzip bool
isHead bool
abortOnce sync.Once
abort chan struct{...}
abortErr error
peerClosed chan struct{...}
donec chan struct{...}
on100 chan struct{...}
respHeaderRecv chan struct{...}
res *Response
flow http2outflow
inflow http2inflow
bytesRemain int64
readErr error
reqBody io.ReadCloser
reqBodyContentLength int64
reqBodyClosed chan struct{...}
sentEndStream bool
sentHeaders bool
firstByte bool
pastHeaders bool
pastTrailers bool
readClosed bool
readAborted bool
totalHeaderSize int64
trailer Header
resTrailer *Header
}
http2connError
struct
#
connError represents an HTTP/2 ConnectionError error code, along
with a string (for debugging) explaining why.
Errors of this type are only returned by the frame parser functions
and converted into ConnectionError(Code), after stashing away
the Reason into the Framer's errDetail field, accessible via
the (*Framer).ErrorDetail method.
type http2connError struct {
Code http2ErrCode
Reason string
}
http2dataBuffer
struct
#
dataBuffer is an io.ReadWriter backed by a list of data chunks.
Each dataBuffer is used to read DATA frames on a single stream.
The buffer is divided into chunks so the server can limit the
total memory used by a single connection without limiting the
request body size on any single stream.
type http2dataBuffer struct {
chunks [][]byte
r int
w int
size int
expected int64
}
http2dialCall
struct
#
dialCall is an in-flight Transport dial call to a host.
type http2dialCall struct {
_ http2incomparable
p *http2clientConnPool
ctx context.Context
done chan struct{...}
res *http2ClientConn
err error
}
http2erringRoundTripper
struct
#
type http2erringRoundTripper struct {
err error
}
http2errorReader
struct
#
type http2errorReader struct {
err error
}
http2flushFrameWriter
struct
#
type http2flushFrameWriter struct {
}
http2frameCache
struct
#
type http2frameCache struct {
dataFrame http2DataFrame
}
http2frameWriteResult
struct
#
frameWriteResult is the message passed from writeFrameAsync to the serve goroutine.
type http2frameWriteResult struct {
_ http2incomparable
wr http2FrameWriteRequest
err error
}
http2goAwayFlowError
struct
#
6.9.1 The Flow Control Window
"If a sender receives a WINDOW_UPDATE that causes a flow control
window to exceed this maximum it MUST terminate either the stream
or the connection, as appropriate. For streams, [...]; for the
connection, a GOAWAY frame with a FLOW_CONTROL_ERROR code."
type http2goAwayFlowError struct {
}
http2gzipReader
struct
#
gzipReader wraps a response body so it can lazily
call gzip.NewReader on the first call to Read
type http2gzipReader struct {
_ http2incomparable
body io.ReadCloser
zr *gzip.Reader
zerr error
}
http2handlerPanicRST
struct
#
handlerPanicRST is the message sent from handler goroutines when
the handler panics.
type http2handlerPanicRST struct {
StreamID uint32
}
http2http2Config
struct
#
http2Config is a package-internal version of net/http.HTTP2Config.
http.HTTP2Config was added in Go 1.24.
When running with a version of net/http that includes HTTP2Config,
we merge the configuration with the fields in Transport or Server
to produce an http2Config.
Zero valued fields in http2Config are interpreted as in the
net/http.HTTPConfig documentation.
Precedence order for reconciling configurations is:
- Use the net/http.{Server,Transport}.HTTP2Config value, when non-zero.
- Otherwise use the http2.{Server.Transport} value.
- If the resulting value is zero or out of range, use a default.
type http2http2Config struct {
MaxConcurrentStreams uint32
MaxDecoderHeaderTableSize uint32
MaxEncoderHeaderTableSize uint32
MaxReadFrameSize uint32
MaxUploadBufferPerConnection int32
MaxUploadBufferPerStream int32
SendPingTimeout time.Duration
PingTimeout time.Duration
WriteByteTimeout time.Duration
PermitProhibitedCipherSuites bool
CountError func(errType string)
}
http2httpError
struct
#
type http2httpError struct {
_ http2incomparable
msg string
timeout bool
}
http2inflow
struct
#
inflow accounts for an inbound flow control window.
It tracks both the latest window sent to the peer (used for enforcement)
and the accumulated unsent window.
type http2inflow struct {
avail int32
unsent int32
}
http2missingBody
struct
#
type http2missingBody struct {
}
http2noBodyReader
struct
#
type http2noBodyReader struct {
}
http2noCachedConnError
struct
#
noCachedConnError is the concrete type of ErrNoCachedConn, which
needs to be detected by net/http regardless of whether it's its
bundled version (in h2_bundle.go with a rewritten type name) or
from a user's x/net/http2. As such, as it has a unique method name
(IsHTTP2NoCachedConnError) that net/http sniffs for via func
isNoCachedConnError.
type http2noCachedConnError struct {
}
http2noCachedConnError
struct
#
type http2noCachedConnError struct {
}
http2noDialClientConnPool
struct
#
noDialClientConnPool is an implementation of http2.ClientConnPool
which never dials. We let the HTTP/1.1 client dial and use its TLS
connection instead.
type http2noDialClientConnPool struct {
*http2clientConnPool
}
http2noDialClientConnPool
struct
#
type http2noDialClientConnPool struct {
http2clientConnPool http2clientConnPool
}
http2noDialH2RoundTripper
struct
#
noDialH2RoundTripper is a RoundTripper which only tries to complete the request
if there's already has a cached connection to the host.
(The field is exported so it can be accessed via reflect from net/http; tested
by TestNoDialH2RoundTripperType)
type http2noDialH2RoundTripper struct {
*http2Transport
}
http2noDialH2RoundTripper
struct
#
type http2noDialH2RoundTripper struct {
}
http2outflow
struct
#
outflow is the outbound flow control window's size.
type http2outflow struct {
_ http2incomparable
n int32
conn *http2outflow
}
http2pipe
struct
#
pipe is a goroutine-safe io.Reader/io.Writer pair. It's like
io.Pipe except there are no PipeReader/PipeWriter halves, and the
underlying buffer is an interface. (io.Pipe is always unbuffered)
type http2pipe struct {
mu sync.Mutex
c sync.Cond
b http2pipeBuffer
unread int
err error
breakErr error
donec chan struct{...}
readFn func()
}
http2priorityNode
struct
#
priorityNode is a node in an HTTP/2 priority tree.
Each node is associated with a single stream ID.
See RFC 7540, Section 5.3.
type http2priorityNode struct {
q http2writeQueue
id uint32
weight uint8
state http2priorityNodeState
bytes int64
subtreeBytes int64
parent *http2priorityNode
kids *http2priorityNode
prev *http2priorityNode
next *http2priorityNode
}
http2priorityWriteScheduler
struct
#
type http2priorityWriteScheduler struct {
root http2priorityNode
nodes map[uint32]*http2priorityNode
maxID uint32
closedNodes []*http2priorityNode
idleNodes []*http2priorityNode
maxClosedNodesInTree int
maxIdleNodesInTree int
writeThrottleLimit int32
enableWriteThrottle bool
tmp []*http2priorityNode
queuePool http2writeQueuePool
}
http2randomWriteScheduler
struct
#
type http2randomWriteScheduler struct {
zero http2writeQueue
sq map[uint32]*http2writeQueue
queuePool http2writeQueuePool
}
http2readFrameResult
struct
#
type http2readFrameResult struct {
f http2Frame
err error
readMore func()
}
http2requestBody
struct
#
requestBody is the Handler's Request.Body type.
Read and Close may be called concurrently.
type http2requestBody struct {
_ http2incomparable
stream *http2stream
conn *http2serverConn
closeOnce sync.Once
sawEOF bool
pipe *http2pipe
needsContinue bool
}
http2requestParam
struct
#
type http2requestParam struct {
method string
scheme string
authority string
path string
protocol string
header Header
}
http2resAndError
struct
#
type http2resAndError struct {
_ http2incomparable
res *Response
err error
}
http2responseWriter
struct
#
responseWriter is the http.ResponseWriter implementation. It's
intentionally small (1 pointer wide) to minimize garbage. The
responseWriterState pointer inside is zeroed at the end of a
request (in handlerDone) and calls on the responseWriter thereafter
simply crash (caller's mistake), but the much larger responseWriterState
and buffers are reused between multiple requests.
type http2responseWriter struct {
rws *http2responseWriterState
}
http2responseWriterState
struct
#
type http2responseWriterState struct {
stream *http2stream
req *Request
conn *http2serverConn
bw *bufio.Writer
handlerHeader Header
snapHeader Header
trailers []string
status int
wroteHeader bool
sentHeader bool
handlerDone bool
sentContentLen int64
wroteBytes int64
closeNotifierMu sync.Mutex
closeNotifierCh chan bool
}
http2roundRobinWriteScheduler
struct
#
type http2roundRobinWriteScheduler struct {
control http2writeQueue
streams map[uint32]*http2writeQueue
head *http2writeQueue
queuePool http2writeQueuePool
}
http2serverConn
struct
#
type http2serverConn struct {
srv *http2Server
hs *Server
conn net.Conn
bw *http2bufferedWriter
handler Handler
baseCtx context.Context
framer *http2Framer
doneServing chan struct{...}
readFrameCh chan http2readFrameResult
wantWriteFrameCh chan http2FrameWriteRequest
wroteFrameCh chan http2frameWriteResult
bodyReadCh chan http2bodyReadMsg
serveMsgCh chan interface{}
flow http2outflow
inflow http2inflow
tlsState *tls.ConnectionState
remoteAddrStr string
writeSched http2WriteScheduler
countErrorFunc func(errType string)
serveG http2goroutineLock
pushEnabled bool
sawClientPreface bool
sawFirstSettings bool
needToSendSettingsAck bool
unackedSettings int
queuedControlFrames int
clientMaxStreams uint32
advMaxStreams uint32
curClientStreams uint32
curPushedStreams uint32
curHandlers uint32
maxClientStreamID uint32
maxPushPromiseID uint32
streams map[uint32]*http2stream
unstartedHandlers []http2unstartedHandler
initialStreamSendWindowSize int32
initialStreamRecvWindowSize int32
maxFrameSize int32
peerMaxHeaderListSize uint32
canonHeader map[string]string
canonHeaderKeysSize int
writingFrame bool
writingFrameAsync bool
needsFrameFlush bool
inGoAway bool
inFrameScheduleLoop bool
needToSendGoAway bool
pingSent bool
sentPingData [8]byte
goAwayCode http2ErrCode
shutdownTimer http2timer
idleTimer http2timer
readIdleTimeout time.Duration
pingTimeout time.Duration
readIdleTimer http2timer
headerWriteBuf bytes.Buffer
hpackEncoder *hpack.Encoder
shutdownOnce sync.Once
}
http2serverInternalState
struct
#
type http2serverInternalState struct {
mu sync.Mutex
activeConns map[*http2serverConn]struct{...}
}
http2sorter
struct
#
type http2sorter struct {
v []string
}
http2startPushRequest
struct
#
type http2startPushRequest struct {
parent *http2stream
method string
url *url.URL
header Header
done chan error
}
http2stickyErrWriter
struct
#
type http2stickyErrWriter struct {
group http2synctestGroupInterface
conn net.Conn
timeout time.Duration
err *error
}
http2stream
struct
#
stream represents a stream. This is the minimal metadata needed by
the serve goroutine. Most of the actual stream state is owned by
the http.Handler's goroutine in the responseWriter. Because the
responseWriter's responseWriterState is recycled at the end of a
handler, this struct intentionally has no pointer to the
*responseWriter{,State} itself, as the Handler ending nils out the
responseWriter's state field.
type http2stream struct {
sc *http2serverConn
id uint32
body *http2pipe
cw http2closeWaiter
ctx context.Context
cancelCtx func()
bodyBytes int64
declBodyBytes int64
flow http2outflow
inflow http2inflow
state http2streamState
resetQueued bool
gotTrailerHeader bool
wroteHeaders bool
readDeadline http2timer
writeDeadline http2timer
closeErr error
trailer Header
reqTrailer Header
}
http2timeTimer
struct
#
timeTimer adapts a time.Timer to the timer interface.
type http2timeTimer struct {
*time.Timer
}
http2transportResponseBody
struct
#
transportResponseBody is the concrete type of Transport.RoundTrip's
Response.Body. It is an io.ReadCloser.
type http2transportResponseBody struct {
cs *http2clientStream
}
http2transportTestHooks
struct
#
type http2transportTestHooks struct {
newclientconn func(*http2ClientConn)
group http2synctestGroupInterface
}
http2unstartedHandler
struct
#
type http2unstartedHandler struct {
streamID uint32
rw *http2responseWriter
req *Request
handler func(ResponseWriter, *Request)
}
http2writeData
struct
#
type http2writeData struct {
streamID uint32
p []byte
endStream bool
}
http2writeGoAway
struct
#
type http2writeGoAway struct {
maxStreamID uint32
code http2ErrCode
}
http2writePing
struct
#
type http2writePing struct {
data [8]byte
}
http2writePingAck
struct
#
type http2writePingAck struct {
pf *http2PingFrame
}
http2writePushPromise
struct
#
writePushPromise is a request to write a PUSH_PROMISE and 0+ CONTINUATION frames.
type http2writePushPromise struct {
streamID uint32
method string
url *url.URL
h Header
allocatePromisedID func() (uint32, error)
promisedID uint32
}
http2writeQueue
struct
#
writeQueue is used by implementations of WriteScheduler.
type http2writeQueue struct {
s []http2FrameWriteRequest
prev *http2writeQueue
next *http2writeQueue
}
http2writeSettingsAck
struct
#
type http2writeSettingsAck struct {
}
http2writeWindowUpdate
struct
#
type http2writeWindowUpdate struct {
streamID uint32
n uint32
}
httpRange
struct
#
httpRange specifies the byte range to be sent to the client.
type httpRange struct {
start int64
length int64
}
initALPNRequest
struct
#
initALPNRequest is an HTTP handler that initializes certain
uninitialized fields in its *Request. Such partially-initialized
Requests come from ALPN protocol handlers.
type initALPNRequest struct {
ctx context.Context
c *tls.Conn
h serverHandler
}
ioFS
struct
#
type ioFS struct {
fsys fs.FS
}
ioFile
struct
#
type ioFile struct {
file fs.File
}
keyValues
struct
#
type keyValues struct {
key string
values []string
}
loggingConn
struct
#
loggingConn is used for debugging.
type loggingConn struct {
name string
net.Conn
}
mapping
struct
#
A mapping is a collection of key-value pairs where the keys are unique.
A zero mapping is empty and ready to use.
A mapping tries to pick a representation that makes [mapping.find] most efficient.
type mapping struct {
s []*ast.IndexListExpr
m map[K]V
}
maskedSig
struct
#
type maskedSig struct {
mask []byte
pat []byte
skipWS bool
ct string
}
maxBytesReader
struct
#
type maxBytesReader struct {
w ResponseWriter
r io.ReadCloser
i int64
n int64
err error
}
mp4Sig
struct
#
type mp4Sig struct {
}
muxEntry
struct
#
type muxEntry struct {
h Handler
pattern string
}
noBody
struct
#
type noBody struct {
}
nothingWrittenError
struct
#
nothingWrittenError wraps a write errors which ended up writing zero bytes.
type nothingWrittenError struct {
error
}
onceCloseListener
struct
#
onceCloseListener wraps a net.Listener, protecting it from
multiple Close calls.
type onceCloseListener struct {
net.Listener
once sync.Once
closeErr error
}
pattern
struct
#
A pattern is something that can be matched against an HTTP request.
It has an optional method, an optional host, and a path.
type pattern struct {
str string
method string
host string
segments []segment
loc string
}
persistConn
struct
#
persistConn wraps a connection, usually a persistent one
(but may be used for non-keep-alive requests as well)
type persistConn struct {
alt RoundTripper
t *Transport
cacheKey connectMethodKey
conn net.Conn
tlsState *tls.ConnectionState
br *bufio.Reader
bw *bufio.Writer
nwrite int64
reqch chan requestAndChan
writech chan writeRequest
closech chan struct{...}
isProxy bool
sawEOF bool
readLimit int64
writeErrCh chan error
writeLoopDone chan struct{...}
idleAt time.Time
idleTimer *time.Timer
mu sync.Mutex
numExpectedResponses int
closed error
canceledErr error
broken bool
reused bool
mutateHeaderFunc func(Header)
}
persistConnWriter
struct
#
persistConnWriter is the io.Writer written to by pc.bw.
It accumulates the number of bytes written to the underlying conn,
so the retry logic can determine whether any bytes made it across
the wire.
This is exactly 1 pointer field wide so it can go into an interface
without allocation.
type persistConnWriter struct {
pc *persistConn
}
populateResponse
struct
#
populateResponse is a ResponseWriter that populates the *Response
in res, and writes its body to a pipe connected to the response
body. Once writes begin or finish() is called, the response is sent
on ch.
type populateResponse struct {
res *Response
ch chan *Response
wroteHeader bool
hasContent bool
sentResponse bool
pw *io.PipeWriter
}
readResult
struct
#
type readResult struct {
_ incomparable
n int
err error
b byte
}
readTrackingBody
struct
#
type readTrackingBody struct {
io.ReadCloser
didRead bool
didClose bool
}
readWriteCloserBody
struct
#
readWriteCloserBody is the Response.Body type used when we want to
give users write access to the Body through the underlying
connection (TCP, unless using custom dialers). This is then
the concrete type for a Response.Body on the 101 Switching
Protocols response, as used by WebSockets, h2c, etc.
type readWriteCloserBody struct {
_ incomparable
br *bufio.Reader
io.ReadWriteCloser
}
redirectHandler
struct
#
Redirect to a fixed URL
type redirectHandler struct {
url string
code int
}
requestAndChan
struct
#
type requestAndChan struct {
_ incomparable
treq *transportRequest
ch chan responseAndError
addedGzip bool
continueCh chan<- struct{...}
callerGone <-chan struct{...}
}
requestBodyReadError
struct
#
requestBodyReadError wraps an error from (*Request).write to indicate
that the error came from a Read call on the Request.Body.
This error type should not escape the net/http package to users.
type requestBodyReadError struct {
error
}
response
struct
#
A response represents the server side of an HTTP response.
type response struct {
conn *conn
req *Request
reqBody io.ReadCloser
cancelCtx context.CancelFunc
wroteHeader bool
wants10KeepAlive bool
wantsClose bool
writeContinueMu sync.Mutex
canWriteContinue atomic.Bool
w *bufio.Writer
cw chunkWriter
handlerHeader Header
calledHeader bool
written int64
contentLength int64
status int
closeAfterReply bool
fullDuplex bool
requestBodyLimitHit bool
trailers []string
handlerDone atomic.Bool
dateBuf [*ast.CallExpr]byte
clenBuf [10]byte
statusBuf [3]byte
closeNotifyCh chan bool
didCloseNotify atomic.Bool
}
responseAndError
struct
#
responseAndError is how the goroutine reading from an HTTP/1 server
communicates with the goroutine doing the RoundTrip.
type responseAndError struct {
_ incomparable
res *Response
err error
}
routingIndex
struct
#
A routingIndex optimizes conflict detection by indexing patterns.
The basic idea is to rule out patterns that cannot conflict with a given
pattern because they have a different literal in a corresponding segment.
See the comments in [routingIndex.possiblyConflictingPatterns] for more details.
type routingIndex struct {
segments map[routingIndexKey][]*pattern
multis []*pattern
}
routingIndexKey
struct
#
type routingIndexKey struct {
pos int
s string
}
routingNode
struct
#
A routingNode is a node in the decision tree.
The same struct is used for leaf and interior nodes.
type routingNode struct {
pattern *pattern
handler Handler
children *ast.IndexListExpr
multiChild *routingNode
emptyChild *routingNode
}
segment
struct
#
A segment is a pattern piece that matches one or more path segments, or
a trailing slash.
If wild is false, it matches a literal segment, or, if s == "/", a trailing slash.
Examples:
"a" => segment{s: "a"}
"/{$}" => segment{s: "/"}
If wild is true and multi is false, it matches a single path segment.
Example:
"{x}" => segment{s: "x", wild: true}
If both wild and multi are true, it matches all remaining path segments.
Example:
"{rest...}" => segment{s: "rest", wild: true, multi: true}
type segment struct {
s string
wild bool
multi bool
}
serveMux121
struct
#
serveMux121 holds the state of a ServeMux needed for Go 1.21 behavior.
type serveMux121 struct {
mu sync.RWMutex
m map[string]muxEntry
es []muxEntry
hosts bool
}
serverHandler
struct
#
serverHandler delegates to either the server's Handler or
DefaultServeMux and also handles "OPTIONS *" requests.
type serverHandler struct {
srv *Server
}
socksAddr
struct
#
An Addr represents a SOCKS-specific address.
Either Name or IP is used exclusively.
type socksAddr struct {
Name string
IP net.IP
Port int
}
socksConn
struct
#
A Conn represents a forward proxy connection.
type socksConn struct {
net.Conn
boundAddr net.Addr
}
socksDialer
struct
#
A Dialer holds SOCKS-specific options.
type socksDialer struct {
cmd socksCommand
proxyNetwork string
proxyAddress string
ProxyDial func(context.Context, string, string) (net.Conn, error)
AuthMethods []socksAuthMethod
Authenticate func(context.Context, io.ReadWriter, socksAuthMethod) error
}
socksUsernamePassword
struct
#
UsernamePassword are the credentials for the username/password
authentication method.
type socksUsernamePassword struct {
Username string
Password string
}
statusError
struct
#
statusError is an error used to respond to a request with an HTTP status.
The text should be plain text without user info or other embedded errors.
type statusError struct {
code int
text string
}
streamReader
struct
#
streamReader implements an io.ReadCloser wrapper for ReadableStream.
See https://fetch.spec.whatwg.org/#readablestream for more information.
type streamReader struct {
pending []byte
stream js.Value
err error
}
stringWriter
struct
#
stringWriter implements WriteString on a Writer.
type stringWriter struct {
w io.Writer
}
tLogKey
struct
#
tLogKey is a context WithValue key for test debugging contexts containing
a t.Logf func. See export_test.go's Request.WithT method.
type tLogKey struct {
}
textSig
struct
#
type textSig struct {
}
timeoutError
struct
#
httpTimeoutError represents a timeout.
It implements net.Error and wraps context.DeadlineExceeded.
type timeoutError struct {
err string
}
timeoutHandler
struct
#
type timeoutHandler struct {
handler Handler
body string
dt time.Duration
testContext context.Context
}
timeoutWriter
struct
#
type timeoutWriter struct {
w ResponseWriter
h Header
wbuf bytes.Buffer
req *Request
mu sync.Mutex
err error
wroteHeader bool
code int
}
tlsHandshakeTimeoutError
struct
#
type tlsHandshakeTimeoutError struct {
}
transferReader
struct
#
type transferReader struct {
Header Header
StatusCode int
RequestMethod string
ProtoMajor int
ProtoMinor int
Body io.ReadCloser
ContentLength int64
Chunked bool
Close bool
Trailer Header
}
transferWriter
struct
#
transferWriter inspects the fields of a user-supplied Request or Response,
sanitizes them without changing the user object and provides methods for
writing the respective header, body and trailer in wire format.
type transferWriter struct {
Method string
Body io.Reader
BodyCloser io.Closer
ResponseToHEAD bool
ContentLength int64
Close bool
TransferEncoding []string
Header Header
Trailer Header
IsResponse bool
bodyReadError error
FlushHeaders bool
ByteReadCh chan readResult
}
transportReadFromServerError
struct
#
transportReadFromServerError is used by Transport.readLoop when the
1 byte peek read fails and we're actually anticipating a response.
Usually this is just due to the inherent keep-alive shut down race,
where the server closed the connection at the same time the client
wrote. The underlying err field is usually io.EOF or some
ECONNRESET sort of thing which varies by platform. But it might be
the user's custom net.Conn.Read error too, so we carry it along for
them to return from Transport.RoundTrip.
type transportReadFromServerError struct {
err error
}
transportRequest
struct
#
transportRequest is a wrapper around a *Request that adds
optional extra headers to write and stores any error to return
from roundTrip.
type transportRequest struct {
*Request
extra Header
trace *httptrace.ClientTrace
ctx context.Context
cancel context.CancelCauseFunc
mu sync.Mutex
err error
}
unencryptedHTTP2Request
struct
#
unencryptedHTTP2Request is an HTTP handler that initializes
certain uninitialized fields in its *Request.
It's the unencrypted version of initALPNRequest.
type unencryptedHTTP2Request struct {
ctx context.Context
c net.Conn
h serverHandler
}
unencryptedNetConnInTLSConn
struct
#
unencryptedNetConnInTLSConn is used to pass an unencrypted net.Conn to
functions that only accept a *tls.Conn.
type unencryptedNetConnInTLSConn struct {
net.Conn
conn net.Conn
}
unsupportedTEError
struct
#
unsupportedTEError reports unsupported transfer-encodings.
type unsupportedTEError struct {
err string
}
wantConn
struct
#
A wantConn records state about a wanted connection
(that is, an active call to getConn).
The conn may be gotten by dialing or by finding an idle connection,
or a cancellation may make the conn no longer wanted.
These three options are racing against each other and use
wantConn to coordinate and agree about the winning outcome.
type wantConn struct {
cm connectMethod
key connectMethodKey
beforeDial func()
afterDial func()
mu sync.Mutex
ctx context.Context
cancelCtx context.CancelFunc
done bool
result chan connOrError
}
wantConnQueue
struct
#
A wantConnQueue is a queue of wantConns.
type wantConnQueue struct {
head []*wantConn
headPos int
tail []*wantConn
}
writeRequest
struct
#
A writeRequest is sent by the caller's goroutine to the
writeLoop's goroutine to write a request while the read loop
concurrently waits on both the write response and the server's
reply.
type writeRequest struct {
req *transportRequest
ch chan<- error
continueCh <-chan struct{...}
}
writerOnly
struct
#
writerOnly hides an io.Writer value's optional ReadFrom method
from io.Copy.
type writerOnly struct {
io.Writer
}
Functions
Add
method
#
Add adds the key, value pair to the header.
It appends to any existing values associated with key.
The key is case insensitive; it is canonicalized by
[CanonicalHeaderKey].
func (h Header) Add(key string, value string)
AddCookie
method
#
AddCookie adds a cookie to the request. Per RFC 6265 section 5.4,
AddCookie does not attach more than one [Cookie] header field. That
means all cookies, if any, are written into the same line,
separated by semicolon.
AddCookie only sanitizes c's name and value, and does not sanitize
a Cookie header already present in the request.
func (r *Request) AddCookie(c *Cookie)
AdjustStream
method
#
func (ws *http2priorityWriteScheduler) AdjustStream(streamID uint32, priority http2PriorityParam)
AdjustStream
method
#
func (ws *http2roundRobinWriteScheduler) AdjustStream(streamID uint32, priority http2PriorityParam)
AdjustStream
method
#
func (ws *http2randomWriteScheduler) AdjustStream(streamID uint32, priority http2PriorityParam)
AllowQuerySemicolons
function
#
AllowQuerySemicolons returns a handler that serves requests by converting any
unescaped semicolons in the URL query to ampersands, and invoking the handler h.
This restores the pre-Go 1.17 behavior of splitting query parameters on both
semicolons and ampersands. (See golang.org/issue/25192). Note that this
behavior doesn't match that of many proxies, and the mismatch can lead to
security issues.
AllowQuerySemicolons should be invoked before [Request.ParseForm] is called.
func AllowQuerySemicolons(h Handler) Handler
As
method
#
func (e http2StreamError) As(target any) bool
Authenticate
method
#
Authenticate authenticates a pair of username and password with the
proxy server.
func (up *socksUsernamePassword) Authenticate(ctx context.Context, rw io.ReadWriter, auth socksAuthMethod) error
Available
method
#
func (w *http2bufferedWriter) Available() int
BaseContext
method
#
func (h unencryptedHTTP2Request) BaseContext() context.Context
BaseContext
method
#
BaseContext is an exported but unadvertised [http.Handler] method
recognized by x/net/http2 to pass down a context; the TLSNextProto
API predates context support so we shoehorn through the only
interface we have available.
func (h initALPNRequest) BaseContext() context.Context
BasicAuth
method
#
BasicAuth returns the username and password provided in the request's
Authorization header, if the request uses HTTP Basic Authentication.
See RFC 2617, Section 2.
func (r *Request) BasicAuth() (username string, password string, ok bool)
BoundAddr
method
#
BoundAddr returns the address assigned by the proxy server for
connecting to the command target address from the proxy server.
func (c *socksConn) BoundAddr() net.Addr
BreakWithError
method
#
BreakWithError causes the next Read (waking up a current blocked
Read if needed) to return the provided err immediately, without
waiting for unread data.
func (p *http2pipe) BreakWithError(err error)
C
method
#
func (t http2timeTimer) C() (<-chan time.Time)
CanTakeNewRequest
method
#
CanTakeNewRequest reports whether the connection can take a new request,
meaning it has not been closed or received or sent a GOAWAY.
If the caller is going to immediately make a new request on this
connection, use ReserveNewRequest instead.
func (cc *http2ClientConn) CanTakeNewRequest() bool
CancelRequest
method
#
CancelRequest cancels an in-flight request by closing its connection.
CancelRequest should only be called after [Transport.RoundTrip] has returned.
Deprecated: Use [Request.WithContext] to create a request with a
cancelable context instead. CancelRequest cannot cancel HTTP/2
requests. This may become a no-op in a future release of Go.
func (t *Transport) CancelRequest(req *Request)
Clone
method
#
Clone returns a deep copy of r with its context changed to ctx.
The provided ctx must be non-nil.
Clone only makes a shallow copy of the Body field.
For an outgoing client request, the context controls the entire
lifetime of a request and its response: obtaining a connection,
sending the request, and reading the response headers and body.
func (r *Request) Clone(ctx context.Context) *Request
Clone
method
#
Clone returns a deep copy of t's exported fields.
func (t *Transport) Clone() *Transport
Clone
method
#
Clone returns a copy of h or nil if h is nil.
func (h Header) Clone() Header
Close
method
#
func (http2noBodyReader) Close() error
Close
method
#
func (b *body) Close() error
Close
method
#
func (noBody) Close() error
Close
method
#
func (gz *http2gzipReader) Close() error
Close
method
#
func (r *arrayReader) Close() error
Close
method
#
func (r *streamReader) Close() error
Close
method
#
func (l *maxBytesReader) Close() error
Close
method
#
func (oc *onceCloseListener) Close() error
Close
method
#
func (gz *gzipReader) Close() error
Close
method
#
func (c *loggingConn) Close() (err error)
Close
method
#
func (http2missingBody) Close() error
Close
method
#
func (f ioFile) Close() error
Close
method
#
func (ecr *expectContinueReader) Close() error
Close
method
#
func (es *bodyEOFSignal) Close() error
Close
method
#
Close immediately closes all active net.Listeners and any
connections in state [StateNew], [StateActive], or [StateIdle]. For a
graceful shutdown, use [Server.Shutdown].
Close does not attempt to close (and does not even know about)
any hijacked connections, such as WebSockets.
Close returns any error returned from closing the [Server]'s
underlying Listener(s).
func (s *Server) Close() error
Close
method
#
func (b *cancelTimerBody) Close() error
Close
method
#
func (b http2transportResponseBody) Close() error
Close
method
#
func (b *http2requestBody) Close() error
Close
method
#
func (r *readTrackingBody) Close() error
Close
method
#
Close closes the client connection immediately.
In-flight requests are interrupted. For a graceful shutdown, use Shutdown instead.
func (cc *http2ClientConn) Close() error
Close
method
#
Close marks the closeWaiter as closed and unblocks any waiters.
func (cw http2closeWaiter) Close()
CloseConn
method
#
func (sc *http2serverConn) CloseConn() error
CloseIdleConnections
method
#
CloseIdleConnections closes any connections which were previously
connected from previous requests but are now sitting idle in
a "keep-alive" state. It does not interrupt any connections currently
in use.
func (t *Transport) CloseIdleConnections()
CloseIdleConnections
method
#
func (*http2Transport) CloseIdleConnections()
CloseIdleConnections
method
#
CloseIdleConnections closes any connections which were previously
connected from previous requests but are now sitting idle.
It does not interrupt any connections currently in use.
func (t *http2Transport) CloseIdleConnections()
CloseIdleConnections
method
#
CloseIdleConnections closes any connections on its [Transport] which
were previously connected from previous requests but are now
sitting idle in a "keep-alive" state. It does not interrupt any
connections currently in use.
If [Client.Transport] does not have a [Client.CloseIdleConnections] method
then this method does nothing.
func (c *Client) CloseIdleConnections()
CloseNotify
method
#
func (w *response) CloseNotify() (<-chan bool)
CloseNotify
method
#
func (w *http2responseWriter) CloseNotify() (<-chan bool)
CloseStream
method
#
func (ws *http2priorityWriteScheduler) CloseStream(streamID uint32)
CloseStream
method
#
func (ws *http2roundRobinWriteScheduler) CloseStream(streamID uint32)
CloseStream
method
#
func (ws *http2randomWriteScheduler) CloseStream(streamID uint32)
CloseWithError
method
#
CloseWithError causes the next Read (waking up a current blocked
Read if needed) to return the provided err after all data has been
read.
The error must be non-nil.
func (p *http2pipe) CloseWithError(err error)
Consume
method
#
Consume consumes min(n, available) bytes from this frame, where available
is the number of flow control bytes available on the stream. Consume returns
0, 1, or 2 frames, where the integer return value gives the number of frames
returned.
If flow control prevents consuming any bytes, this returns (_, _, 0). If
the entire frame was consumed, this returns (wr, _, 1). Otherwise, this
returns (consumed, rest, 2), where 'consumed' contains the consumed bytes and
'rest' contains the remaining bytes. The consumed bytes are deducted from the
underlying stream's flow control budget.
func (wr http2FrameWriteRequest) Consume(n int32) (http2FrameWriteRequest, http2FrameWriteRequest, int)
Context
method
#
Context returns the request's context. To change the context, use
[Request.Clone] or [Request.WithContext].
The returned context is always non-nil; it defaults to the
background context.
For outgoing client requests, the context controls cancellation.
For incoming server requests, the context is canceled when the
client's connection closes, the request is canceled (with HTTP/2),
or when the ServeHTTP method returns.
func (r *Request) Context() context.Context
Cookie
method
#
Cookie returns the named cookie provided in the request or
[ErrNoCookie] if not found.
If multiple cookies match the given name, only one cookie will
be returned.
func (r *Request) Cookie(name string) (*Cookie, error)
Cookies
method
#
Cookies parses and returns the HTTP cookies sent with the request.
func (r *Request) Cookies() []*Cookie
Cookies
method
#
Cookies parses and returns the cookies set in the Set-Cookie headers.
func (r *Response) Cookies() []*Cookie
CookiesNamed
method
#
CookiesNamed parses and returns the named HTTP cookies sent with the request
or an empty slice if none matched.
func (r *Request) CookiesNamed(name string) []*Cookie
Data
method
#
Data returns the frame's data octets, not including any padding
size byte or padding suffix bytes.
The caller must not retain the returned memory past the next
call to ReadFrame.
func (f *http2DataFrame) Data() []byte
DataSize
method
#
DataSize returns the number of flow control bytes that must be consumed
to write this entire frame. This is 0 for non-DATA frames.
func (wr http2FrameWriteRequest) DataSize() int
DebugData
method
#
DebugData returns any debug data in the GOAWAY frame. Its contents
are not defined.
The caller must not retain the returned memory past the next
call to ReadFrame.
func (f *http2GoAwayFrame) DebugData() []byte
Del
method
#
Del deletes the values associated with key.
The key is case insensitive; it is canonicalized by
[CanonicalHeaderKey].
func (h Header) Del(key string)
DetectContentType
function
#
DetectContentType implements the algorithm described
at https://mimesniff.spec.whatwg.org/ to determine the
Content-Type of the given data. It considers at most the
first 512 bytes of data. DetectContentType always returns
a valid MIME type: if it cannot determine a more specific one, it
returns "application/octet-stream".
func DetectContentType(data []byte) string
Dial
method
#
Dial connects to the provided address on the provided network.
Unlike DialContext, it returns a raw transport connection instead
of a forward proxy connection.
Deprecated: Use DialContext or DialWithConn instead.
func (d *socksDialer) Dial(network string, address string) (net.Conn, error)
DialContext
method
#
DialContext connects to the provided address on the provided
network.
The returned error value may be a net.OpError. When the Op field of
net.OpError contains "socks", the Source field contains a proxy
server address and the Addr field contains a command target
address.
See func Dial of the net package of standard library for a
description of the network and address parameters.
func (d *socksDialer) DialContext(ctx context.Context, network string, address string) (net.Conn, error)
DialWithConn
method
#
DialWithConn initiates a connection from SOCKS server to the target
network and address using the connection c that is already
connected to the SOCKS server.
It returns the connection's local address assigned by the SOCKS
server.
func (d *socksDialer) DialWithConn(ctx context.Context, c net.Conn, network string, address string) (net.Addr, error)
Do
method
#
Do sends an HTTP request and returns an HTTP response, following
policy (such as redirects, cookies, auth) as configured on the
client.
An error is returned if caused by client policy (such as
CheckRedirect), or failure to speak HTTP (such as a network
connectivity problem). A non-2xx status code doesn't cause an
error.
If the returned error is nil, the [Response] will contain a non-nil
Body which the user is expected to close. If the Body is not both
read to EOF and closed, the [Client]'s underlying [RoundTripper]
(typically [Transport]) may not be able to re-use a persistent TCP
connection to the server for a subsequent "keep-alive" request.
The request Body, if non-nil, will be closed by the underlying
Transport, even on errors. The Body may be closed asynchronously after
Do returns.
On error, any Response can be ignored. A non-nil Response with a
non-nil error only occurs when CheckRedirect fails, and even then
the returned [Response.Body] is already closed.
Generally [Get], [Post], or [PostForm] will be used instead of Do.
If the server replies with a redirect, the Client first uses the
CheckRedirect function to determine whether the redirect should be
followed. If permitted, a 301, 302, or 303 redirect causes
subsequent requests to use HTTP method GET
(or HEAD if the original request was HEAD), with no body.
A 307 or 308 redirect preserves the original HTTP method and body,
provided that the [Request.GetBody] function is defined.
The [NewRequest] function automatically sets GetBody for common
standard library body types.
Any returned error will be of type [*url.Error]. The url.Error
value's Timeout method will report true if the request timed out.
func (c *Client) Do(req *Request) (*Response, error)
Done
method
#
Done returns a channel which is closed if and when this pipe is closed
with CloseWithError.
func (p *http2pipe) Done() (<-chan struct{...})
EnableFullDuplex
method
#
func (c *response) EnableFullDuplex() error
EnableFullDuplex
method
#
EnableFullDuplex indicates that the request handler will interleave reads from [Request.Body]
with writes to the [ResponseWriter].
For HTTP/1 requests, the Go HTTP server by default consumes any unread portion of
the request body before beginning to write the response, preventing handlers from
concurrently reading from the request and writing the response.
Calling EnableFullDuplex disables this behavior and permits handlers to continue to read
from the request while concurrently writing the response.
For HTTP/2 requests, the Go HTTP server always permits concurrent reads and responses.
func (c *ResponseController) EnableFullDuplex() error
EnableFullDuplex
method
#
func (w *http2responseWriter) EnableFullDuplex() error
Err
method
#
Err returns the error (if any) first set by BreakWithError or CloseWithError.
func (p *http2pipe) Err() error
Error
method
#
func (e transportReadFromServerError) Error() string
Error
method
#
func (e http2headerFieldNameError) Error() string
Error
method
#
func (e http2pseudoHeaderError) Error() string
Error
method
#
func (http2goAwayFlowError) Error() string
Error
method
#
func (e http2StreamError) Error() string
Error
method
#
func (e http2connError) Error() string
Error
method
#
func (e http2ConnectionError) Error() string
Error
method
#
func (http2noCachedConnError) Error() string
Error
method
#
func (uste *unsupportedTEError) Error() string
Error
method
#
func (e *MaxBytesError) Error() string
Error
method
#
func (e *http2httpError) Error() string
Error
method
#
func (pe *ProtocolError) Error() string
Error
method
#
func (tlsHandshakeTimeoutError) Error() string
Error
method
#
func (e http2duplicatePseudoHeaderError) Error() string
Error
method
#
func (http2noCachedConnError) Error() string
Error
method
#
func (e *timeoutError) Error() string
Error
method
#
func (e http2headerFieldValueError) Error() string
Error
method
#
func (e statusError) Error() string
Error
function
#
Error replies to the request with the specified error message and HTTP code.
It does not otherwise end the request; the caller should ensure no further
writes are done to w.
The error message should be plain text.
Error deletes the Content-Length header,
sets Content-Type to “text/plain; charset=utf-8”,
and sets X-Content-Type-Options to “nosniff”.
This configures the header properly for the error message,
in case the caller had set it up expecting a successful output.
func Error(w ResponseWriter, error string, code int)
Error
method
#
func (e http2GoAwayError) Error() string
ErrorDetail
method
#
ErrorDetail returns a more detailed error of the last error
returned by Framer.ReadFrame. For instance, if ReadFrame
returns a StreamError with code PROTOCOL_ERROR, ErrorDetail
will say exactly what was invalid. ErrorDetail is not guaranteed
to return a non-nil value and like the rest of the http2 package,
its return value is not protected by an API compatibility promise.
ErrorDetail is reset after the next call to ReadFrame.
func (fr *http2Framer) ErrorDetail() error
FS
function
#
FS converts fsys to a [FileSystem] implementation,
for use with [FileServer] and [NewFileTransport].
The files provided by fsys must implement [io.Seeker].
func FS(fsys fs.FS) FileSystem
FileServer
function
#
FileServer returns a handler that serves HTTP requests
with the contents of the file system rooted at root.
As a special case, the returned file server redirects any request
ending in "/index.html" to the same path, without the final
"index.html".
To use the operating system's file system implementation,
use [http.Dir]:
http.Handle("/", http.FileServer(http.Dir("/tmp")))
To use an [fs.FS] implementation, use [http.FileServerFS] instead.
func FileServer(root FileSystem) Handler
FileServerFS
function
#
FileServerFS returns a handler that serves HTTP requests
with the contents of the file system fsys.
The files provided by fsys must implement [io.Seeker].
As a special case, the returned file server redirects any request
ending in "/index.html" to the same path, without the final
"index.html".
http.Handle("/", http.FileServerFS(fsys))
func FileServerFS(root fs.FS) Handler
Flush
method
#
func (w *http2bufferedWriter) Flush() error
Flush
method
#
func (sc *http2serverConn) Flush() error
Flush
method
#
func (w *response) Flush()
Flush
method
#
Flush flushes buffered data to the client.
func (c *ResponseController) Flush() error
Flush
method
#
func (w *http2responseWriter) Flush()
FlushError
method
#
func (w *response) FlushError() error
FlushError
method
#
func (w *http2responseWriter) FlushError() error
ForeachSetting
method
#
ForeachSetting runs fn for each setting.
It stops and returns the first error.
func (f *http2SettingsFrame) ForeachSetting(fn func(http2Setting) error) error
FormFile
method
#
FormFile returns the first file for the provided form key.
FormFile calls [Request.ParseMultipartForm] and [Request.ParseForm] if necessary.
func (r *Request) FormFile(key string) (multipart.File, *multipart.FileHeader, error)
FormValue
method
#
FormValue returns the first value for the named component of the query.
The precedence order:
1. application/x-www-form-urlencoded form body (POST, PUT, PATCH only)
2. query parameters (always)
3. multipart/form-data form body (always)
FormValue calls [Request.ParseMultipartForm] and [Request.ParseForm]
if necessary and ignores any errors returned by these functions.
If key is not present, FormValue returns the empty string.
To access multiple values of the same key, call ParseForm and
then inspect [Request.Form] directly.
func (r *Request) FormValue(key string) string
Framer
method
#
func (sc *http2serverConn) Framer() *http2Framer
Get
method
#
Get issues a GET to the specified URL. If the response is one of the
following redirect codes, Get follows the redirect after calling the
[Client.CheckRedirect] function:
301 (Moved Permanently)
302 (Found)
303 (See Other)
307 (Temporary Redirect)
308 (Permanent Redirect)
An error is returned if the [Client.CheckRedirect] function fails
or if there was an HTTP protocol error. A non-2xx response doesn't
cause an error. Any returned error will be of type [*url.Error]. The
url.Error value's Timeout method will report true if the request
timed out.
When err is nil, resp always contains a non-nil resp.Body.
Caller should close resp.Body when done reading from it.
To make a request with custom headers, use [NewRequest] and [Client.Do].
To make a request with a specified context.Context, use [NewRequestWithContext]
and Client.Do.
func (c *Client) Get(url string) (resp *Response, err error)
Get
function
#
Get issues a GET to the specified URL. If the response is one of
the following redirect codes, Get follows the redirect, up to a
maximum of 10 redirects:
301 (Moved Permanently)
302 (Found)
303 (See Other)
307 (Temporary Redirect)
308 (Permanent Redirect)
An error is returned if there were too many redirects or if there
was an HTTP protocol error. A non-2xx response doesn't cause an
error. Any returned error will be of type [*url.Error]. The url.Error
value's Timeout method will report true if the request timed out.
When err is nil, resp always contains a non-nil resp.Body.
Caller should close resp.Body when done reading from it.
Get is a wrapper around DefaultClient.Get.
To make a request with custom headers, use [NewRequest] and
DefaultClient.Do.
To make a request with a specified context.Context, use [NewRequestWithContext]
and DefaultClient.Do.
func Get(url string) (resp *Response, err error)
Get
method
#
Get gets the first value associated with the given key. If
there are no values associated with the key, Get returns "".
It is case insensitive; [textproto.CanonicalMIMEHeaderKey] is
used to canonicalize the provided key. Get assumes that all
keys are stored in canonical form. To use non-canonical keys,
access the map directly.
func (h Header) Get(key string) string
GetClientConn
method
#
func (p http2noDialClientConnPool) GetClientConn(req *Request, addr string) (*http2ClientConn, error)
GetClientConn
method
#
func (p *http2clientConnPool) GetClientConn(req *Request, addr string) (*http2ClientConn, error)
HTTP1
method
#
HTTP1 reports whether p includes HTTP/1.
func (p Protocols) HTTP1() bool
HTTP2
method
#
HTTP2 reports whether p includes HTTP/2.
func (p Protocols) HTTP2() bool
Handle
function
#
Handle registers the handler for the given pattern in [DefaultServeMux].
The documentation for [ServeMux] explains how patterns are matched.
func Handle(pattern string, handler Handler)
Handle
method
#
Handle registers the handler for the given pattern.
If the given pattern conflicts, with one that is already registered, Handle
panics.
func (mux *ServeMux) Handle(pattern string, handler Handler)
HandleFunc
method
#
HandleFunc registers the handler function for the given pattern.
If the given pattern conflicts, with one that is already registered, HandleFunc
panics.
func (mux *ServeMux) HandleFunc(pattern string, handler func(ResponseWriter, *Request))
HandleFunc
function
#
HandleFunc registers the handler function for the given pattern in [DefaultServeMux].
The documentation for [ServeMux] explains how patterns are matched.
func HandleFunc(pattern string, handler func(ResponseWriter, *Request))
Handler
method
#
Handler returns the handler to use for the given request,
consulting r.Method, r.Host, and r.URL.Path. It always returns
a non-nil handler. If the path is not in its canonical form, the
handler will be an internally-generated handler that redirects
to the canonical path. If the host contains a port, it is ignored
when matching handlers.
The path and host are used unchanged for CONNECT requests.
Handler also returns the registered pattern that matches the
request or, in the case of internally-generated redirects,
the path that will match after following the redirect.
If there is no registered handler that applies to the request,
Handler returns a “page not found” handler and an empty pattern.
func (mux *ServeMux) Handler(r *Request) (h Handler, pattern string)
Has
method
#
Has reports whether f contains all (0 or more) flags in v.
func (f http2Flags) Has(v http2Flags) bool
HasDuplicates
method
#
HasDuplicates reports whether f contains any duplicate setting IDs.
func (f *http2SettingsFrame) HasDuplicates() bool
HasPriority
method
#
func (f *http2HeadersFrame) HasPriority() bool
Head
function
#
Head issues a HEAD to the specified URL. If the response is one of
the following redirect codes, Head follows the redirect, up to a
maximum of 10 redirects:
301 (Moved Permanently)
302 (Found)
303 (See Other)
307 (Temporary Redirect)
308 (Permanent Redirect)
Head is a wrapper around DefaultClient.Head.
To make a request with a specified [context.Context], use [NewRequestWithContext]
and DefaultClient.Do.
func Head(url string) (resp *Response, err error)
Head
method
#
Head issues a HEAD to the specified URL. If the response is one of the
following redirect codes, Head follows the redirect after calling the
[Client.CheckRedirect] function:
301 (Moved Permanently)
302 (Found)
303 (See Other)
307 (Temporary Redirect)
308 (Permanent Redirect)
To make a request with a specified [context.Context], use [NewRequestWithContext]
and [Client.Do].
func (c *Client) Head(url string) (resp *Response, err error)
Hijack
method
#
Hijack lets the caller take over the connection.
See the Hijacker interface for details.
func (c *ResponseController) Hijack() (net.Conn, *bufio.ReadWriter, error)
Hijack
method
#
Hijack implements the [Hijacker.Hijack] method. Our response is both a [ResponseWriter]
and a [Hijacker].
func (w *response) Hijack() (rwc net.Conn, buf *bufio.ReadWriter, err error)
Init
method
#
Init makes a closeWaiter usable.
It exists because so a closeWaiter value can be placed inside a
larger struct and have the Mutex and Cond's memory in the same
allocation.
func (cw *http2closeWaiter) Init()
Is
method
#
func (e *timeoutError) Is(err error) bool
Is
method
#
Is lets http.ErrNotSupported match errors.ErrUnsupported.
func (pe *ProtocolError) Is(err error) bool
IsAck
method
#
func (f *http2SettingsFrame) IsAck() bool
IsAck
method
#
func (f *http2PingFrame) IsAck() bool
IsHTTP2NoCachedConnError
method
#
func (http2noCachedConnError) IsHTTP2NoCachedConnError()
IsHTTP2NoCachedConnError
method
#
func (http2noCachedConnError) IsHTTP2NoCachedConnError()
IsZero
method
#
func (p http2PriorityParam) IsZero() bool
Keys
method
#
Keys returns the sorted keys of h.
The returned slice is only valid until s used again or returned to
its pool.
func (s *http2sorter) Keys(h Header) []string
Len
method
#
Len returns the number of bytes of the unread portion of the buffer.
func (b *http2dataBuffer) Len() int
Len
method
#
func (z http2sortPriorityNodeSiblings) Len() int
Len
method
#
func (p *http2pipe) Len() int
Len
method
#
func (s *http2sorter) Len() int
Less
method
#
func (s *http2sorter) Less(i int, j int) bool
Less
method
#
func (z http2sortPriorityNodeSiblings) Less(i int, k int) bool
ListenAndServe
method
#
ListenAndServe listens on the TCP network address s.Addr and then
calls [Serve] to handle requests on incoming connections.
Accepted connections are configured to enable TCP keep-alives.
If s.Addr is blank, ":http" is used.
ListenAndServe always returns a non-nil error. After [Server.Shutdown] or [Server.Close],
the returned error is [ErrServerClosed].
func (s *Server) ListenAndServe() error
ListenAndServe
function
#
ListenAndServe listens on the TCP network address addr and then calls
[Serve] with handler to handle requests on incoming connections.
Accepted connections are configured to enable TCP keep-alives.
The handler is typically nil, in which case [DefaultServeMux] is used.
ListenAndServe always returns a non-nil error.
func ListenAndServe(addr string, handler Handler) error
ListenAndServeTLS
function
#
ListenAndServeTLS acts identically to [ListenAndServe], except that it
expects HTTPS connections. Additionally, files containing a certificate and
matching private key for the server must be provided. If the certificate
is signed by a certificate authority, the certFile should be the concatenation
of the server's certificate, any intermediates, and the CA's certificate.
func ListenAndServeTLS(addr string, certFile string, keyFile string, handler Handler) error
ListenAndServeTLS
method
#
ListenAndServeTLS listens on the TCP network address s.Addr and
then calls [ServeTLS] to handle requests on incoming TLS connections.
Accepted connections are configured to enable TCP keep-alives.
Filenames containing a certificate and matching private key for the
server must be provided if neither the [Server]'s TLSConfig.Certificates
nor TLSConfig.GetCertificate are populated. If the certificate is
signed by a certificate authority, the certFile should be the
concatenation of the server's certificate, any intermediates, and
the CA's certificate.
If s.Addr is blank, ":https" is used.
ListenAndServeTLS always returns a non-nil error. After [Server.Shutdown] or
[Server.Close], the returned error is [ErrServerClosed].
func (s *Server) ListenAndServeTLS(certFile string, keyFile string) error
Location
method
#
Location returns the URL of the response's "Location" header,
if present. Relative redirects are resolved relative to
[Response.Request]. [ErrNoLocation] is returned if no
Location header is present.
func (r *Response) Location() (*url.URL, error)
Lock
method
#
func (fakeLocker) Lock()
MarkDead
method
#
func (p *http2clientConnPool) MarkDead(cc *http2ClientConn)
MaxBytesHandler
function
#
MaxBytesHandler returns a [Handler] that runs h with its [ResponseWriter] and [Request.Body] wrapped by a MaxBytesReader.
func MaxBytesHandler(h Handler, n int64) Handler
MaxBytesReader
function
#
MaxBytesReader is similar to [io.LimitReader] but is intended for
limiting the size of incoming request bodies. In contrast to
io.LimitReader, MaxBytesReader's result is a ReadCloser, returns a
non-nil error of type [*MaxBytesError] for a Read beyond the limit,
and closes the underlying reader when its Close method is called.
MaxBytesReader prevents clients from accidentally or maliciously
sending a large request and wasting server resources. If possible,
it tells the [ResponseWriter] to close the connection after the limit
has been reached.
func MaxBytesReader(w ResponseWriter, r io.ReadCloser, n int64) io.ReadCloser
MultipartReader
method
#
MultipartReader returns a MIME multipart reader if this is a
multipart/form-data or a multipart/mixed POST request, else returns nil and an error.
Use this function instead of [Request.ParseMultipartForm] to
process the request body as a stream.
func (r *Request) MultipartReader() (*multipart.Reader, error)
Network
method
#
func (a *socksAddr) Network() string
NewClientConn
method
#
func (t *http2Transport) NewClientConn(c net.Conn) (*http2ClientConn, error)
NewFileTransport
function
#
NewFileTransport returns a new [RoundTripper], serving the provided
[FileSystem]. The returned RoundTripper ignores the URL host in its
incoming requests, as well as most other properties of the
request.
The typical use case for NewFileTransport is to register the "file"
protocol with a [Transport], as in:
t := &http.Transport{}
t.RegisterProtocol("file", http.NewFileTransport(http.Dir("/")))
c := &http.Client{Transport: t}
res, err := c.Get("file:///etc/passwd")
...
func NewFileTransport(fs FileSystem) RoundTripper
NewFileTransportFS
function
#
NewFileTransportFS returns a new [RoundTripper], serving the provided
file system fsys. The returned RoundTripper ignores the URL host in its
incoming requests, as well as most other properties of the
request. The files provided by fsys must implement [io.Seeker].
The typical use case for NewFileTransportFS is to register the "file"
protocol with a [Transport], as in:
fsys := os.DirFS("/")
t := &http.Transport{}
t.RegisterProtocol("file", http.NewFileTransportFS(fsys))
c := &http.Client{Transport: t}
res, err := c.Get("file:///etc/passwd")
...
func NewFileTransportFS(fsys fs.FS) RoundTripper
NewRequest
function
#
NewRequest wraps [NewRequestWithContext] using [context.Background].
func NewRequest(method string, url string, body io.Reader) (*Request, error)
NewRequestWithContext
function
#
NewRequestWithContext returns a new [Request] given a method, URL, and
optional body.
If the provided body is also an [io.Closer], the returned
[Request.Body] is set to body and will be closed (possibly
asynchronously) by the Client methods Do, Post, and PostForm,
and [Transport.RoundTrip].
NewRequestWithContext returns a Request suitable for use with
[Client.Do] or [Transport.RoundTrip]. To create a request for use with
testing a Server Handler, either use the [net/http/httptest.NewRequest] function,
use [ReadRequest], or manually update the Request fields.
For an outgoing client request, the context
controls the entire lifetime of a request and its response:
obtaining a connection, sending the request, and reading the
response headers and body. See the Request type's documentation for
the difference between inbound and outbound request fields.
If body is of type [*bytes.Buffer], [*bytes.Reader], or
[*strings.Reader], the returned request's ContentLength is set to its
exact value (instead of -1), GetBody is populated (so 307 and 308
redirects can replay the body), and Body is set to [NoBody] if the
ContentLength is 0.
func NewRequestWithContext(ctx context.Context, method string, url string, body io.Reader) (*Request, error)
NewResponseController
function
#
NewResponseController creates a [ResponseController] for a request.
The ResponseWriter should be the original value passed to the [Handler.ServeHTTP] method,
or have an Unwrap method returning the original ResponseWriter.
If the ResponseWriter implements any of the following methods, the ResponseController
will call them as appropriate:
Flush()
FlushError() error // alternative Flush returning an error
Hijack() (net.Conn, *bufio.ReadWriter, error)
SetReadDeadline(deadline time.Time) error
SetWriteDeadline(deadline time.Time) error
EnableFullDuplex() error
If the ResponseWriter does not support a method, ResponseController returns
an error matching [ErrNotSupported].
func NewResponseController(rw ResponseWriter) *ResponseController
NewServeMux
function
#
NewServeMux allocates and returns a new [ServeMux].
func NewServeMux() *ServeMux
NotFound
function
#
NotFound replies to the request with an HTTP 404 not found error.
func NotFound(w ResponseWriter, r *Request)
NotFoundHandler
function
#
NotFoundHandler returns a simple request handler
that replies to each request with a “404 page not found” reply.
func NotFoundHandler() Handler
NumSettings
method
#
func (f *http2SettingsFrame) NumSettings() int
Open
method
#
Open implements [FileSystem] using [os.Open], opening files for reading rooted
and relative to the directory d.
func (d Dir) Open(name string) (File, error)
Open
method
#
func (f ioFS) Open(name string) (File, error)
OpenStream
method
#
func (ws *http2priorityWriteScheduler) OpenStream(streamID uint32, options http2OpenStreamOptions)
OpenStream
method
#
func (ws *http2randomWriteScheduler) OpenStream(streamID uint32, options http2OpenStreamOptions)
OpenStream
method
#
func (ws *http2roundRobinWriteScheduler) OpenStream(streamID uint32, options http2OpenStreamOptions)
ParseCookie
function
#
ParseCookie parses a Cookie header value and returns all the cookies
which were set in it. Since the same cookie name can appear multiple times
the returned Values can contain more than one value for a given key.
func ParseCookie(line string) ([]*Cookie, error)
ParseForm
method
#
ParseForm populates r.Form and r.PostForm.
For all requests, ParseForm parses the raw query from the URL and updates
r.Form.
For POST, PUT, and PATCH requests, it also reads the request body, parses it
as a form and puts the results into both r.PostForm and r.Form. Request body
parameters take precedence over URL query string values in r.Form.
If the request Body's size has not already been limited by [MaxBytesReader],
the size is capped at 10MB.
For other HTTP methods, or when the Content-Type is not
application/x-www-form-urlencoded, the request Body is not read, and
r.PostForm is initialized to a non-nil, empty value.
[Request.ParseMultipartForm] calls ParseForm automatically.
ParseForm is idempotent.
func (r *Request) ParseForm() error
ParseHTTPVersion
function
#
ParseHTTPVersion parses an HTTP version string according to RFC 7230, section 2.6.
"HTTP/1.0" returns (1, 0, true). Note that strings without
a minor version, such as "HTTP/2", are not valid.
func ParseHTTPVersion(vers string) (major int, minor int, ok bool)
ParseMultipartForm
method
#
ParseMultipartForm parses a request body as multipart/form-data.
The whole request body is parsed and up to a total of maxMemory bytes of
its file parts are stored in memory, with the remainder stored on
disk in temporary files.
ParseMultipartForm calls [Request.ParseForm] if necessary.
If ParseForm returns an error, ParseMultipartForm returns it but also
continues parsing the request body.
After one call to ParseMultipartForm, subsequent calls have no effect.
func (r *Request) ParseMultipartForm(maxMemory int64) error
ParseSetCookie
function
#
ParseSetCookie parses a Set-Cookie header value and returns a cookie.
It returns an error on syntax error.
func ParseSetCookie(line string) (*Cookie, error)
ParseTime
function
#
ParseTime parses a time header (such as the Date: header),
trying each of the three formats allowed by HTTP/1.1:
[TimeFormat], [time.RFC850], and [time.ANSIC].
func ParseTime(text string) (t time.Time, err error)
PathValue
method
#
PathValue returns the value for the named path wildcard in the [ServeMux] pattern
that matched the request.
It returns the empty string if the request was not matched against a pattern
or there is no such wildcard in the pattern.
func (r *Request) PathValue(name string) string
Payload
method
#
Payload returns the frame's payload (after the header). It is not
valid to call this method after a subsequent call to
Framer.ReadFrame, nor is it valid to retain the returned slice.
The memory is owned by the Framer and is invalidated when the next
frame is read.
func (f *http2UnknownFrame) Payload() []byte
Ping
method
#
Ping sends a PING frame to the server and waits for the ack.
func (cc *http2ClientConn) Ping(ctx context.Context) error
Pop
method
#
func (ws *http2randomWriteScheduler) Pop() (http2FrameWriteRequest, bool)
Pop
method
#
func (ws *http2priorityWriteScheduler) Pop() (wr http2FrameWriteRequest, ok bool)
Pop
method
#
func (ws *http2roundRobinWriteScheduler) Pop() (http2FrameWriteRequest, bool)
Post
method
#
Post issues a POST to the specified URL.
Caller should close resp.Body when done reading from it.
If the provided body is an [io.Closer], it is closed after the
request.
To set custom headers, use [NewRequest] and [Client.Do].
To make a request with a specified context.Context, use [NewRequestWithContext]
and [Client.Do].
See the Client.Do method documentation for details on how redirects
are handled.
func (c *Client) Post(url string, contentType string, body io.Reader) (resp *Response, err error)
Post
function
#
Post issues a POST to the specified URL.
Caller should close resp.Body when done reading from it.
If the provided body is an [io.Closer], it is closed after the
request.
Post is a wrapper around DefaultClient.Post.
To set custom headers, use [NewRequest] and DefaultClient.Do.
See the [Client.Do] method documentation for details on how redirects
are handled.
To make a request with a specified context.Context, use [NewRequestWithContext]
and DefaultClient.Do.
func Post(url string, contentType string, body io.Reader) (resp *Response, err error)
PostForm
function
#
PostForm issues a POST to the specified URL, with data's keys and
values URL-encoded as the request body.
The Content-Type header is set to application/x-www-form-urlencoded.
To set other headers, use [NewRequest] and DefaultClient.Do.
When err is nil, resp always contains a non-nil resp.Body.
Caller should close resp.Body when done reading from it.
PostForm is a wrapper around DefaultClient.PostForm.
See the [Client.Do] method documentation for details on how redirects
are handled.
To make a request with a specified [context.Context], use [NewRequestWithContext]
and DefaultClient.Do.
func PostForm(url string, data url.Values) (resp *Response, err error)
PostForm
method
#
PostForm issues a POST to the specified URL,
with data's keys and values URL-encoded as the request body.
The Content-Type header is set to application/x-www-form-urlencoded.
To set other headers, use [NewRequest] and [Client.Do].
When err is nil, resp always contains a non-nil resp.Body.
Caller should close resp.Body when done reading from it.
See the Client.Do method documentation for details on how redirects
are handled.
To make a request with a specified context.Context, use [NewRequestWithContext]
and Client.Do.
func (c *Client) PostForm(url string, data url.Values) (resp *Response, err error)
PostFormValue
method
#
PostFormValue returns the first value for the named component of the POST,
PUT, or PATCH request body. URL query parameters are ignored.
PostFormValue calls [Request.ParseMultipartForm] and [Request.ParseForm] if necessary and ignores
any errors returned by these functions.
If key is not present, PostFormValue returns the empty string.
func (r *Request) PostFormValue(key string) string
ProtoAtLeast
method
#
ProtoAtLeast reports whether the HTTP protocol used
in the request is at least major.minor.
func (r *Request) ProtoAtLeast(major int, minor int) bool
ProtoAtLeast
method
#
ProtoAtLeast reports whether the HTTP protocol used
in the response is at least major.minor.
func (r *Response) ProtoAtLeast(major int, minor int) bool
ProxyFromEnvironment
function
#
ProxyFromEnvironment returns the URL of the proxy to use for a
given request, as indicated by the environment variables
HTTP_PROXY, HTTPS_PROXY and NO_PROXY (or the lowercase versions
thereof). Requests use the proxy from the environment variable
matching their scheme, unless excluded by NO_PROXY.
The environment values may be either a complete URL or a
"host[:port]", in which case the "http" scheme is assumed.
An error is returned if the value is a different form.
A nil URL and nil error are returned if no proxy is defined in the
environment, or a proxy should not be used for the given request,
as defined by NO_PROXY.
As a special case, if req.URL.Host is "localhost" (with or without
a port number), then a nil URL and nil error will be returned.
func ProxyFromEnvironment(req *Request) (*url.URL, error)
ProxyURL
function
#
ProxyURL returns a proxy function (for use in a [Transport])
that always returns the same URL.
func ProxyURL(fixedURL *url.URL) (func(*Request) (*url.URL, error))
PseudoFields
method
#
PseudoFields returns the pseudo header fields of mh.
The caller does not own the returned slice.
func (mh *http2MetaHeadersFrame) PseudoFields() []hpack.HeaderField
PseudoValue
method
#
PseudoValue returns the given pseudo header field's value.
The provided pseudo field should not contain the leading colon.
func (mh *http2MetaHeadersFrame) PseudoValue(pseudo string) string
Push
method
#
func (w *http2responseWriter) Push(target string, opts *PushOptions) error
Push
method
#
func (ws *http2priorityWriteScheduler) Push(wr http2FrameWriteRequest)
Push
method
#
Push implements the [Pusher] interface.
func (tw *timeoutWriter) Push(target string, opts *PushOptions) error
Push
method
#
func (ws *http2randomWriteScheduler) Push(wr http2FrameWriteRequest)
Push
method
#
func (ws *http2roundRobinWriteScheduler) Push(wr http2FrameWriteRequest)
Read
method
#
func (bl bodyLocked) Read(p []byte) (n int, err error)
Read
method
#
func (r *streamReader) Read(p []byte) (n int, err error)
Read
method
#
func (b *readWriteCloserBody) Read(p []byte) (n int, err error)
Read
method
#
func (es *bodyEOFSignal) Read(p []byte) (n int, err error)
Read
method
#
func (gz *gzipReader) Read(p []byte) (n int, err error)
Read
method
#
func (r errorReader) Read(p []byte) (n int, err error)
Read
method
#
func (br *byteReader) Read(p []byte) (n int, err error)
Read
method
#
func (pc *persistConn) Read(p []byte) (n int, err error)
Read
method
#
func (b *body) Read(p []byte) (n int, err error)
Read
method
#
func (c *loggingConn) Read(p []byte) (n int, err error)
Read
method
#
func (ecr *expectContinueReader) Read(p []byte) (n int, err error)
Read
method
#
func (l *maxBytesReader) Read(p []byte) (n int, err error)
Read
method
#
func (fr finishAsyncByteRead) Read(p []byte) (n int, err error)
Read
method
#
func (r *arrayReader) Read(p []byte) (n int, err error)
Read
method
#
func (cr *connReader) Read(p []byte) (n int, err error)
Read
method
#
func (noBody) Read([]byte) (int, error)
Read
method
#
func (b *http2requestBody) Read(p []byte) (n int, err error)
Read
method
#
Read copies bytes from the buffer into p.
It is an error to read when no data is available.
func (b *http2dataBuffer) Read(p []byte) (int, error)
Read
method
#
func (r *readTrackingBody) Read(data []byte) (int, error)
Read
method
#
func (b http2transportResponseBody) Read(p []byte) (n int, err error)
Read
method
#
func (http2noBodyReader) Read([]byte) (int, error)
Read
method
#
func (http2missingBody) Read([]byte) (int, error)
Read
method
#
func (f ioFile) Read(b []byte) (int, error)
Read
method
#
Read waits until data is available and copies bytes
from the buffer into p.
func (p *http2pipe) Read(d []byte) (n int, err error)
Read
method
#
func (b *cancelTimerBody) Read(p []byte) (n int, err error)
Read
method
#
func (r http2errorReader) Read(p []byte) (int, error)
Read
method
#
func (gz *http2gzipReader) Read(p []byte) (n int, err error)
ReadDir
method
#
func (f ioFile) ReadDir(count int) ([]fs.DirEntry, error)
ReadFrame
method
#
ReadFrame reads a single frame. The returned Frame is only valid
until the next call to ReadFrame.
If the frame is larger than previously set with SetMaxReadFrameSize, the
returned error is ErrFrameTooLarge. Other errors may be of type
ConnectionError, StreamError, or anything else from the underlying
reader.
If ReadFrame returns an error and a non-nil Frame, the Frame's StreamID
indicates the stream responsible for the error.
func (fr *http2Framer) ReadFrame() (http2Frame, error)
ReadFrom
method
#
ReadFrom exposes persistConnWriter's underlying Conn to io.Copy and if
the Conn implements io.ReaderFrom, it can take advantage of optimizations
such as sendfile.
func (w persistConnWriter) ReadFrom(r io.Reader) (n int64, err error)
ReadFrom
method
#
ReadFrom is here to optimize copying from an [*os.File] regular file
to a [*net.TCPConn] with sendfile, or from a supported src type such
as a *net.TCPConn on Linux with splice.
func (w *response) ReadFrom(src io.Reader) (n int64, err error)
ReadRequest
function
#
ReadRequest reads and parses an incoming request from b.
ReadRequest is a low-level function and should only be used for
specialized applications; most code should use the [Server] to read
requests and handle them via the [Handler] interface. ReadRequest
only supports HTTP/1.x requests. For HTTP/2, use golang.org/x/net/http2.
func ReadRequest(b *bufio.Reader) (*Request, error)
ReadResponse
function
#
ReadResponse reads and returns an HTTP response from r.
The req parameter optionally specifies the [Request] that corresponds
to this [Response]. If nil, a GET request is assumed.
Clients must call resp.Body.Close when finished reading resp.Body.
After that call, clients can inspect resp.Trailer to find key/value
pairs included in the response trailer.
func ReadResponse(r *bufio.Reader, req *Request) (*Response, error)
Readdir
method
#
func (f ioFile) Readdir(count int) ([]fs.FileInfo, error)
Redirect
function
#
Redirect replies to the request with a redirect to url,
which may be a path relative to the request path.
The provided code should be in the 3xx range and is usually
[StatusMovedPermanently], [StatusFound] or [StatusSeeOther].
If the Content-Type header has not been set, [Redirect] sets it
to "text/html; charset=utf-8" and writes a small HTML body.
Setting the Content-Type header to any value, including nil,
disables that behavior.
func Redirect(w ResponseWriter, r *Request, url string, code int)
RedirectHandler
function
#
RedirectHandler returns a request handler that redirects
each request it receives to the given url using the given
status code.
The provided code should be in the 3xx range and is usually
[StatusMovedPermanently], [StatusFound] or [StatusSeeOther].
func RedirectHandler(url string, code int) Handler
Referer
method
#
Referer returns the referring URL, if sent in the request.
Referer is misspelled as in the request itself, a mistake from the
earliest days of HTTP. This value can also be fetched from the
[Header] map as Header["Referer"]; the benefit of making it available
as a method is that the compiler can diagnose programs that use the
alternate (correct English) spelling req.Referrer() but cannot
diagnose programs that use Header["Referrer"].
func (r *Request) Referer() string
RegisterOnShutdown
method
#
RegisterOnShutdown registers a function to call on [Server.Shutdown].
This can be used to gracefully shutdown connections that have
undergone ALPN protocol upgrade or that have been hijacked.
This function should start protocol-specific graceful shutdown,
but should not wait for shutdown to complete.
func (s *Server) RegisterOnShutdown(f func())
RegisterProtocol
method
#
RegisterProtocol registers a new protocol with scheme.
The [Transport] will pass requests using the given scheme to rt.
It is rt's responsibility to simulate HTTP request semantics.
RegisterProtocol can be used by other packages to provide
implementations of protocol schemes like "ftp" or "file".
If rt.RoundTrip returns [ErrSkipAltProtocol], the Transport will
handle the [Transport.RoundTrip] itself for that one request, as if the
protocol were not registered.
func (t *Transport) RegisterProtocol(scheme string, rt RoundTripper)
RegularFields
method
#
RegularFields returns the regular (non-pseudo) header fields of mh.
The caller does not own the returned slice.
func (mh *http2MetaHeadersFrame) RegularFields() []hpack.HeaderField
ReserveNewRequest
method
#
ReserveNewRequest is like CanTakeNewRequest but also reserves a
concurrent stream in cc. The reservation is decremented on the
next call to RoundTrip.
func (cc *http2ClientConn) ReserveNewRequest() bool
RoundTrip
method
#
func (rt http2noDialH2RoundTripper) RoundTrip(req *Request) (*Response, error)
RoundTrip
method
#
func (t *http2unencryptedTransport) RoundTrip(req *Request) (*Response, error)
RoundTrip
method
#
func (t *http2Transport) RoundTrip(req *Request) (*Response, error)
RoundTrip
method
#
func (http2noDialH2RoundTripper) RoundTrip(*Request) (*Response, error)
RoundTrip
method
#
RoundTrip implements the [RoundTripper] interface using the WHATWG Fetch API.
func (t *Transport) RoundTrip(req *Request) (*Response, error)
RoundTrip
method
#
func (*http2Transport) RoundTrip(*Request) (*Response, error)
RoundTrip
method
#
func (rt http2erringRoundTripper) RoundTrip(*Request) (*Response, error)
RoundTrip
method
#
RoundTrip implements the [RoundTripper] interface.
For higher-level HTTP client support (such as handling of cookies
and redirects), see [Get], [Post], and the [Client] type.
Like the RoundTripper interface, the error types returned
by RoundTrip are unspecified.
func (t *Transport) RoundTrip(req *Request) (*Response, error)
RoundTrip
method
#
func (t fileTransport) RoundTrip(req *Request) (resp *Response, err error)
RoundTrip
method
#
func (cc *http2ClientConn) RoundTrip(req *Request) (*Response, error)
RoundTripErr
method
#
func (rt http2erringRoundTripper) RoundTripErr() error
RoundTripOpt
method
#
RoundTripOpt is like RoundTrip, but takes options.
func (t *http2Transport) RoundTripOpt(req *Request, opt http2RoundTripOpt) (*Response, error)
Seek
method
#
func (f ioFile) Seek(offset int64, whence int) (int64, error)
Serve
method
#
Serve accepts incoming connections on the Listener l, creating a
new service goroutine for each. The service goroutines read requests and
then call s.Handler to reply to them.
HTTP/2 support is only enabled if the Listener returns [*tls.Conn]
connections and they were configured with "h2" in the TLS
Config.NextProtos.
Serve always returns a non-nil error and closes l.
After [Server.Shutdown] or [Server.Close], the returned error is [ErrServerClosed].
func (s *Server) Serve(l net.Listener) error
Serve
function
#
Serve accepts incoming HTTP connections on the listener l,
creating a new service goroutine for each. The service goroutines
read requests and then call handler to reply to them.
The handler is typically nil, in which case [DefaultServeMux] is used.
HTTP/2 support is only enabled if the Listener returns [*tls.Conn]
connections and they were configured with "h2" in the TLS
Config.NextProtos.
Serve always returns a non-nil error.
func Serve(l net.Listener, handler Handler) error
ServeConn
method
#
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 *http2Server) ServeConn(c net.Conn, opts *http2ServeConnOpts)
ServeContent
function
#
ServeContent replies to the request using the content in the
provided ReadSeeker. The main benefit of ServeContent over [io.Copy]
is that it handles Range requests properly, sets the MIME type, and
handles If-Match, If-Unmodified-Since, If-None-Match, If-Modified-Since,
and If-Range requests.
If the response's Content-Type header is not set, ServeContent
first tries to deduce the type from name's file extension and,
if that fails, falls back to reading the first block of the content
and passing it to [DetectContentType].
The name is otherwise unused; in particular it can be empty and is
never sent in the response.
If modtime is not the zero time or Unix epoch, ServeContent
includes it in a Last-Modified header in the response. If the
request includes an If-Modified-Since header, ServeContent uses
modtime to decide whether the content needs to be sent at all.
The content's Seek method must work: ServeContent uses
a seek to the end of the content to determine its size.
Note that [*os.File] implements the [io.ReadSeeker] interface.
If the caller has set w's ETag header formatted per RFC 7232, section 2.3,
ServeContent uses it to handle requests using If-Match, If-None-Match, or If-Range.
If an error occurs when serving the request (for example, when
handling an invalid range request), ServeContent responds with an
error message. By default, ServeContent strips the Cache-Control,
Content-Encoding, ETag, and Last-Modified headers from error responses.
The GODEBUG setting httpservecontentkeepheaders=1 causes ServeContent
to preserve these headers.
func ServeContent(w ResponseWriter, req *Request, name string, modtime time.Time, content io.ReadSeeker)
ServeFile
function
#
ServeFile replies to the request with the contents of the named
file or directory.
If the provided file or directory name is a relative path, it is
interpreted relative to the current directory and may ascend to
parent directories. If the provided name is constructed from user
input, it should be sanitized before calling [ServeFile].
As a precaution, ServeFile will reject requests where r.URL.Path
contains a ".." path element; this protects against callers who
might unsafely use [filepath.Join] on r.URL.Path without sanitizing
it and then use that filepath.Join result as the name argument.
As another special case, ServeFile redirects any request where r.URL.Path
ends in "/index.html" to the same path, without the final
"index.html". To avoid such redirects either modify the path or
use [ServeContent].
Outside of those two special cases, ServeFile does not use
r.URL.Path for selecting the file or directory to serve; only the
file or directory provided in the name argument is used.
func ServeFile(w ResponseWriter, r *Request, name string)
ServeFileFS
function
#
ServeFileFS replies to the request with the contents
of the named file or directory from the file system fsys.
The files provided by fsys must implement [io.Seeker].
If the provided name is constructed from user input, it should be
sanitized before calling [ServeFileFS].
As a precaution, ServeFileFS will reject requests where r.URL.Path
contains a ".." path element; this protects against callers who
might unsafely use [filepath.Join] on r.URL.Path without sanitizing
it and then use that filepath.Join result as the name argument.
As another special case, ServeFileFS redirects any request where r.URL.Path
ends in "/index.html" to the same path, without the final
"index.html". To avoid such redirects either modify the path or
use [ServeContent].
Outside of those two special cases, ServeFileFS does not use
r.URL.Path for selecting the file or directory to serve; only the
file or directory provided in the name argument is used.
func ServeFileFS(w ResponseWriter, r *Request, fsys fs.FS, name string)
ServeHTTP
method
#
func (h *timeoutHandler) ServeHTTP(w ResponseWriter, r *Request)
ServeHTTP
method
#
func (globalOptionsHandler) ServeHTTP(w ResponseWriter, r *Request)
ServeHTTP
method
#
ServeHTTP should be an internal detail,
but widely used packages access it using linkname.
Notable members of the hall of shame include:
- github.com/erda-project/erda-infra
Do not remove or change the type signature.
See go.dev/issue/67401.
go:linkname badServeHTTP net/http.serverHandler.ServeHTTP
func (sh serverHandler) ServeHTTP(rw ResponseWriter, req *Request)
ServeHTTP
method
#
func (h unencryptedHTTP2Request) ServeHTTP(rw ResponseWriter, req *Request)
ServeHTTP
method
#
ServeHTTP dispatches the request to the handler whose
pattern most closely matches the request URL.
func (mux *ServeMux) ServeHTTP(w ResponseWriter, r *Request)
ServeHTTP
method
#
ServeHTTP calls f(w, r).
func (f HandlerFunc) ServeHTTP(w ResponseWriter, r *Request)
ServeHTTP
method
#
func (h initALPNRequest) ServeHTTP(rw ResponseWriter, req *Request)
ServeHTTP
method
#
func (rh *redirectHandler) ServeHTTP(w ResponseWriter, r *Request)
ServeHTTP
method
#
func (f *fileHandler) ServeHTTP(w ResponseWriter, r *Request)
ServeTLS
method
#
ServeTLS accepts incoming connections on the Listener l, creating a
new service goroutine for each. The service goroutines perform TLS
setup and then read requests, calling s.Handler to reply to them.
Files containing a certificate and matching private key for the
server must be provided if neither the [Server]'s
TLSConfig.Certificates, TLSConfig.GetCertificate nor
config.GetConfigForClient are populated.
If the certificate is signed by a certificate authority, the
certFile should be the concatenation of the server's certificate,
any intermediates, and the CA's certificate.
ServeTLS always returns a non-nil error. After [Server.Shutdown] or [Server.Close], the
returned error is [ErrServerClosed].
func (s *Server) ServeTLS(l net.Listener, certFile string, keyFile string) error
ServeTLS
function
#
ServeTLS accepts incoming HTTPS connections on the listener l,
creating a new service goroutine for each. The service goroutines
read requests and then call handler to reply to them.
The handler is typically nil, in which case [DefaultServeMux] is used.
Additionally, files containing a certificate and matching private key
for the server must be provided. If the certificate is signed by a
certificate authority, the certFile should be the concatenation
of the server's certificate, any intermediates, and the CA's certificate.
ServeTLS always returns a non-nil error.
func ServeTLS(l net.Listener, handler Handler, certFile string, keyFile string) error
Set
method
#
Set sets the header entries associated with key to the
single element value. It replaces any existing values
associated with key. The key is case insensitive; it is
canonicalized by [textproto.CanonicalMIMEHeaderKey].
To use non-canonical keys, assign to the map directly.
func (h Header) Set(key string, value string)
SetBasicAuth
method
#
SetBasicAuth sets the request's Authorization header to use HTTP
Basic Authentication with the provided username and password.
With HTTP Basic Authentication the provided username and password
are not encrypted. It should generally only be used in an HTTPS
request.
The username may not contain a colon. Some protocols may impose
additional requirements on pre-escaping the username and
password. For instance, when used with OAuth2, both arguments must
be URL encoded first with [url.QueryEscape].
func (r *Request) SetBasicAuth(username string, password string)
SetCookie
function
#
SetCookie adds a Set-Cookie header to the provided [ResponseWriter]'s headers.
The provided cookie must have a valid Name. Invalid cookies may be
silently dropped.
func SetCookie(w ResponseWriter, cookie *Cookie)
SetDoNotReuse
method
#
SetDoNotReuse marks cc as not reusable for future HTTP requests.
func (cc *http2ClientConn) SetDoNotReuse()
SetHTTP1
method
#
SetHTTP1 adds or removes HTTP/1 from p.
func (p *Protocols) SetHTTP1(ok bool)
SetHTTP2
method
#
SetHTTP2 adds or removes HTTP/2 from p.
func (p *Protocols) SetHTTP2(ok bool)
SetKeepAlivesEnabled
method
#
SetKeepAlivesEnabled controls whether HTTP keep-alives are enabled.
By default, keep-alives are always enabled. Only very
resource-constrained environments or servers in the process of
shutting down should disable them.
func (s *Server) SetKeepAlivesEnabled(v bool)
SetMaxReadFrameSize
method
#
SetMaxReadFrameSize sets the maximum size of a frame
that will be read by a subsequent call to ReadFrame.
It is the caller's responsibility to advertise this
limit with a SETTINGS frame.
func (fr *http2Framer) SetMaxReadFrameSize(v uint32)
SetPathValue
method
#
SetPathValue sets name to value, so that subsequent calls to r.PathValue(name)
return value.
func (r *Request) SetPathValue(name string, value string)
SetReadDeadline
method
#
SetReadDeadline sets the deadline for reading the entire request, including the body.
Reads from the request body after the deadline has been exceeded will return an error.
A zero value means no deadline.
Setting the read deadline after it has been exceeded will not extend it.
func (c *ResponseController) SetReadDeadline(deadline time.Time) error
SetReadDeadline
method
#
func (c *response) SetReadDeadline(deadline time.Time) error
SetReadDeadline
method
#
func (w *http2responseWriter) SetReadDeadline(deadline time.Time) error
SetReuseFrames
method
#
SetReuseFrames allows the Framer to reuse Frames.
If called on a Framer, Frames returned by calls to ReadFrame are only
valid until the next call to ReadFrame.
func (fr *http2Framer) SetReuseFrames()
SetUnencryptedHTTP2
method
#
SetUnencryptedHTTP2 adds or removes unencrypted HTTP/2 from p.
func (p *Protocols) SetUnencryptedHTTP2(ok bool)
SetWriteDeadline
method
#
func (c *response) SetWriteDeadline(deadline time.Time) error
SetWriteDeadline
method
#
func (w *http2responseWriter) SetWriteDeadline(deadline time.Time) error
SetWriteDeadline
method
#
SetWriteDeadline sets the deadline for writing the response.
Writes to the response body after the deadline has been exceeded will not block,
but may succeed if the data has been buffered.
A zero value means no deadline.
Setting the write deadline after it has been exceeded will not extend it.
func (c *ResponseController) SetWriteDeadline(deadline time.Time) error
Setting
method
#
Setting returns the setting from the frame at the given 0-based index.
The index must be >= 0 and less than f.NumSettings().
func (f *http2SettingsFrame) Setting(i int) http2Setting
Shutdown
method
#
Shutdown gracefully closes the client connection, waiting for running streams to complete.
func (cc *http2ClientConn) Shutdown(ctx context.Context) error
Shutdown
method
#
Shutdown gracefully shuts down the server without interrupting any
active connections. Shutdown works by first closing all open
listeners, then closing all idle connections, and then waiting
indefinitely for connections to return to idle and then shut down.
If the provided context expires before the shutdown is complete,
Shutdown returns the context's error, otherwise it returns any
error returned from closing the [Server]'s underlying Listener(s).
When Shutdown is called, [Serve], [ListenAndServe], and
[ListenAndServeTLS] immediately return [ErrServerClosed]. Make sure the
program doesn't exit and waits instead for Shutdown to return.
Shutdown does not attempt to close nor wait for hijacked
connections such as WebSockets. The caller of Shutdown should
separately notify such long-lived connections of shutdown and wait
for them to close, if desired. See [Server.RegisterOnShutdown] for a way to
register shutdown notification functions.
Once Shutdown has been called on a server, it may not be reused;
future calls to methods such as Serve will return ErrServerClosed.
func (s *Server) Shutdown(ctx context.Context) error
SortStrings
method
#
func (s *http2sorter) SortStrings(ss []string)
Stat
method
#
func (f ioFile) Stat() (fs.FileInfo, error)
State
method
#
State returns a snapshot of cc's state.
func (cc *http2ClientConn) State() http2ClientConnState
StatusText
function
#
StatusText returns a text for the HTTP status code. It returns the empty
string if the code is unknown.
func StatusText(code int) string
StreamEnded
method
#
func (f *http2HeadersFrame) StreamEnded() bool
StreamEnded
method
#
func (f *http2DataFrame) StreamEnded() bool
StreamID
method
#
StreamID returns the id of the stream this frame will be written to.
0 is used for non-stream frames such as PING and SETTINGS.
func (wr http2FrameWriteRequest) StreamID() uint32
String
method
#
func (s http2Setting) String() string
String
method
#
func (a *socksAddr) String() string
String
method
#
func (p Protocols) String() string
String
method
#
func (k *contextKey) String() string
String
method
#
String returns the serialization of the cookie for use in a [Cookie]
header (if only Name and Value are set) or a Set-Cookie response
header (if other fields are set).
If c is nil or c.Name is invalid, the empty string is returned.
func (c *Cookie) String() string
String
method
#
func (w *http2writeData) String() string
String
method
#
func (c ConnState) String() string
String
method
#
func (e http2ErrCode) String() string
String
method
#
func (t http2FrameType) String() string
String
method
#
func (cmd socksCommand) String() string
String
method
#
func (h http2FrameHeader) String() string
String
method
#
func (p *pattern) String() string
String
method
#
func (code socksReply) String() string
String
method
#
func (s http2SettingID) String() string
String
method
#
func (st http2streamState) String() string
String
method
#
String is for debugging only.
func (wr http2FrameWriteRequest) String() string
String
method
#
func (k connectMethodKey) String() string
StripPrefix
function
#
StripPrefix returns a handler that serves HTTP requests by removing the
given prefix from the request URL's Path (and RawPath if set) and invoking
the handler h. StripPrefix handles a request for a path that doesn't begin
with prefix by replying with an HTTP 404 not found error. The prefix must
match exactly: if the prefix in the request contains escaped characters
the reply is also an HTTP 404 not found error.
func StripPrefix(prefix string, h Handler) Handler
Swap
method
#
func (s *http2sorter) Swap(i int, j int)
Swap
method
#
func (z http2sortPriorityNodeSiblings) Swap(i int, k int)
Temporary
method
#
func (e *timeoutError) Temporary() bool
Temporary
method
#
func (e *http2httpError) Temporary() bool
Temporary
method
#
func (tlsHandshakeTimeoutError) Temporary() bool
Timeout
method
#
func (e *http2httpError) Timeout() bool
Timeout
method
#
func (e *timeoutError) Timeout() bool
Timeout
method
#
func (tlsHandshakeTimeoutError) Timeout() bool
TimeoutHandler
function
#
TimeoutHandler returns a [Handler] that runs h with the given time limit.
The new Handler calls h.ServeHTTP to handle each request, but if a
call runs for longer than its time limit, the handler responds with
a 503 Service Unavailable error and the given message in its body.
(If msg is empty, a suitable default message will be sent.)
After such a timeout, writes by h to its [ResponseWriter] will return
[ErrHandlerTimeout].
TimeoutHandler supports the [Pusher] interface but does not support
the [Hijacker] or [Flusher] interfaces.
func TimeoutHandler(h Handler, dt time.Duration, msg string) Handler
UnencryptedHTTP2
method
#
UnencryptedHTTP2 reports whether p includes unencrypted HTTP/2.
func (p Protocols) UnencryptedHTTP2() bool
UnencryptedNetConn
method
#
func (c unencryptedNetConnInTLSConn) UnencryptedNetConn() net.Conn
Unlock
method
#
func (fakeLocker) Unlock()
Unwrap
method
#
func (nwe nothingWrittenError) Unwrap() error
Unwrap
method
#
func (e transportReadFromServerError) Unwrap() error
UserAgent
method
#
UserAgent returns the client's User-Agent, if sent in the request.
func (r *Request) UserAgent() string
Valid
method
#
Valid reports whether the cookie is valid.
func (c *Cookie) Valid() error
Valid
method
#
Valid reports whether the setting is valid.
func (s http2Setting) Valid() error
Value
method
#
func (f *http2SettingsFrame) Value(id http2SettingID) (v uint32, ok bool)
Values
method
#
Values returns all values associated with the given key.
It is case insensitive; [textproto.CanonicalMIMEHeaderKey] is
used to canonicalize the provided key. To use non-canonical
keys, access the map directly.
The returned slice is not a copy.
func (h Header) Values(key string) []string
Wait
method
#
Wait waits for the closeWaiter to become closed.
func (cw http2closeWaiter) Wait()
WithContext
method
#
WithContext returns a shallow copy of r with its context changed
to ctx. The provided ctx must be non-nil.
For outgoing client request, the context controls the entire
lifetime of a request and its response: obtaining a connection,
sending the request, and reading the response headers and body.
To create a new request with a context, use [NewRequestWithContext].
To make a deep copy of a request with a new context, use [Request.Clone].
func (r *Request) WithContext(ctx context.Context) *Request
Write
method
#
Write appends p to the buffer.
func (b *http2dataBuffer) Write(p []byte) (int, error)
Write
method
#
func (cw http2chunkWriter) Write(p []byte) (n int, err error)
Write
method
#
func (tw *timeoutWriter) Write(p []byte) (int, error)
Write
method
#
func (pr *populateResponse) Write(p []byte) (n int, err error)
Write
method
#
func (w persistConnWriter) Write(p []byte) (n int, err error)
Write
method
#
func (c *loggingConn) Write(p []byte) (n int, err error)
Write
method
#
func (sew http2stickyErrWriter) Write(p []byte) (n int, err error)
Write
method
#
Write writes r to w in the HTTP/1.x server response format,
including the status line, headers, body, and optional trailer.
This method consults the following fields of the response r:
StatusCode
ProtoMajor
ProtoMinor
Request.Method
TransferEncoding
Trailer
Body
ContentLength
Header, values for non-canonical keys will have unpredictable behavior
The Response Body is closed after it is sent.
func (r *Response) Write(w io.Writer) error
Write
method
#
Write writes the headers described in h to w.
This method has a value receiver, despite the somewhat large size
of h, because it prevents an allocation. The escape analysis isn't
smart enough to realize this function doesn't mutate h.
func (h extraHeader) Write(w *bufio.Writer)
Write
method
#
The Life Of A Write is like this:
Handler starts. No header has been sent. The handler can either
write a header, or just start writing. Writing before sending a header
sends an implicitly empty 200 OK header.
If the handler didn't declare a Content-Length up front, we either
go into chunking mode or, if the handler finishes running before
the chunking buffer size, we compute a Content-Length and send that
in the header instead.
Likewise, if the handler didn't set a Content-Type, we sniff that
from the initial chunk of output.
The Writers are wired together like:
1. *response (the ResponseWriter) ->
2. (*response).w, a [*bufio.Writer] of bufferBeforeChunkingSize bytes ->
3. chunkWriter.Writer (whose writeHeader finalizes Content-Length/Type)
and which writes the chunk headers, if needed ->
4. conn.bufw, a *bufio.Writer of default (4kB) bytes, writing to ->
5. checkConnErrorWriter{c}, which notes any non-nil error on Write
and populates c.werr with it if so, but otherwise writes to ->
6. the rwc, the [net.Conn].
TODO(bradfitz): short-circuit some of the buffering when the
initial header contains both a Content-Type and Content-Length.
Also short-circuit in (1) when the header's been sent and not in
chunking mode, writing directly to (4) instead, if (2) has no
buffered data. More generally, we could short-circuit from (1) to
(3) even in chunking mode if the write size from (1) is over some
threshold and nothing is in (2). The answer might be mostly making
bufferBeforeChunkingSize smaller and having bufio's fast-paths deal
with this instead.
func (w *response) Write(data []byte) (n int, err error)
Write
method
#
Write writes a header in wire format.
func (h Header) Write(w io.Writer) error
Write
method
#
func (w *http2bufferedWriter) Write(p []byte) (n int, err error)
Write
method
#
func (w *countingWriter) Write(p []byte) (n int, err error)
Write
method
#
func (w *http2bufferedWriterTimeoutWriter) Write(p []byte) (n int, err error)
Write
method
#
func (fw bufioFlushWriter) Write(p []byte) (n int, err error)
Write
method
#
Write copies bytes from p into the buffer and wakes a reader.
It is an error to write more data than the buffer can hold.
func (p *http2pipe) Write(d []byte) (n int, err error)
Write
method
#
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 *http2responseWriter) Write(p []byte) (n int, err error)
Write
method
#
func (w checkConnErrorWriter) Write(p []byte) (n int, err error)
Write
method
#
Write writes an HTTP/1.1 request, which is the header and body, in wire format.
This method consults the following fields of the request:
Host
URL
Method (defaults to "GET")
Header
ContentLength
TransferEncoding
Body
If Body is present, Content-Length is <= 0 and [Request.TransferEncoding]
hasn't been set to "identity", Write adds "Transfer-Encoding:
chunked" to the header. Body is closed after it is sent.
func (r *Request) Write(w io.Writer) error
Write
method
#
func (cw *chunkWriter) Write(p []byte) (n int, err error)
WriteContinuation
method
#
WriteContinuation writes a CONTINUATION frame.
It will perform exactly one Write to the underlying Writer.
It is the caller's responsibility to not call other Write methods concurrently.
func (f *http2Framer) WriteContinuation(streamID uint32, endHeaders bool, headerBlockFragment []byte) error
WriteData
method
#
WriteData writes a DATA frame.
It will perform exactly one Write to the underlying Writer.
It is the caller's responsibility not to violate the maximum frame size
and to not call other Write methods concurrently.
func (f *http2Framer) WriteData(streamID uint32, endStream bool, data []byte) error
WriteDataPadded
method
#
WriteDataPadded writes a DATA frame with optional padding.
If pad is nil, the padding bit is not sent.
The length of pad must not exceed 255 bytes.
The bytes of pad must all be zero, unless f.AllowIllegalWrites is set.
It will perform exactly one Write to the underlying Writer.
It is the caller's responsibility not to violate the maximum frame size
and to not call other Write methods concurrently.
func (f *http2Framer) WriteDataPadded(streamID uint32, endStream bool, data []byte, pad []byte) error
WriteGoAway
method
#
func (f *http2Framer) WriteGoAway(maxStreamID uint32, code http2ErrCode, debugData []byte) error
WritePing
method
#
func (f *http2Framer) WritePing(ack bool, data [8]byte) error
WritePriority
method
#
WritePriority writes a PRIORITY frame.
It will perform exactly one Write to the underlying Writer.
It is the caller's responsibility to not call other Write methods concurrently.
func (f *http2Framer) WritePriority(streamID uint32, p http2PriorityParam) error
WriteProxy
method
#
WriteProxy is like [Request.Write] but writes the request in the form
expected by an HTTP proxy. In particular, [Request.WriteProxy] writes the
initial Request-URI line of the request with an absolute URI, per
section 5.3 of RFC 7230, including the scheme and host.
In either case, WriteProxy also writes a Host header, using
either r.Host or r.URL.Host.
func (r *Request) WriteProxy(w io.Writer) error
WritePushPromise
method
#
WritePushPromise writes a single PushPromise Frame.
As with Header Frames, This is the low level call for writing
individual frames. Continuation frames are handled elsewhere.
It will perform exactly one Write to the underlying Writer.
It is the caller's responsibility to not call other Write methods concurrently.
func (f *http2Framer) WritePushPromise(p http2PushPromiseParam) error
WriteRSTStream
method
#
WriteRSTStream writes a RST_STREAM frame.
It will perform exactly one Write to the underlying Writer.
It is the caller's responsibility to not call other Write methods concurrently.
func (f *http2Framer) WriteRSTStream(streamID uint32, code http2ErrCode) error
WriteRawFrame
method
#
WriteRawFrame writes a raw frame. This can be used to write
extension frames unknown to this package.
func (f *http2Framer) WriteRawFrame(t http2FrameType, flags http2Flags, streamID uint32, payload []byte) error
WriteSettings
method
#
WriteSettings writes a SETTINGS frame with zero or more settings
specified and the ACK bit not set.
It will perform exactly one Write to the underlying Writer.
It is the caller's responsibility to not call other Write methods concurrently.
func (f *http2Framer) WriteSettings(settings ...http2Setting) error
WriteSettingsAck
method
#
WriteSettingsAck writes an empty SETTINGS frame with the ACK bit set.
It will perform exactly one Write to the underlying Writer.
It is the caller's responsibility to not call other Write methods concurrently.
func (f *http2Framer) WriteSettingsAck() error
WriteString
method
#
func (w *response) WriteString(data string) (n int, err error)
WriteString
method
#
func (w *http2responseWriter) WriteString(s string) (n int, err error)
WriteString
method
#
func (w stringWriter) WriteString(s string) (n int, err error)
WriteSubset
method
#
WriteSubset writes a header in wire format.
If exclude is not nil, keys where exclude[key] == true are not written.
Keys are not canonicalized before checking the exclude map.
func (h Header) WriteSubset(w io.Writer, exclude map[string]bool) error
WriteTo
method
#
func (noBody) WriteTo(io.Writer) (int64, error)
WriteWindowUpdate
method
#
WriteWindowUpdate writes a WINDOW_UPDATE frame.
The increment value must be between 1 and 2,147,483,647, inclusive.
If the Stream ID is zero, the window update applies to the
connection as a whole.
func (f *http2Framer) WriteWindowUpdate(streamID uint32, incr uint32) error
abortPendingRead
method
#
func (cr *connReader) abortPendingRead()
abortRequestBodyWrite
method
#
func (cs *http2clientStream) abortRequestBodyWrite()
abortStream
method
#
func (cs *http2clientStream) abortStream(err error)
abortStreamLocked
method
#
func (cs *http2clientStream) abortStreamLocked(err error)
add
method
#
add adds n bytes (positive or negative) to the flow control window.
It returns false if the sum would exceed 2^31-1.
func (f *http2outflow) add(n int32) bool
add
method
#
add adds pc to the head of the linked list.
func (cl *connLRU) add(pc *persistConn)
add
method
#
add adds n bytes to the window, with a maximum window size of max,
indicating that the peer can now send us more data.
For example, the user read from a {Request,Response} body and consumed
some of the buffered data, so the peer can now send more.
It returns the number of bytes to send in a WINDOW_UPDATE frame to the peer.
Window updates are accumulated and sent when the unsent capacity
is at least inflowMinRefresh or will at least double the peer's available window.
func (f *http2inflow) add(n int) (connAdd int32)
add
method
#
add adds a key-value pair to the mapping.
func (h **ast.IndexListExpr) add(k K, v V)
addBytes
method
#
func (n *http2priorityNode) addBytes(b int64)
addChild
method
#
addChild adds a child node with the given key to n
if one does not exist, and returns the child.
func (n *routingNode) addChild(key string) *routingNode
addClosedOrIdleNode
method
#
func (ws *http2priorityWriteScheduler) addClosedOrIdleNode(list *[]*http2priorityNode, maxSize int, n *http2priorityNode)
addConnIfNeeded
method
#
addConnIfNeeded makes a NewClientConn out of c if a connection for key doesn't
already exist. It coalesces concurrent calls with the same key.
This is used by the http1 Transport code when it creates a new connection. Because
the http1 Transport doesn't de-dup TCP dials to outbound hosts (because it doesn't know
the protocol), it can get into a situation where it has multiple TLS connections.
This code decides which ones live or die.
The return value used is whether c was used.
c is never closed.
func (p *http2clientConnPool) addConnIfNeeded(key string, t *http2Transport, c net.Conn) (used bool, err error)
addConnLocked
method
#
p.mu must be held
func (p *http2clientConnPool) addConnLocked(key string, cc *http2ClientConn)
addPattern
method
#
addPattern adds a pattern and its associated Handler to the tree
at root.
func (root *routingNode) addPattern(p *pattern, h Handler)
addPattern
method
#
func (idx *routingIndex) addPattern(pat *pattern)
addSegments
method
#
addSegments adds the given segments to the tree rooted at n.
If there are no segments, then n is a leaf node that holds
the given pattern and handler.
func (n *routingNode) addSegments(segs []segment, p *pattern, h Handler)
addStreamLocked
method
#
requires cc.mu be held.
func (cc *http2ClientConn) addStreamLocked(cs *http2clientStream)
addTLS
method
#
Add TLS to a persistent connection, i.e. negotiate a TLS session. If pconn is already a TLS
tunnel, this function establishes a nested TLS session inside the encrypted channel.
The remote endpoint's name may be overridden by TLSClientConfig.ServerName.
func (pconn *persistConn) addTLS(ctx context.Context, name string, trace *httptrace.ClientTrace) error
addr
method
#
addr returns the first hop "host:port" to which we need to TCP connect.
func (cm *connectMethod) addr() string
adjustNextProtos
function
#
adjustNextProtos adds or removes "http/1.1" and "h2" entries from
a tls.Config.NextProtos list, according to the set of protocols in protos.
func adjustNextProtos(nextProtos []string, protos Protocols) []string
afterFunc
method
#
afterFunc creates a new time.AfterFunc timer, or a synthetic timer in tests.
func (s *http2Server) afterFunc(d time.Duration, f func()) http2timer
afterFunc
method
#
afterFunc creates a new time.AfterFunc timer, or a synthetic timer in tests.
func (t *http2Transport) afterFunc(d time.Duration, f func()) http2timer
all
method
#
all iterates over all wantConns in the queue.
The caller must not modify the queue while iterating.
func (q *wantConnQueue) all(f func(*wantConn))
alternateRoundTripper
method
#
alternateRoundTripper returns the alternate RoundTripper to use
for this request if the Request's URL scheme requires one,
or nil for the normal case of using the Transport.
func (t *Transport) alternateRoundTripper(req *Request) RoundTripper
alwaysFalse
function
#
func alwaysFalse() bool
appendSorted
function
#
func appendSorted(es []muxEntry, e muxEntry) []muxEntry
appendTime
function
#
appendTime is a non-allocating version of []byte(t.UTC().Format(TimeFormat))
func appendTime(b []byte, t time.Time) []byte
available
method
#
func (f *http2outflow) available() int32
awaitFlowControl
method
#
awaitFlowControl waits for [1, min(maxBytes, cc.cs.maxFrameSize)] flow
control tokens from the server.
It returns either the non-zero number of tokens taken or an error
if the stream is dead.
func (cs *http2clientStream) awaitFlowControl(maxBytes int) (taken int32, err error)
awaitLegacyCancel
function
#
func awaitLegacyCancel(ctx context.Context, cancel context.CancelCauseFunc, req *Request)
awaitOpenSlotForStreamLocked
method
#
awaitOpenSlotForStreamLocked waits until len(streams) < maxConcurrentStreams.
Must hold cc.mu.
func (cc *http2ClientConn) awaitOpenSlotForStreamLocked(cs *http2clientStream) error
backgroundRead
method
#
func (cr *connReader) backgroundRead()
badRequestError
function
#
badRequestError is a literal string (used by in the server in HTML,
unescaped) to tell the user why their request was bad. It should
be plain text without user info or other embedded errors.
func badRequestError(e string) error
badRoundTrip
function
#
RoundTrip should be an internal detail,
but widely used packages access it using linkname.
Notable members of the hall of shame include:
- github.com/erda-project/erda-infra
Do not remove or change the type signature.
See go.dev/issue/67401.
go:linkname badRoundTrip net/http.(*Transport).RoundTrip
func badRoundTrip(*Transport, *Request) (*Response, error)
badServeHTTP
function
#
func badServeHTTP(serverHandler, ResponseWriter, *Request)
badStringError
function
#
func badStringError(what string, val string) error
baseConfig
method
#
func (o *http2ServeConnOpts) baseConfig() *Server
basicAuth
function
#
See 2 (end of page 4) https://www.ietf.org/rfc/rfc2617.txt
"To receive authorization, the client sends the userid and password,
separated by a single colon (":") character, within a base64
encoded string in the credentials."
It is not meant to be urlencoded.
func basicAuth(username string, password string) string
bodyAllowed
method
#
bodyAllowed reports whether a Write is allowed for this response type.
It's illegal to call this before the header has been flushed.
func (w *response) bodyAllowed() bool
bodyAllowedForStatus
function
#
bodyAllowedForStatus reports whether a given response status code
permits a body. See RFC 7230, section 3.3.
func bodyAllowedForStatus(status int) bool
bodyIsWritable
method
#
bodyIsWritable reports whether the Body supports writing. The
Transport returns Writable bodies for 101 Switching Protocols
responses.
The Transport uses this method to determine whether a persistent
connection is done being managed from its perspective. Once we
return a writable response body to a user, the net/http package is
done managing that connection.
func (r *Response) bodyIsWritable() bool
bodyRemains
method
#
bodyRemains reports whether future Read calls might
yield data.
func (b *body) bodyRemains() bool
bufioWriterPool
function
#
func bufioWriterPool(size int) *sync.Pool
bytesFromFirstChunk
method
#
func (b *http2dataBuffer) bytesFromFirstChunk() []byte
canTakeNewRequestLocked
method
#
func (cc *http2ClientConn) canTakeNewRequestLocked() bool
cancel
method
#
cancel marks w as no longer wanting a result (for example, due to cancellation).
If a connection has been delivered already, cancel returns it with t.putOrCloseIdleConn.
func (w *wantConn) cancel(t *Transport, err error)
cancelRequest
method
#
func (pc *persistConn) cancelRequest(err error)
canceled
method
#
canceled returns non-nil if the connection was closed due to
CancelRequest or due to context cancellation.
func (pc *persistConn) canceled() error
canonicalAddr
function
#
canonicalAddr returns url.Host but always with a ":port" suffix.
func canonicalAddr(url *url.URL) string
check
method
#
func (g http2goroutineLock) check()
checkFrameOrder
method
#
checkFrameOrder reports an error if f is an invalid frame to return
next from ReadFrame. Mostly it checks whether HEADERS and
CONTINUATION frames are contiguous.
func (fr *http2Framer) checkFrameOrder(f http2Frame) error
checkIfMatch
function
#
func checkIfMatch(w ResponseWriter, r *Request) condResult
checkIfModifiedSince
function
#
func checkIfModifiedSince(r *Request, modtime time.Time) condResult
checkIfNoneMatch
function
#
func checkIfNoneMatch(w ResponseWriter, r *Request) condResult
checkIfRange
function
#
func checkIfRange(w ResponseWriter, r *Request, modtime time.Time) condResult
checkIfUnmodifiedSince
function
#
func checkIfUnmodifiedSince(r *Request, modtime time.Time) condResult
checkNotOn
method
#
func (g http2goroutineLock) checkNotOn()
checkPreconditions
function
#
checkPreconditions evaluates request preconditions and reports whether a precondition
resulted in sending StatusNotModified or StatusPreconditionFailed.
func checkPreconditions(w ResponseWriter, r *Request, modtime time.Time) (done bool, rangeHeader string)
checkPriority
method
#
func (sc *http2serverConn) checkPriority(streamID uint32, p http2PriorityParam) error
checkPseudos
method
#
func (mh *http2MetaHeadersFrame) checkPseudos() error
checkRedirect
method
#
checkRedirect calls either the user's configured CheckRedirect
function, or the default.
func (c *Client) checkRedirect(req *Request, via []*Request) error
checkValid
method
#
func (h *http2FrameHeader) checkValid()
chunked
function
#
Checks whether chunked is part of the encodings stack.
func chunked(te []string) bool
cleanFrontCanceled
method
#
cleanFrontCanceled pops any wantConns with canceled dials from the head of the queue.
func (q *wantConnQueue) cleanFrontCanceled()
cleanFrontNotWaiting
method
#
cleanFrontNotWaiting pops any wantConns that are no longer waiting from the head of the
queue, reporting whether any were popped.
func (q *wantConnQueue) cleanFrontNotWaiting() (cleaned bool)
cleanPath
function
#
cleanPath returns the canonical path for p, eliminating . and .. elements.
func cleanPath(p string) string
cleanup
method
#
func (rl *http2clientConnReadLoop) cleanup()
cleanupWriteRequest
method
#
cleanupWriteRequest performs post-request tasks.
If err (the result of writeRequest) is non-nil and the stream is not closed,
cleanupWriteRequest will send a reset to the peer.
func (cs *http2clientStream) cleanupWriteRequest(err error)
cloneMultipartForm
function
#
cloneMultipartForm should be an internal detail,
but widely used packages access it using linkname.
Notable members of the hall of shame include:
- github.com/searKing/golang
Do not remove or change the type signature.
See go.dev/issue/67401.
go:linkname cloneMultipartForm
func cloneMultipartForm(f *multipart.Form) *multipart.Form
cloneTLSConfig
function
#
cloneTLSConfig returns a shallow clone of cfg, or a new zero tls.Config if
cfg is nil. This is safe to call even if cfg is in active use by a TLS
client or server.
cloneTLSConfig should be an internal detail,
but widely used packages access it using linkname.
Notable members of the hall of shame include:
- github.com/searKing/golang
Do not remove or change the type signature.
See go.dev/issue/67401.
go:linkname cloneTLSConfig
func cloneTLSConfig(cfg *tls.Config) *tls.Config
cloneURL
function
#
cloneURL should be an internal detail,
but widely used packages access it using linkname.
Notable members of the hall of shame include:
- github.com/searKing/golang
Do not remove or change the type signature.
See go.dev/issue/67401.
go:linkname cloneURL
func cloneURL(u *url.URL) *url.URL
cloneURLValues
function
#
cloneURLValues should be an internal detail,
but widely used packages access it using linkname.
Notable members of the hall of shame include:
- github.com/searKing/golang
Do not remove or change the type signature.
See go.dev/issue/67401.
go:linkname cloneURLValues
func cloneURLValues(v url.Values) url.Values
close
method
#
Close the connection.
func (c *conn) close()
close
method
#
func (cw *chunkWriter) close()
close
method
#
close closes the underlying TCP connection and closes
the pc.closech channel.
The provided err is only for testing and debugging; in normal
circumstances it should never be seen by users.
func (pc *persistConn) close(err error)
close
method
#
func (oc *onceCloseListener) close()
closeAllStreamsOnConnClose
method
#
func (sc *http2serverConn) closeAllStreamsOnConnClose()
closeBody
method
#
func (r *Request) closeBody() error
closeBody
method
#
func (r *Response) closeBody()
closeConn
method
#
func (cc *http2ClientConn) closeConn()
closeConnIfStillIdle
method
#
closeConnIfStillIdle closes the connection if it's still sitting idle.
This is what's called by the persistConn's idleTimer, and is run in its
own goroutine.
func (pc *persistConn) closeConnIfStillIdle()
closeDoneLocked
method
#
requires p.mu be held.
func (p *http2pipe) closeDoneLocked()
closeForError
method
#
closes the client connection immediately. In-flight requests are interrupted.
err is sent to streams.
func (cc *http2ClientConn) closeForError(err error)
closeForLostPing
method
#
closes the client connection immediately. In-flight requests are interrupted.
func (cc *http2ClientConn) closeForLostPing()
closeIdleConnections
method
#
func (p *http2clientConnPool) closeIdleConnections()
closeIdleConns
method
#
closeIdleConns closes all idle connections and reports whether the
server is quiescent.
func (s *Server) closeIdleConns() bool
closeIfIdle
method
#
func (cc *http2ClientConn) closeIfIdle()
closeListenersLocked
method
#
func (s *Server) closeListenersLocked() error
closeLocked
method
#
func (pc *persistConn) closeLocked(err error)
closeNotify
method
#
may be called from multiple goroutines.
func (cr *connReader) closeNotify()
closeReqBodyLocked
method
#
func (cs *http2clientStream) closeReqBodyLocked()
closeStream
method
#
func (sc *http2serverConn) closeStream(st *http2stream, err error)
closeWithError
method
#
func (p *http2pipe) closeWithError(dst *error, err error, fn func())
closeWithErrorAndCode
method
#
closeWithErrorAndCode is like CloseWithError but also sets some code to run
in the caller's goroutine before returning the error.
func (p *http2pipe) closeWithErrorAndCode(err error, fn func())
closeWriteAndWait
method
#
closeWriteAndWait flushes any outstanding data and sends a FIN packet (if
client is connected via TCP), signaling that we're done. We then
pause for a bit, hoping the client processes it before any
subsequent RST.
See https://golang.org/issue/3595
func (c *conn) closeWriteAndWait()
closedRequestBodyEarly
method
#
func (w *response) closedRequestBodyEarly() bool
combineRelationships
function
#
combineRelationships determines the overall relationship of two patterns
given the relationships of a partition of the patterns into two parts.
For example, if p1 is more general than p2 in one way but equivalent
in the other, then it is more general overall.
Or if p1 is more general in one way and more specific in the other, then
they overlap.
func combineRelationships(r1 relationship, r2 relationship) relationship
commonPath
function
#
commonPath returns a path that both p1 and p2 match.
It assumes there is such a path.
func commonPath(p1 *pattern, p2 *pattern) string
compareMethods
method
#
compareMethods determines the relationship between the method
part of patterns p1 and p2.
A method can either be empty, "GET", or something else.
The empty string matches any method, so it is the most general.
"GET" matches both GET and HEAD.
Anything else matches only itself.
func (p1 *pattern) compareMethods(p2 *pattern) relationship
comparePaths
method
#
comparePaths determines the relationship between the path
part of two patterns.
func (p1 *pattern) comparePaths(p2 *pattern) relationship
comparePathsAndMethods
method
#
func (p1 *pattern) comparePathsAndMethods(p2 *pattern) relationship
compareSegments
function
#
compareSegments determines the relationship between two segments.
func compareSegments(s1 segment, s2 segment) relationship
condfn
method
#
caller must hold es.mu.
func (es *bodyEOFSignal) condfn(err error) error
condlogf
method
#
func (sc *http2serverConn) condlogf(err error, format string, args ...interface{})
conflictsWith
method
#
conflictsWith reports whether p1 conflicts with p2, that is, whether
there is a request that both match but where neither is higher precedence
than the other.
Precedence is defined by two rules:
1. Patterns with a host win over patterns without a host.
2. Patterns whose method and path is more specific win. One pattern is more
specific than another if the second matches all the (method, path) pairs
of the first and more.
If rule 1 doesn't apply, then two patterns conflict if their relationship
is either equivalence (they match the same set of requests) or overlap
(they both match some requests, but neither is more specific than the other).
func (p1 *pattern) conflictsWith(p2 *pattern) bool
connError
method
#
connError returns ConnectionError(code) but first
stashes away a public reason to the caller can optionally relay it
to the peer before hanging up on them. This might help others debug
their implementations.
func (fr *http2Framer) connError(code http2ErrCode, reason string) error
connPool
method
#
func (t *http2Transport) connPool() http2ClientConnPool
connect
method
#
func (d *socksDialer) connect(ctx context.Context, c net.Conn, address string) (_ net.Addr, ctxErr error)
connectMethodForRequest
method
#
func (t *Transport) connectMethodForRequest(treq *transportRequest) (cm connectMethod, err error)
consume
method
#
consume consumes up to n bytes from q.s[0]. If the frame is
entirely consumed, it is removed from the queue. If the frame
is partially consumed, the frame is kept with the consumed
bytes removed. Returns true iff any bytes were consumed.
func (q *http2writeQueue) consume(n int32) (http2FrameWriteRequest, bool)
containsDotDot
function
#
func containsDotDot(v string) bool
contentRange
method
#
func (r httpRange) contentRange(size int64) string
context
method
#
func (o *http2ServeConnOpts) context() context.Context
contextWithTimeout
method
#
func (t *http2Transport) contextWithTimeout(ctx context.Context, d time.Duration) (context.Context, context.CancelFunc)
copyTrailers
method
#
func (cs *http2clientStream) copyTrailers()
copyTrailersToHandlerRequest
method
#
copyTrailersToHandlerRequest is run in the Handler's goroutine in
its Request.Body.Read just before it gets io.EOF.
func (st *http2stream) copyTrailersToHandlerRequest()
copyValues
function
#
func copyValues(dst url.Values, src url.Values)
countError
method
#
func (sc *http2serverConn) countError(name string, err error) error
countReadFrameError
method
#
countReadFrameError calls Transport.CountError with a string
representing err.
func (cc *http2ClientConn) countReadFrameError(err error)
curOpenStreams
method
#
func (sc *http2serverConn) curOpenStreams() uint32
currentRequestCountLocked
method
#
currentRequestCountLocked reports the number of concurrency slots currently in use,
including active streams, reserved slots, and reset streams waiting for acknowledgement.
func (cc *http2ClientConn) currentRequestCountLocked() int
customDialTLS
method
#
func (t *Transport) customDialTLS(ctx context.Context, network string, addr string) (conn net.Conn, err error)
deadline
method
#
func (c *Client) deadline() time.Time
decConnsPerHost
method
#
decConnsPerHost decrements the per-host connection count for key,
which may in turn give a different waiting goroutine permission to dial.
func (t *Transport) decConnsPerHost(key connectMethodKey)
declareTrailer
method
#
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 *http2responseWriterState) declareTrailer(k string)
declareTrailer
method
#
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 (w *response) declareTrailer(k string)
decrStreamReservations
method
#
func (cc *http2ClientConn) decrStreamReservations()
decrStreamReservationsLocked
method
#
func (cc *http2ClientConn) decrStreamReservationsLocked()
defaultCheckRedirect
function
#
func defaultCheckRedirect(req *Request, via []*Request) error
defaultTransportDialContext
function
#
func defaultTransportDialContext(dialer *net.Dialer) (func(context.Context, string, string) (net.Conn, error))
defaultTransportDialContext
function
#
func defaultTransportDialContext(dialer *net.Dialer) (func(context.Context, string, string) (net.Conn, error))
describeConflict
function
#
describeConflict returns an explanation of why two patterns conflict.
func describeConflict(p1 *pattern, p2 *pattern) string
dial
method
#
run in its own goroutine.
func (c *http2dialCall) dial(ctx context.Context, addr string)
dial
method
#
func (t *Transport) dial(ctx context.Context, network string, addr string) (net.Conn, error)
dialClientConn
method
#
func (t *http2Transport) dialClientConn(ctx context.Context, addr string, singleUse bool) (*http2ClientConn, error)
dialConn
method
#
func (t *Transport) dialConn(ctx context.Context, cm connectMethod) (pconn *persistConn, err error)
dialConnFor
method
#
dialConnFor dials on behalf of w and delivers the result to w.
dialConnFor has received permission to dial w.cm and is counted in t.connCount[w.cm.key()].
If the dial is canceled or unsuccessful, dialConnFor decrements t.connCount[w.cm.key()].
func (t *Transport) dialConnFor(w *wantConn)
dialTLS
method
#
func (t *http2Transport) dialTLS(ctx context.Context, network string, addr string, tlsCfg *tls.Config) (net.Conn, error)
dialTLSWithContext
method
#
dialTLSWithContext uses tls.Dialer, added in Go 1.15, to open a TLS
connection.
func (t *http2Transport) dialTLSWithContext(ctx context.Context, network string, addr string, cfg *tls.Config) (*tls.Conn, error)
didEarlyClose
method
#
func (b *body) didEarlyClose() bool
differencePath
function
#
differencePath returns a path that p1 matches and p2 doesn't.
It assumes there is such a path.
func differencePath(p1 *pattern, p2 *pattern) string
dirList
function
#
func dirList(w ResponseWriter, r *Request, f File)
disableCompression
method
#
func (t *http2Transport) disableCompression() bool
disableKeepAlives
method
#
disableKeepAlives reports whether connections should be closed as
soon as possible after handling the first request.
func (t *http2Transport) disableKeepAlives() bool
disableWriteContinue
method
#
disableWriteContinue stops Request.Body.Read from sending an automatic 100-Continue.
If a 100-Continue is being written, it waits for it to complete before continuing.
func (w *response) disableWriteContinue()
do
method
#
func (c *Client) do(req *Request) (retres *Response, reterr error)
doBodyCopy
method
#
doBodyCopy wraps a copy operation, with any resulting error also
being saved in bodyReadError.
This function is only intended for use in writeBody.
func (t *transferWriter) doBodyCopy(dst io.Writer, src io.Reader) (n int64, err error)
doKeepAlives
method
#
func (s *Server) doKeepAlives() bool
doRequest
method
#
doRequest runs for the duration of the request lifetime.
It sends the request and performs post-request cleanup (closing Request.Body, etc.).
func (cs *http2clientStream) doRequest(req *Request, streamf func(*http2clientStream))
eachPair
method
#
eachPair calls f for each pair in the mapping.
If f returns false, pairs returns immediately.
func (h **ast.IndexListExpr) eachPair(f func(k K, v V) bool)
empty
method
#
func (q *http2writeQueue) empty() bool
encodeAndWriteHeaders
method
#
func (cs *http2clientStream) encodeAndWriteHeaders(req *Request) error
encodeTrailers
method
#
requires cc.wmu be held.
func (cc *http2ClientConn) encodeTrailers(trailer Header) ([]byte, error)
endStream
method
#
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 *http2stream) endStream()
endStream
method
#
func (rl *http2clientConnReadLoop) endStream(cs *http2clientStream)
endStreamError
method
#
func (rl *http2clientConnReadLoop) endStreamError(cs *http2clientStream, err error)
endWrite
method
#
func (f *http2Framer) endWrite() error
envProxyFunc
function
#
envProxyFunc returns a function that reads the
environment variable to determine the proxy address.
func envProxyFunc() (func(*url.URL) (*url.URL, error))
errNotSupported
function
#
errNotSupported returns an error that Is ErrNotSupported,
but is not == to it.
func errNotSupported() error
errorBody
method
#
func (h *timeoutHandler) errorBody() string
etagStrongMatch
function
#
etagStrongMatch reports whether a and b match using strong ETag comparison.
Assumes a and b are valid ETags.
func etagStrongMatch(a string, b string) bool
etagWeakMatch
function
#
etagWeakMatch reports whether a and b match using weak ETag comparison.
Assumes a and b are valid ETags.
func etagWeakMatch(a string, b string) bool
exactMatch
function
#
exactMatch reports whether the node's pattern exactly matches the path.
As a special case, if the node is nil, exactMatch return false.
Before wildcards were introduced, it was clear that an exact match meant
that the pattern and path were the same string. The only other possibility
was that a trailing-slash pattern, like "/", matched a path longer than
it, like "/a".
With wildcards, we define an inexact match as any one where a multi wildcard
matches a non-empty string. All other matches are exact.
For example, these are all exact matches:
pattern path
/a /a
/{x} /a
/a/{$} /a/
/a/ /a/
The last case has a multi wildcard (implicitly), but the match is exact because
the wildcard matches the empty string.
Examples of matches that are not exact:
pattern path
/ /a
/a/{x...} /a/b
func exactMatch(n *routingNode, path string) bool
expectContinueTimeout
method
#
func (t *http2Transport) expectContinueTimeout() time.Duration
expectsContinue
method
#
func (r *Request) expectsContinue() bool
finalFlush
method
#
func (c *conn) finalFlush()
finalTrailers
method
#
finalTrailers is called after the Handler exits and returns a non-nil
value if the Handler set any trailers.
func (w *response) finalTrailers() Header
find
method
#
find returns the value corresponding to the given key.
The second return value is false if there is no value
with that key.
func (h **ast.IndexListExpr) find(k K) (v V, found bool)
findChild
method
#
findChild returns the child of n with the given key, or nil
if there is no child with that key.
func (n *routingNode) findChild(key string) *routingNode
findHandler
method
#
findHandler finds a handler for a request.
If there is a matching handler, it returns it and the pattern that matched.
Otherwise it returns a Redirect or NotFound handler with the path that would match
after the redirect.
func (mux *ServeMux) findHandler(r *Request) (h Handler, patStr string, _ *pattern, matches []string)
findHandler
method
#
Formerly ServeMux.Handler.
func (mux *serveMux121) findHandler(r *Request) (h Handler, pattern string)
finish
method
#
func (pr *populateResponse) finish()
finishRequest
method
#
func (w *response) finishRequest()
firstSegment
function
#
firstSegment splits path into its first segment, and the rest.
The path must begin with "/".
If path consists of only a slash, firstSegment returns ("/", "").
The segment is returned unescaped, if possible.
func firstSegment(path string) (seg string, rest string)
fixLength
function
#
Determine the expected body length, using RFC 7230 Section 3.3. This
function is not a method, because ultimately it should be shared by
ReadResponse and ReadRequest.
func fixLength(isResponse bool, status int, requestMethod string, header Header, chunked bool) (n int64, err error)
fixPragmaCacheControl
function
#
RFC 7234, section 5.4: Should treat
Pragma: no-cache
like
Cache-Control: no-cache
func fixPragmaCacheControl(header Header)
fixTrailer
function
#
Parse the trailer header.
func fixTrailer(header Header, chunked bool) (Header, error)
flush
method
#
func (cw *chunkWriter) flush() error
forceCloseConn
method
#
A tls.Conn.Close can hang for a long time if the peer is unresponsive.
Try to shut it down more aggressively.
func (cc *http2ClientConn) forceCloseConn()
forgetStreamID
method
#
func (cc *http2ClientConn) forgetStreamID(id uint32)
frameScratchBufferLen
method
#
frameScratchBufferLen returns the length of a buffer to use for
outgoing request bodies to read/write to/from.
It returns max(1, min(peer's advertised max frame size,
Request.ContentLength+1, 512KB)).
func (cs *http2clientStream) frameScratchBufferLen(maxFrameSize int) int
get
method
#
get is like Get, but key must already be in CanonicalHeaderKey form.
func (h Header) get(key string) string
get
method
#
get returns an empty writeQueue.
func (p *http2writeQueuePool) get() *http2writeQueue
get1xxTraceFunc
method
#
get1xxTraceFunc returns the value of request's httptrace.ClientTrace.Got1xxResponse func,
if any. It returns nil if not set or if the Go version is too old.
func (cs *http2clientStream) get1xxTraceFunc() (func(int, textproto.MIMEHeader) error)
getClientConn
method
#
func (p *http2clientConnPool) getClientConn(req *Request, addr string, dialOnMiss bool) (*http2ClientConn, error)
getConn
method
#
getConn dials and creates a new persistConn to the target as
specified in the connectMethod. This includes doing a proxy CONNECT
and/or setting up TLS. If this doesn't return an error, the persistConn
is ready to write requests to.
func (t *Transport) getConn(treq *transportRequest, cm connectMethod) (_ *persistConn, err error)
getCopyBuf
function
#
func getCopyBuf() []byte
getCtxForDial
method
#
getCtxForDial returns context for dial or nil if connection was delivered or canceled.
func (w *wantConn) getCtxForDial() context.Context
getDataFrame
method
#
func (fc *http2frameCache) getDataFrame() *http2DataFrame
getStartDialLocked
method
#
requires p.mu is held.
func (p *http2clientConnPool) getStartDialLocked(ctx context.Context, addr string) *http2dialCall
getState
method
#
func (c *conn) getState() (state ConnState, unixSec int64)
goAway
method
#
func (sc *http2serverConn) goAway(code http2ErrCode)
handle
method
#
Formerly ServeMux.Handle.
func (mux *serveMux121) handle(pattern string, handler Handler)
handleFunc
method
#
Formerly ServeMux.HandleFunc.
func (mux *serveMux121) handleFunc(pattern string, handler func(ResponseWriter, *Request))
handlePingTimer
method
#
func (sc *http2serverConn) handlePingTimer(lastFrameReadTime time.Time)
handleReadError
method
#
handleReadError is called whenever a Read from the client returns a
non-nil error.
The provided non-nil err is almost always io.EOF or a "use of
closed network connection". In any case, the error is not
particularly interesting, except perhaps for debugging during
development. Any error means the connection is dead and we should
down its context.
It may be called from multiple goroutines.
func (cr *connReader) handleReadError(_ error)
handleResponse
method
#
may return error types nil, or ConnectionError. Any other error value
is a StreamError of type ErrCodeProtocol. The returned error in that case
is the detail.
As a special case, handleResponse may return (nil, nil) to skip the
frame (currently only used for 1xx responses).
func (rl *http2clientConnReadLoop) handleResponse(cs *http2clientStream, f *http2MetaHeadersFrame) (*Response, error)
handler
method
#
handler is the main implementation of findHandler.
The path is known to be in canonical form, except for CONNECT methods.
func (mux *serveMux121) handler(host string, path string) (h Handler, pattern string)
handler
method
#
func (o *http2ServeConnOpts) handler() Handler
handlerDone
method
#
func (sc *http2serverConn) handlerDone()
handlerDone
method
#
func (w *http2responseWriter) handlerDone()
has
method
#
has reports whether h has the provided key defined, even if it's
set to 0-length slice.
func (h Header) has(key string) bool
hasCustomTLSDialer
method
#
func (t *Transport) hasCustomTLSDialer() bool
hasNonemptyTrailers
method
#
func (rws *http2responseWriterState) hasNonemptyTrailers() bool
hasPort
function
#
Given a string of the form "host", "host:port", or "[ipv6::address]:port",
return true if the string includes a port.
func hasPort(s string) bool
hasToken
function
#
hasToken reports whether token appears with v, ASCII
case-insensitive, with space or comma boundaries.
token must be all lowercase.
v may contain mixed cased.
func hasToken(v string, token string) bool
hasTrailers
method
#
func (rws *http2responseWriterState) hasTrailers() bool
healthCheck
method
#
func (cc *http2ClientConn) healthCheck()
hexEscapeNonASCII
function
#
func hexEscapeNonASCII(s string) string
hijackLocked
method
#
c.mu must be held.
func (c *conn) hijackLocked() (rwc net.Conn, buf *bufio.ReadWriter, err error)
hijacked
method
#
func (c *conn) hijacked() bool
hitReadLimit
method
#
func (cr *connReader) hitReadLimit() bool
htmlEscape
function
#
func htmlEscape(s string) string
http1ServerSupportsRequest
function
#
http1ServerSupportsRequest reports whether Go's HTTP/1.x server
supports the given request.
func http1ServerSupportsRequest(req *Request) bool
http2ConfigureServer
function
#
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 http2ConfigureServer(s *Server, conf *http2Server) error
http2ConfigureServer
function
#
func http2ConfigureServer(s *Server, conf *http2Server) error
http2ConfigureTransport
function
#
ConfigureTransport configures a net/http HTTP/1 Transport to use HTTP/2.
It returns an error if t1 has already been HTTP/2-enabled.
Use ConfigureTransports instead to configure the HTTP/2 Transport.
func http2ConfigureTransport(t1 *Transport) error
http2ConfigureTransports
function
#
ConfigureTransports configures a net/http HTTP/1 Transport to use HTTP/2.
It returns a new HTTP/2 Transport for further configuration.
It returns an error if t1 has already been HTTP/2-enabled.
func http2ConfigureTransports(t1 *Transport) (*http2Transport, error)
http2NewFramer
function
#
NewFramer returns a Framer that writes frames to w and reads them from r.
func http2NewFramer(w io.Writer, r io.Reader) *http2Framer
http2NewPriorityWriteScheduler
function
#
NewPriorityWriteScheduler constructs a WriteScheduler that schedules
frames by following HTTP/2 priorities as described in RFC 7540 Section 5.3.
If cfg is nil, default options are used.
func http2NewPriorityWriteScheduler(cfg *http2PriorityWriteSchedulerConfig) http2WriteScheduler
http2NewPriorityWriteScheduler
function
#
func http2NewPriorityWriteScheduler(any) http2WriteScheduler
http2NewRandomWriteScheduler
function
#
NewRandomWriteScheduler constructs a WriteScheduler that ignores HTTP/2
priorities. Control frames like SETTINGS and PING are written before DATA
frames, but if no control frames are queued and multiple streams have queued
HEADERS or DATA frames, Pop selects a ready stream arbitrarily.
func http2NewRandomWriteScheduler() http2WriteScheduler
http2actualContentLength
function
#
actualContentLength returns a sanitized version of
req.ContentLength, where 0 actually means zero (not unknown) and -1
means unknown.
func http2actualContentLength(req *Request) int64
http2asciiEqualFold
function
#
asciiEqualFold is strings.EqualFold, ASCII only. It reports whether s and t
are equal, ASCII-case-insensitively.
func http2asciiEqualFold(s string, t string) bool
http2asciiToLower
function
#
asciiToLower returns the lowercase version of s if s is ASCII and printable,
and whether or not it was.
func http2asciiToLower(s string) (lower string, ok bool)
http2authorityAddr
function
#
authorityAddr returns a given authority (a host/IP, or host:port / ip:port)
and returns a host:port. The port 443 is added if needed.
func http2authorityAddr(scheme string, authority string) (addr string)
http2bodyAllowedForStatus
function
#
bodyAllowedForStatus reports whether a given response status code
permits a body. See RFC 7230, section 3.3.
func http2bodyAllowedForStatus(status int) bool
http2bufPoolIndex
function
#
func http2bufPoolIndex(size int) int
http2canRetryError
function
#
func http2canRetryError(err error) bool
http2commaSeparatedTrailers
function
#
func http2commaSeparatedTrailers(req *Request) (string, error)
http2configFromServer
function
#
configFromServer merges configuration settings from
net/http.Server.HTTP2Config and http2.Server.
func http2configFromServer(h1 *Server, h2 *http2Server) http2http2Config
http2configFromTransport
function
#
configFromServer merges configuration settings from h2 and h2.t1.HTTP2
(the net/http Transport).
func http2configFromTransport(h2 *http2Transport) http2http2Config
http2configureTransports
function
#
func http2configureTransports(t1 *Transport) (*http2Transport, error)
http2configureTransports
function
#
func http2configureTransports(*Transport) (*http2Transport, error)
http2curGoroutineID
function
#
func http2curGoroutineID() uint64
http2cutoff64
function
#
Return the first number n such that n*base >= 1<<64.
func http2cutoff64(base int) uint64
http2encKV
function
#
func http2encKV(enc *hpack.Encoder, k string, v string)
http2errno
function
#
errno returns v's underlying uintptr, else 0.
TODO: remove this helper function once http2 can use build
tags. See comment in isClosedConnError.
func http2errno(v error) uintptr
http2fillNetHTTPConfig
function
#
func http2fillNetHTTPConfig(conf *http2http2Config, h2 *HTTP2Config)
http2fillNetHTTPServerConfig
function
#
fillNetHTTPServerConfig sets fields in conf from srv.HTTP2.
func http2fillNetHTTPServerConfig(conf *http2http2Config, srv *Server)
http2fillNetHTTPTransportConfig
function
#
fillNetHTTPServerConfig sets fields in conf from tr.HTTP2.
func http2fillNetHTTPTransportConfig(conf *http2http2Config, tr *Transport)
http2filterOutClientConn
function
#
func http2filterOutClientConn(in []*http2ClientConn, exclude *http2ClientConn) []*http2ClientConn
http2getDataBufferChunk
function
#
func http2getDataBufferChunk(size int64) []byte
http2h1ServerKeepAlivesDisabled
function
#
h1ServerKeepAlivesDisabled reports whether hs has its keep-alives
disabled. See comments on h1ServerShutdownChan above for why
the code is written this way.
func http2h1ServerKeepAlivesDisabled(hs *Server) bool
http2handleHeaderListTooLong
function
#
func http2handleHeaderListTooLong(w ResponseWriter, r *Request)
http2httpCodeString
function
#
func http2httpCodeString(code int) string
http2isASCIIPrint
function
#
isASCIIPrint returns whether s is ASCII and printable according to
https://tools.ietf.org/html/rfc20#section-4.2.
func http2isASCIIPrint(s string) bool
http2isBadCipher
function
#
isBadCipher reports whether the cipher is blacklisted by the HTTP/2 spec.
References:
https://tools.ietf.org/html/rfc7540#appendix-A
Reject cipher suites from Appendix A.
"This list includes those cipher suites that do not
offer an ephemeral key exchange and those that are
based on the TLS null, stream or block cipher type"
func http2isBadCipher(cipher uint16) bool
http2isClosedConnError
function
#
isClosedConnError reports whether err is an error from use of a closed
network connection.
func http2isClosedConnError(err error) bool
http2isConnectionCloseRequest
function
#
isConnectionCloseRequest reports whether req should use its own
connection for a single request and then close the connection.
func http2isConnectionCloseRequest(req *Request) bool
http2isEOFOrNetReadError
function
#
func http2isEOFOrNetReadError(err error) bool
http2isNoCachedConnError
function
#
isNoCachedConnError reports whether err is of type noCachedConnError
or its equivalent renamed type in net/http2's h2_bundle.go. Both types
may coexist in the same running program.
func http2isNoCachedConnError(err error) bool
http2isNoCachedConnError
function
#
func http2isNoCachedConnError(err error) bool
http2lower
function
#
lower returns the ASCII lowercase version of b.
func http2lower(b byte) byte
http2mustUint31
function
#
func http2mustUint31(v int32) uint32
http2new400Handler
function
#
func http2new400Handler(err error) HandlerFunc
http2newBufferedWriter
function
#
func http2newBufferedWriter(group http2synctestGroupInterface, conn net.Conn, timeout time.Duration) *http2bufferedWriter
http2newGoroutineLock
function
#
func http2newGoroutineLock() http2goroutineLock
http2newRoundRobinWriteScheduler
function
#
newRoundRobinWriteScheduler constructs a new write scheduler.
The round robin scheduler priorizes control frames
like SETTINGS and PING over DATA frames.
When there are no control frames to send, it performs a round-robin
selection from the ready streams.
func http2newRoundRobinWriteScheduler() http2WriteScheduler
http2parseContinuationFrame
function
#
func http2parseContinuationFrame(_ *http2frameCache, fh http2FrameHeader, countError func(string), p []byte) (http2Frame, error)
http2parseDataFrame
function
#
func http2parseDataFrame(fc *http2frameCache, fh http2FrameHeader, countError func(string), payload []byte) (http2Frame, error)
http2parseGoAwayFrame
function
#
func http2parseGoAwayFrame(_ *http2frameCache, fh http2FrameHeader, countError func(string), p []byte) (http2Frame, error)
http2parsePingFrame
function
#
func http2parsePingFrame(_ *http2frameCache, fh http2FrameHeader, countError func(string), payload []byte) (http2Frame, error)
http2parsePriorityFrame
function
#
func http2parsePriorityFrame(_ *http2frameCache, fh http2FrameHeader, countError func(string), payload []byte) (http2Frame, error)
http2parsePushPromise
function
#
func http2parsePushPromise(_ *http2frameCache, fh http2FrameHeader, countError func(string), p []byte) (_ http2Frame, err error)
http2parseRSTStreamFrame
function
#
func http2parseRSTStreamFrame(_ *http2frameCache, fh http2FrameHeader, countError func(string), p []byte) (http2Frame, error)
http2parseSettingsFrame
function
#
func http2parseSettingsFrame(_ *http2frameCache, fh http2FrameHeader, countError func(string), p []byte) (http2Frame, error)
http2parseUintBytes
function
#
parseUintBytes is like strconv.ParseUint, but using a []byte.
func http2parseUintBytes(s []byte, base int, bitSize int) (n uint64, err error)
http2parseUnknownFrame
function
#
func http2parseUnknownFrame(_ *http2frameCache, fh http2FrameHeader, countError func(string), p []byte) (http2Frame, error)
http2parseWindowUpdateFrame
function
#
func http2parseWindowUpdateFrame(_ *http2frameCache, fh http2FrameHeader, countError func(string), p []byte) (http2Frame, error)
http2putDataBufferChunk
function
#
func http2putDataBufferChunk(p []byte)
http2readByte
function
#
func http2readByte(p []byte) (remain []byte, b byte, err error)
http2readUint32
function
#
func http2readUint32(p []byte) (remain []byte, v uint32, err error)
http2registerHTTPSProtocol
function
#
registerHTTPSProtocol calls Transport.RegisterProtocol but
converting panics into errors.
func http2registerHTTPSProtocol(t *Transport, rt http2noDialH2RoundTripper) (err error)
http2serverConnBaseContext
function
#
func http2serverConnBaseContext(c net.Conn, opts *http2ServeConnOpts) (ctx context.Context, cancel func())
http2setConfigDefaults
function
#
func http2setConfigDefaults(conf *http2http2Config, server bool)
http2setDefault
function
#
func http2setDefault(v *T, minval T, maxval T, defval T)
http2shouldRetryDial
function
#
shouldRetryDial reports whether the current request should
retry dialing after the call finished unsuccessfully, for example
if the dial was canceled because of a context cancellation or
deadline expiry.
func http2shouldRetryDial(call *http2dialCall, req *Request) bool
http2shouldRetryRequest
function
#
shouldRetryRequest is called by RoundTrip when a request fails to get
response headers. It is always called with a non-nil error.
It returns either a request to retry (either the same request, or a
modified clone), or an error if the request can't be replayed.
func http2shouldRetryRequest(req *Request, err error) (*Request, error)
http2shouldSendReqContentLength
function
#
shouldSendReqContentLength reports whether the http2.Transport should send
a "content-length" request header. This logic is basically a copy of the net/http
transferWriter.shouldSendContentLength.
The contentLength is the corrected contentLength (so 0 means actually 0, not unknown).
-1 means unknown.
func http2shouldSendReqContentLength(method string, contentLength int64) bool
http2strSliceContains
function
#
func http2strSliceContains(ss []string, s string) bool
http2streamError
function
#
func http2streamError(id uint32, code http2ErrCode) http2StreamError
http2summarizeFrame
function
#
func http2summarizeFrame(f http2Frame) string
http2takeInflows
function
#
takeInflows attempts to take n bytes from two inflows,
typically connection-level and stream-level flows.
It reports whether both windows have available capacity.
func http2takeInflows(f1 *http2inflow, f2 *http2inflow, n uint32) bool
http2terminalReadFrameError
function
#
terminalReadFrameError reports whether err is an unrecoverable
error from ReadFrame and no other frames should be read.
func http2terminalReadFrameError(err error) bool
http2traceFirstResponseByte
function
#
func http2traceFirstResponseByte(trace *httptrace.ClientTrace)
http2traceGetConn
function
#
func http2traceGetConn(req *Request, hostPort string)
http2traceGot100Continue
function
#
func http2traceGot100Continue(trace *httptrace.ClientTrace)
http2traceGot1xxResponseFunc
function
#
func http2traceGot1xxResponseFunc(trace *httptrace.ClientTrace) (func(int, textproto.MIMEHeader) error)
http2traceGotConn
function
#
func http2traceGotConn(req *Request, cc *http2ClientConn, reused bool)
http2traceWait100Continue
function
#
func http2traceWait100Continue(trace *httptrace.ClientTrace)
http2traceWroteRequest
function
#
func http2traceWroteRequest(trace *httptrace.ClientTrace, err error)
http2typeFrameParser
function
#
func http2typeFrameParser(t http2FrameType) http2frameParser
http2unencryptedNetConnFromTLSConn
function
#
unencryptedNetConnFromTLSConn retrieves a net.Conn wrapped in a *tls.Conn.
TLSNextProto functions accept a *tls.Conn.
When passing an unencrypted HTTP/2 connection to a TLSNextProto function,
we pass a *tls.Conn with an underlying net.Conn containing the unencrypted connection.
To be extra careful about mistakes (accidentally dropping TLS encryption in a place
where we want it), the tls.Conn contains a net.Conn with an UnencryptedNetConn method
that returns the actual connection we want to use.
func http2unencryptedNetConnFromTLSConn(tc *tls.Conn) (net.Conn, error)
http2validPseudoPath
function
#
validPseudoPath reports whether v is a valid :path pseudo-header
value. It must be either:
- a non-empty string starting with '/'
- the string '*', for OPTIONS requests.
For now this is only used a quick check for deciding when to clean
up Opaque URLs before sending requests from the Transport.
See golang.org/issue/16847
We used to enforce that the path also didn't start with "//", but
Google's GFE accepts such paths and Chrome sends them, so ignore
that part of the spec. See golang.org/issue/19103.
func http2validPseudoPath(v string) bool
http2validStreamID
function
#
func http2validStreamID(streamID uint32) bool
http2validStreamIDOrZero
function
#
func http2validStreamIDOrZero(streamID uint32) bool
http2writeEndsStream
function
#
writeEndsStream reports whether w writes a frame that will transition
the stream to a half-closed local state. This returns false for RST_STREAM,
which closes the entire stream (not just the local half).
func http2writeEndsStream(w http2writeFramer) bool
http2writeWithByteTimeout
function
#
writeWithByteTimeout writes to conn.
If more than timeout passes without any bytes being written to the connection,
the write fails.
func http2writeWithByteTimeout(group http2synctestGroupInterface, conn net.Conn, timeout time.Duration, p []byte) (n int, err error)
idleConnTimeout
method
#
func (t *http2Transport) idleConnTimeout() time.Duration
idleState
method
#
func (cc *http2ClientConn) idleState() http2clientConnIdleState
idleState
method
#
func (cc *http2clientConn) idleState() http2clientConnIdleState
idleStateLocked
method
#
func (cc *http2ClientConn) idleStateLocked() (st http2clientConnIdleState)
idleTimeout
method
#
func (s *Server) idleTimeout() time.Duration
idnaASCII
function
#
func idnaASCII(v string) (string, error)
idnaASCIIFromURL
function
#
func idnaASCIIFromURL(url *url.URL) string
init
function
#
Read httpmuxgo121 once at startup, since dealing with changes to it during
program execution is too complex and error-prone.
func init()
init
function
#
func init()
init
method
#
init sets the initial window.
func (f *http2inflow) init(n int32)
init
function
#
func init()
initConnPool
method
#
func (t *http2Transport) initConnPool()
initialReadLimitSize
method
#
func (s *Server) initialReadLimitSize() int64
invalidate
method
#
func (h *http2FrameHeader) invalidate()
inverseRelationship
function
#
If p1 has relationship `r` to p2, then
p2 has inverseRelationship(r) to p1.
func inverseRelationship(r relationship) relationship
is408Message
function
#
is408Message reports whether buf has the prefix of an
HTTP 408 Request Timeout response.
See golang.org/issue/32310.
func is408Message(buf []byte) bool
isBroken
method
#
isBroken reports whether this connection is in a known broken state.
func (pc *persistConn) isBroken() bool
isCommonNetReadError
function
#
isCommonNetReadError reports whether err is a common error
encountered during reading a request off the network when the
client has gone away or had its read fail somehow. This is used to
determine which logs are interesting enough to log about.
func isCommonNetReadError(err error) bool
isControl
method
#
isControl reports whether wr is a control frame for MaxQueuedControlFrames
purposes. That includes non-stream frames and RST_STREAM frames.
func (wr http2FrameWriteRequest) isControl() bool
isCookieDomainName
function
#
isCookieDomainName reports whether s is a valid domain name or a valid
domain name with a leading dot '.'. It is almost a direct copy of
package net's isDomainName.
func isCookieDomainName(s string) bool
isCookieNameValid
function
#
func isCookieNameValid(raw string) bool
isDir
method
#
func (d dirEntryDirs) isDir(i int) bool
isDir
method
#
func (d fileInfoDirs) isDir(i int) bool
isDoNotReuseAndIdle
method
#
func (cc *http2ClientConn) isDoNotReuseAndIdle() bool
isDomainOrSubdomain
function
#
isDomainOrSubdomain reports whether sub is a subdomain (or exact
match) of the parent domain.
Both domains must already be in canonical form.
func isDomainOrSubdomain(sub string, parent string) bool
isH2Upgrade
method
#
isH2Upgrade reports whether r represents the http2 "client preface"
magic string.
func (r *Request) isH2Upgrade() bool
isIdentity
function
#
Checks whether the encoding is explicitly "identity".
func isIdentity(te []string) bool
isKnownInMemoryReader
function
#
isKnownInMemoryReader reports whether r is a type known to not
block on Read. Its caller uses this as an optional optimization to
send fewer TCP packets.
func isKnownInMemoryReader(r io.Reader) bool
isLitOrSingle
function
#
isLitOrSingle reports whether the segment is a non-dollar literal or a single wildcard.
func isLitOrSingle(seg segment) bool
isNotToken
function
#
func isNotToken(r rune) bool
isProtocolSwitch
method
#
isProtocolSwitch reports whether the response code and header
indicate a successful protocol upgrade response.
func (r *Response) isProtocolSwitch() bool
isProtocolSwitchResponse
function
#
isProtocolSwitchResponse reports whether the response code and
response header indicate a successful protocol upgrade response.
func isProtocolSwitchResponse(code int, h Header) bool
isPushed
method
#
isPushed reports whether the stream is server-initiated.
func (st *http2stream) isPushed() bool
isReplayable
method
#
func (r *Request) isReplayable() bool
isReused
method
#
isReused reports whether this connection has been used before.
func (pc *persistConn) isReused() bool
isSlashRune
function
#
func isSlashRune(r rune) bool
isTT
function
#
isTT reports whether the provided byte is a tag-terminating byte (0xTT)
as defined in https://mimesniff.spec.whatwg.org/#terminology.
func isTT(b byte) bool
isTokenBoundary
function
#
func isTokenBoundary(b byte) bool
isUnsupportedTEError
function
#
isUnsupportedTEError checks if the error is of type
unsupportedTEError. It is usually invoked with a non-nil err.
func isUnsupportedTEError(err error) bool
isValidWildcardName
function
#
func isValidWildcardName(s string) bool
isWS
function
#
isWS reports whether the provided byte is a whitespace byte (0xWS)
as defined in https://mimesniff.spec.whatwg.org/#terminology.
func isWS(b byte) bool
isZeroTime
function
#
isZeroTime reports whether t is obviously unspecified (either zero or Unix()=0).
func isZeroTime(t time.Time) bool
key
method
#
func (cm *connectMethod) key() connectMethodKey
knownRoundTripperImpl
function
#
knownRoundTripperImpl reports whether rt is a RoundTripper that's
maintained by the Go team and known to implement the latest
optional semantics (notably contexts). The Request is used
to check whether this particular request is using an alternate protocol,
in which case we need to check the RoundTripper for that protocol.
func knownRoundTripperImpl(rt RoundTripper, req *Request) bool
lastChunkOrAlloc
method
#
func (b *http2dataBuffer) lastChunkOrAlloc(want int64) []byte
lastSegment
method
#
func (p *pattern) lastSegment() segment
len
method
#
len returns the number of items in the cache.
func (cl *connLRU) len() int
len
method
#
func (d fileInfoDirs) len() int
len
method
#
func (d dirEntryDirs) len() int
len
method
#
len returns the number of items in the queue.
func (q *wantConnQueue) len() int
localRedirect
function
#
localRedirect gives a Moved Permanently response.
It does not convert relative paths to absolute paths like Redirect does.
func localRedirect(w ResponseWriter, r *Request, newPath string)
lock
method
#
func (cr *connReader) lock()
logWrite
method
#
func (f *http2Framer) logWrite()
logf
method
#
func (sc *http2serverConn) logf(format string, args ...interface{})
logf
method
#
func (t *http2Transport) logf(format string, args ...interface{})
logf
method
#
func (cc *http2ClientConn) logf(format string, args ...interface{})
logf
method
#
func (tr *transportRequest) logf(format string, args ...any)
logf
method
#
func (s *Server) logf(format string, args ...any)
logf
function
#
logf prints to the ErrorLog of the *Server associated with request r
via ServerContextKey. If there's no associated server, or if ErrorLog
is nil, logging is done via the log package's standard logger.
func logf(r *Request, format string, args ...any)
mapOpenError
function
#
mapOpenError maps the provided non-nil error from opening name
to a possibly better non-nil error. In particular, it turns OS-specific errors
about opening files in non-directories into fs.ErrNotExist. See Issues 18984 and 49552.
func mapOpenError(originalErr error, name string, sep rune, stat func(string) (fs.FileInfo, error)) error
mapRoundTripError
method
#
mapRoundTripError returns the appropriate error value for
persistConn.roundTrip.
The provided err is the first error that (*persistConn).roundTrip
happened to receive from its select statement.
The startBytesWritten value should be the value of pc.nwrite before the roundTrip
started writing the request.
func (pc *persistConn) mapRoundTripError(req *transportRequest, startBytesWritten int64, err error) error
markNewGoroutine
method
#
func (t *http2Transport) markNewGoroutine()
markNewGoroutine
method
#
func (s *http2Server) markNewGoroutine()
markReused
method
#
markReused marks this connection as having been successfully used for a
request and response.
func (pc *persistConn) markReused()
match
method
#
func (h htmlSig) match(data []byte, firstNonWS int) string
match
method
#
match returns the leaf node under root that matches the arguments, and a list
of values for pattern wildcards in the order that the wildcards appear.
For example, if the request path is "/a/b/c" and the pattern is "/{x}/b/{y}",
then the second return value will be []string{"a", "c"}.
func (root *routingNode) match(host string, method string, path string) (*routingNode, []string)
match
method
#
Find a handler on a handler map given a path string.
Most-specific (longest) pattern wins.
func (mux *serveMux121) match(path string) (h Handler, pattern string)
match
method
#
func (m *maskedSig) match(data []byte, firstNonWS int) string
match
method
#
func (e *exactSig) match(data []byte, firstNonWS int) string
match
method
#
func (mp4Sig) match(data []byte, firstNonWS int) string
match
method
#
func (textSig) match(data []byte, firstNonWS int) string
matchMethodAndPath
method
#
matchMethodAndPath matches the method and path.
Its return values are the same as [routingNode.match].
The receiver should be a child of the root.
func (n *routingNode) matchMethodAndPath(method string, path string) (*routingNode, []string)
matchOrRedirect
method
#
matchOrRedirect looks up a node in the tree that matches the host, method and path.
If the url argument is non-nil, handler also deals with trailing-slash
redirection: when a path doesn't match exactly, the match is tried again
after appending "/" to the path. If that second match succeeds, the last
return value is the URL to redirect to.
func (mux *ServeMux) matchOrRedirect(host string, method string, path string, u *url.URL) (_ *routingNode, matches []string, redirectTo *url.URL)
matchPath
method
#
matchPath matches a path.
Its return values are the same as [routingNode.match].
matchPath calls itself recursively. The matches argument holds the wildcard matches
found so far.
func (n *routingNode) matchPath(path string, matches []string) (*routingNode, []string)
matchingMethods
method
#
matchingMethods adds to methodSet all the methods that would result in a
match if passed to routingNode.match with the given host and path.
func (root *routingNode) matchingMethods(host string, path string, methodSet map[string]bool)
matchingMethods
method
#
matchingMethods return a sorted list of all methods that would match with the given host and path.
func (mux *ServeMux) matchingMethods(host string, path string) []string
matchingMethodsPath
method
#
func (n *routingNode) matchingMethodsPath(path string, set map[string]bool)
maxIdleConnsPerHost
method
#
func (t *Transport) maxIdleConnsPerHost() int
maybeServeUnencryptedHTTP2
method
#
func (c *conn) maybeServeUnencryptedHTTP2(ctx context.Context) bool
multipartReader
method
#
func (r *Request) multipartReader(allowMixed bool) (*multipart.Reader, error)
name
method
#
func (d dirEntryDirs) name(i int) string
name
method
#
func (d fileInfoDirs) name(i int) string
newBufioReader
function
#
newBufioReader should be an internal detail,
but widely used packages access it using linkname.
Notable members of the hall of shame include:
- github.com/gobwas/ws
Do not remove or change the type signature.
See go.dev/issue/67401.
go:linkname newBufioReader
func newBufioReader(r io.Reader) *bufio.Reader
newBufioWriterSize
function
#
newBufioWriterSize should be an internal detail,
but widely used packages access it using linkname.
Notable members of the hall of shame include:
- github.com/gobwas/ws
Do not remove or change the type signature.
See go.dev/issue/67401.
go:linkname newBufioWriterSize
func newBufioWriterSize(w io.Writer, size int) *bufio.Writer
newClientConn
method
#
func (t *http2Transport) newClientConn(c net.Conn, singleUse bool) (*http2ClientConn, error)
newConn
method
#
Create new connection from rwc.
func (s *Server) newConn(rwc net.Conn) *conn
newLoggingConn
function
#
func newLoggingConn(baseName string, c net.Conn) net.Conn
newPopulateResponseWriter
function
#
func newPopulateResponseWriter() (*populateResponse, <-chan *Response)
newReadWriteCloserBody
function
#
func newReadWriteCloserBody(br *bufio.Reader, rwc io.ReadWriteCloser) io.ReadWriteCloser
newResponseWriter
method
#
func (sc *http2serverConn) newResponseWriter(st *http2stream, req *Request) *http2responseWriter
newStream
method
#
func (sc *http2serverConn) newStream(id uint32, pusherID uint32, state http2streamState) *http2stream
newTLSConfig
method
#
func (t *http2Transport) newTLSConfig(host string) *tls.Config
newTextprotoReader
function
#
func newTextprotoReader(br *bufio.Reader) *textproto.Reader
newTimer
method
#
newTimer creates a new time.Timer, or a synthetic timer in tests.
func (s *http2Server) newTimer(d time.Duration) http2timer
newTimer
method
#
newTimer creates a new time.Timer, or a synthetic timer in tests.
func (t *http2Transport) newTimer(d time.Duration) http2timer
newTransferWriter
function
#
func newTransferWriter(r any) (t *transferWriter, err error)
newWriterAndRequest
method
#
func (sc *http2serverConn) newWriterAndRequest(st *http2stream, f *http2MetaHeadersFrame) (*http2responseWriter, *Request, error)
newWriterAndRequestNoBody
method
#
func (sc *http2serverConn) newWriterAndRequestNoBody(st *http2stream, rp http2requestParam) (*http2responseWriter, *Request, error)
noResponseBodyExpected
function
#
func noResponseBodyExpected(requestMethod string) bool
nop
function
#
func nop()
noteBodyRead
method
#
func (sc *http2serverConn) noteBodyRead(st *http2stream, n int)
noteBodyReadFromHandler
method
#
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 *http2serverConn) noteBodyReadFromHandler(st *http2stream, n int, err error)
notePanic
method
#
func (sc *http2serverConn) notePanic()
now
method
#
func (s *http2Server) now() time.Time
now
method
#
func (t *http2Transport) now() time.Time
numLeadingCRorLF
function
#
func numLeadingCRorLF(v []byte) (n int)
onIdleTimeout
method
#
onIdleTimeout is called from a time.AfterFunc goroutine. It will
only be called when we're idle, but because we're coming from a new
goroutine, there could be a new request coming in at the same time,
so this simply calls the synchronized closeIfIdle to shut down this
connection. The timer could just call closeIfIdle, but this is more
clear.
func (cc *http2ClientConn) onIdleTimeout()
onIdleTimer
method
#
func (sc *http2serverConn) onIdleTimer()
onReadIdleTimer
method
#
func (sc *http2serverConn) onReadIdleTimer()
onReadTimeout
method
#
onReadTimeout is run on its own goroutine (from time.AfterFunc)
when the stream's ReadTimeout has fired.
func (st *http2stream) onReadTimeout()
onSettingsTimer
method
#
func (sc *http2serverConn) onSettingsTimer()
onShutdownTimer
method
#
func (sc *http2serverConn) onShutdownTimer()
onWriteTimeout
method
#
onWriteTimeout is run on its own goroutine (from time.AfterFunc)
when the stream's WriteTimeout has fired.
func (st *http2stream) onWriteTimeout()
onceSetNextProtoDefaults
method
#
onceSetNextProtoDefaults configures HTTP/2, if the user hasn't
configured otherwise. (by setting s.TLSNextProto non-nil)
It must only be called via s.nextProtoOnce (use s.setupHTTP2_*).
func (s *Server) onceSetNextProtoDefaults()
onceSetNextProtoDefaults
method
#
onceSetNextProtoDefaults initializes TLSNextProto.
It must be called via t.nextProtoOnce.Do.
func (t *Transport) onceSetNextProtoDefaults()
onceSetNextProtoDefaults_Serve
method
#
func (s *Server) onceSetNextProtoDefaults_Serve()
outgoingLength
method
#
outgoingLength reports the Content-Length of this outgoing (Client) request.
It maps 0 into -1 (unknown) when the Body is non-nil.
func (r *Request) outgoingLength() int64
parseBasicAuth
function
#
parseBasicAuth parses an HTTP Basic Authentication string.
"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" returns ("Aladdin", "open sesame", true).
parseBasicAuth should be an internal detail,
but widely used packages access it using linkname.
Notable members of the hall of shame include:
- github.com/sagernet/sing
Do not remove or change the type signature.
See go.dev/issue/67401.
go:linkname parseBasicAuth
func parseBasicAuth(auth string) (username string, password string, ok bool)
parseContentLength
function
#
parseContentLength checks that the header is valid and then trims
whitespace. It returns -1 if no value is set otherwise the value
if it's >= 0.
func parseContentLength(clHeaders []string) (int64, error)
parseCookieValue
function
#
parseCookieValue parses a cookie value according to RFC 6265.
If allowDoubleQuote is true, parseCookieValue will consider that it
is parsing the cookie-value;
otherwise, it will consider that it is parsing a cookie-av value
(cookie attribute-value).
It returns the parsed cookie value, a boolean indicating whether the
parsing was successful, and a boolean indicating whether the parsed
value was enclosed in double quotes.
func parseCookieValue(raw string, allowDoubleQuote bool) (value string, quoted bool, ok bool)
parsePattern
function
#
parsePattern parses a string into a Pattern.
The string's syntax is
[METHOD] [HOST]/[PATH]
where:
- METHOD is an HTTP method
- HOST is a hostname
- PATH consists of slash-separated segments, where each segment is either
a literal or a wildcard of the form "{name}", "{name...}", or "{$}".
METHOD, HOST and PATH are all optional; that is, the string can be "/".
If METHOD is present, it must be followed by at least one space or tab.
Wildcard names must be valid Go identifiers.
The "{$}" and "{name...}" wildcard must occur at the end of PATH.
PATH may end with a '/'.
Wildcard names in a path must be distinct.
func parsePattern(s string) (_ *pattern, err error)
parsePostForm
function
#
func parsePostForm(r *Request) (vs url.Values, err error)
parseRange
function
#
parseRange parses a Range header string as per RFC 7233.
errNoOverlap is returned if none of the ranges overlap.
func parseRange(s string, size int64) ([]httpRange, error)
parseRequestLine
function
#
parseRequestLine parses "GET /foo HTTP/1.1" into its three parts.
func parseRequestLine(line string) (method string, requestURI string, proto string, ok bool)
parseTransferEncoding
method
#
parseTransferEncoding sets t.Chunked based on the Transfer-Encoding header.
func (t *transferReader) parseTransferEncoding() error
patIndex
method
#
patIndex returns the index of name in the list of named wildcards of the
request's pattern, or -1 if there is no such name.
func (r *Request) patIndex(name string) int
pathAddrs
method
#
func (d *socksDialer) pathAddrs(address string) (proxy net.Addr, dst net.Addr, err error)
pathUnescape
function
#
func pathUnescape(path string) string
peekFront
method
#
peekFront returns the wantConn at the front of the queue without removing it.
func (q *wantConnQueue) peekFront() *wantConn
popFront
method
#
popFront removes and returns the wantConn at the front of the queue.
func (q *wantConnQueue) popFront() *wantConn
possiblyConflictingPatterns
method
#
possiblyConflictingPatterns calls f on all patterns that might conflict with
pat. If f returns a non-nil error, possiblyConflictingPatterns returns immediately
with that error.
To be correct, possiblyConflictingPatterns must include all patterns that
might conflict. But it may also include patterns that cannot conflict.
For instance, an implementation that returns all registered patterns is correct.
We use this fact throughout, simplifying the implementation by returning more
patterns that we might need to.
func (idx *routingIndex) possiblyConflictingPatterns(pat *pattern, f func(*pattern) error) (err error)
prepareTransportCancel
method
#
prepareTransportCancel sets up state to convert Transport.CancelRequest into context cancelation.
func (t *Transport) prepareTransportCancel(req *Request, origCancel context.CancelCauseFunc) context.CancelCauseFunc
probeRequestBody
method
#
probeRequestBody reads a byte from t.Body to see whether it's empty
(returns io.EOF right away).
But because we've had problems with this blocking users in the past
(issue 17480) when the body is a pipe (perhaps waiting on the response
headers before the pipe is fed data), we need to be careful and bound how
long we wait for it. This delay will only affect users if all the following
are true:
- the request body blocks
- the content length is not set (or set to -1)
- the method doesn't usually have a body (GET, HEAD, DELETE, ...)
- there is no transfer-encoding=chunked already set.
In other words, this delay will not normally affect anybody, and there
are workarounds if it does.
func (t *transferWriter) probeRequestBody()
processData
method
#
func (rl *http2clientConnReadLoop) processData(f *http2DataFrame) error
processData
method
#
func (sc *http2serverConn) processData(f *http2DataFrame) error
processFrame
method
#
func (sc *http2serverConn) processFrame(f http2Frame) error
processFrameFromReader
method
#
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 *http2serverConn) processFrameFromReader(res http2readFrameResult) bool
processGoAway
method
#
func (rl *http2clientConnReadLoop) processGoAway(f *http2GoAwayFrame) error
processGoAway
method
#
func (sc *http2serverConn) processGoAway(f *http2GoAwayFrame) error
processPing
method
#
func (sc *http2serverConn) processPing(f *http2PingFrame) error
processPing
method
#
func (rl *http2clientConnReadLoop) processPing(f *http2PingFrame) error
processPriority
method
#
func (sc *http2serverConn) processPriority(f *http2PriorityFrame) error
processPushPromise
method
#
func (rl *http2clientConnReadLoop) processPushPromise(f *http2PushPromiseFrame) error
processResetStream
method
#
func (sc *http2serverConn) processResetStream(f *http2RSTStreamFrame) error
processResetStream
method
#
func (rl *http2clientConnReadLoop) processResetStream(f *http2RSTStreamFrame) error
processSetting
method
#
func (sc *http2serverConn) processSetting(s http2Setting) error
processSettingInitialWindowSize
method
#
func (sc *http2serverConn) processSettingInitialWindowSize(val uint32) error
processSettings
method
#
func (rl *http2clientConnReadLoop) processSettings(f *http2SettingsFrame) error
processSettings
method
#
func (sc *http2serverConn) processSettings(f *http2SettingsFrame) error
processSettingsNoWrite
method
#
func (rl *http2clientConnReadLoop) processSettingsNoWrite(f *http2SettingsFrame) error
processTrailers
method
#
func (rl *http2clientConnReadLoop) processTrailers(cs *http2clientStream, f *http2MetaHeadersFrame) error
processWindowUpdate
method
#
func (rl *http2clientConnReadLoop) processWindowUpdate(f *http2WindowUpdateFrame) error
processWindowUpdate
method
#
func (sc *http2serverConn) processWindowUpdate(f *http2WindowUpdateFrame) error
promoteUndeclaredTrailers
method
#
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 *http2responseWriterState) promoteUndeclaredTrailers()
protoAtLeast
method
#
func (t *transferReader) protoAtLeast(m int, n int) bool
protocols
method
#
func (s *Server) protocols() Protocols
protocols
method
#
func (t *Transport) protocols() Protocols
proxyAuth
method
#
proxyAuth returns the Proxy-Authorization header to set
on requests, if applicable.
func (cm *connectMethod) proxyAuth() string
push
method
#
func (q *http2writeQueue) push(wr http2FrameWriteRequest)
pushBack
method
#
pushBack adds w to the back of the queue.
func (q *wantConnQueue) pushBack(w *wantConn)
put
method
#
put inserts an unused writeQueue into the pool.
func (p *http2writeQueuePool) put(q *http2writeQueue)
putBufioReader
function
#
putBufioReader should be an internal detail,
but widely used packages access it using linkname.
Notable members of the hall of shame include:
- github.com/gobwas/ws
Do not remove or change the type signature.
See go.dev/issue/67401.
go:linkname putBufioReader
func putBufioReader(br *bufio.Reader)
putBufioWriter
function
#
putBufioWriter should be an internal detail,
but widely used packages access it using linkname.
Notable members of the hall of shame include:
- github.com/gobwas/ws
Do not remove or change the type signature.
See go.dev/issue/67401.
go:linkname putBufioWriter
func putBufioWriter(bw *bufio.Writer)
putCopyBuf
function
#
func putCopyBuf(b []byte)
putOrCloseIdleConn
method
#
func (t *Transport) putOrCloseIdleConn(pconn *persistConn)
putTextprotoReader
function
#
func putTextprotoReader(r *textproto.Reader)
queueForDial
method
#
queueForDial queues w to wait for permission to begin dialing.
Once w receives permission to dial, it will do so in a separate goroutine.
func (t *Transport) queueForDial(w *wantConn)
queueForIdleConn
method
#
queueForIdleConn queues w to receive the next idle connection for w.cm.
As an optimization hint to the caller, queueForIdleConn reports whether
it successfully delivered an already-idle connection.
func (t *Transport) queueForIdleConn(w *wantConn) (delivered bool)
rangesMIMESize
function
#
rangesMIMESize returns the number of bytes it takes to encode the
provided ranges as a multipart response.
func rangesMIMESize(ranges []httpRange, contentType string, contentSize int64) (encSize int64)
readBufferSize
method
#
func (t *Transport) readBufferSize() int
readCookies
function
#
readCookies parses all "Cookie" values from the header h and
returns the successfully parsed Cookies.
if filter isn't empty, only cookies of that name are returned.
func readCookies(h Header, filter string) []*Cookie
readFrames
method
#
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 *http2serverConn) readFrames()
readLocked
method
#
Must hold b.mu.
func (b *body) readLocked(p []byte) (n int, err error)
readLoop
method
#
readLoop runs in its own goroutine and reads and dispatches frames.
func (cc *http2ClientConn) readLoop()
readLoop
method
#
func (pc *persistConn) readLoop()
readLoopPeekFailLocked
method
#
func (pc *persistConn) readLoopPeekFailLocked(peekErr error)
readMetaFrame
method
#
readMetaFrame returns 0 or more CONTINUATION frames from fr and
merge them into the provided hf and returns a MetaHeadersFrame
with the decoded hpack values.
func (fr *http2Framer) readMetaFrame(hf *http2HeadersFrame) (http2Frame, error)
readPreface
method
#
readPreface reads the ClientPreface greeting from the peer or
returns errPrefaceTimeout on timeout, or an error if the greeting
is invalid.
func (sc *http2serverConn) readPreface() error
readRequest
function
#
readRequest should be an internal detail,
but widely used packages access it using linkname.
Notable members of the hall of shame include:
- github.com/sagernet/sing
- github.com/v2fly/v2ray-core/v4
- github.com/v2fly/v2ray-core/v5
Do not remove or change the type signature.
See go.dev/issue/67401.
go:linkname readRequest
func readRequest(b *bufio.Reader) (req *Request, err error)
readRequest
method
#
Read next request from connection.
func (c *conn) readRequest(ctx context.Context) (w *response, err error)
readResponse
method
#
readResponse reads an HTTP response (or two, in the case of "Expect:
100-continue") from the server. It returns the final non-100 one.
trace is optional.
func (pc *persistConn) readResponse(rc requestAndChan, trace *httptrace.ClientTrace) (resp *Response, err error)
readSetCookies
function
#
readSetCookies parses all "Set-Cookie" values from
the header h and returns the successfully parsed Cookies.
func readSetCookies(h Header) []*Cookie
readTrailer
method
#
func (b *body) readTrailer() error
readTransfer
function
#
msg is *Request or *Response.
func readTransfer(msg any, r *bufio.Reader) (err error)
redirectBehavior
function
#
redirectBehavior describes what should happen when the
client encounters a 3xx status code from the server.
func redirectBehavior(reqMethod string, resp *Response, ireq *Request) (redirectMethod string, shouldRedirect bool, includeBody bool)
redirectToPathSlash
method
#
redirectToPathSlash determines if the given path needs appending "/" to it.
This occurs when a handler for path + "/" was already registered, but
not for path itself. If the path needs appending to, it creates a new
URL, setting the path to u.Path + "/" and returning true to indicate so.
func (mux *serveMux121) redirectToPathSlash(host string, path string, u *url.URL) (*url.URL, bool)
refererForURL
function
#
refererForURL returns a referer without any authentication info or
an empty string if lastReq scheme is https and newReq scheme is http.
If the referer was explicitly set, then it will continue to be used.
func refererForURL(lastReq *url.URL, newReq *url.URL, explicitRef string) string
register
method
#
func (mux *ServeMux) register(pattern string, handler Handler)
registerConn
method
#
func (s *http2serverInternalState) registerConn(sc *http2serverConn)
registerErr
method
#
func (mux *ServeMux) registerErr(patstr string, handler Handler) error
registerOnHitEOF
function
#
func registerOnHitEOF(rc io.ReadCloser, fn func())
registerOnHitEOF
method
#
func (b *body) registerOnHitEOF(fn func())
rejectConn
method
#
func (sc *http2serverConn) rejectConn(err http2ErrCode, debug string)
relevantCaller
function
#
relevantCaller searches the call stack for the first function outside of net/http.
The purpose of this function is to provide more helpful error messages.
func relevantCaller() runtime.Frame
remove
method
#
remove removes pc from cl.
func (cl *connLRU) remove(pc *persistConn)
removeEmptyPort
function
#
removeEmptyPort strips the empty port in ":port" to ""
as mandated by RFC 3986 Section 6.2.3.
func removeEmptyPort(host string) string
removeIdleConn
method
#
removeIdleConn marks pconn as dead.
func (t *Transport) removeIdleConn(pconn *persistConn) bool
removeIdleConnLocked
method
#
t.idleMu must be held.
func (t *Transport) removeIdleConnLocked(pconn *persistConn) bool
removeNode
method
#
func (ws *http2priorityWriteScheduler) removeNode(n *http2priorityNode)
removeOldest
method
#
func (cl *connLRU) removeOldest() *persistConn
removeZone
function
#
removeZone removes IPv6 zone identifier from host.
E.g., "[fe80::1%en0]:8080" to "[fe80::1]:8080"
func removeZone(host string) string
replyToWriter
method
#
replyToWriter sends err to wr.done and panics if the send must block
This does nothing if wr.done is nil.
func (wr *http2FrameWriteRequest) replyToWriter(err error)
requestBodyRemains
function
#
requestBodyRemains reports whether future calls to Read
on rc might yield more data.
func requestBodyRemains(rc io.ReadCloser) bool
requestMethodUsuallyLacksBody
function
#
requestMethodUsuallyLacksBody reports whether the given request
method is one that typically does not involve a request body.
This is used by the Transport (via
transferWriter.shouldSendChunkedRequestBody) to determine whether
we try to test-read a byte from a non-nil Request.Body when
Request.outgoingLength() returns -1. See the comments in
shouldSendChunkedRequestBody.
func requestMethodUsuallyLacksBody(method string) bool
requestTooLarge
method
#
requestTooLarge is called by maxBytesReader when too much input has
been read from the client.
func (w *response) requestTooLarge()
requiresHTTP1
method
#
requiresHTTP1 reports whether this request requires being sent on
an HTTP/1 connection.
func (r *Request) requiresHTTP1() bool
resetProxyConfig
function
#
resetProxyConfig is used by tests.
func resetProxyConfig()
resetStream
method
#
func (sc *http2serverConn) resetStream(se http2StreamError)
rewindBody
function
#
rewindBody returns a new request with the body rewound.
It returns req unmodified if the body does not need rewinding.
rewindBody takes care of closing req.Body when appropriate
(in all cases except when rewindBody returns req unmodified).
func rewindBody(req *Request) (rewound *Request, err error)
roundTrip
method
#
func (cc *http2ClientConn) roundTrip(req *Request, streamf func(*http2clientStream)) (*Response, error)
roundTrip
method
#
func (pc *persistConn) roundTrip(req *transportRequest) (resp *Response, err error)
roundTrip
method
#
roundTrip implements a RoundTripper over HTTP.
func (t *Transport) roundTrip(req *Request) (_ *Response, err error)
run
method
#
func (c *http2addConnCall) run(t *http2Transport, key string, nc net.Conn)
run
method
#
func (rl *http2clientConnReadLoop) run() error
runHandler
method
#
Run on its own goroutine.
func (sc *http2serverConn) runHandler(rw *http2responseWriter, req *Request, handler func(ResponseWriter, *Request))
sanitizeCookieName
function
#
func sanitizeCookieName(n string) string
sanitizeCookiePath
function
#
path-av = "Path=" path-value
path-value =
func sanitizeCookiePath(v string) string
sanitizeCookieValue
function
#
sanitizeCookieValue produces a suitable cookie-value from v.
It receives a quoted bool indicating whether the value was originally
quoted.
https://tools.ietf.org/html/rfc6265#section-4.1.1
cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
; US-ASCII characters excluding CTLs,
; whitespace DQUOTE, comma, semicolon,
; and backslash
We loosen this as spaces and commas are common in cookie values
thus we produce a quoted cookie-value if v contains commas or spaces.
See https://golang.org/issue/7243 for the discussion.
func sanitizeCookieValue(v string, quoted bool) string
sanitizeOrWarn
function
#
func sanitizeOrWarn(fieldName string, valid func(byte) bool, v string) string
scanETag
function
#
scanETag determines if a syntactically valid ETag is present at s. If so,
the ETag and remaining text after consuming ETag is returned. Otherwise,
it returns "", "".
func scanETag(s string) (etag string, remain string)
scheduleFrameWrite
method
#
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 *http2serverConn) scheduleFrameWrite()
scheduleHandler
method
#
scheduleHandler starts a handler goroutine,
or schedules one to start as soon as an existing handler finishes.
func (sc *http2serverConn) scheduleHandler(streamID uint32, rw *http2responseWriter, req *Request, handler func(ResponseWriter, *Request)) error
scheme
method
#
scheme returns the first hop scheme: http, https, or socks5
func (cm *connectMethod) scheme() string
seeUpcomingDoubleCRLF
function
#
func seeUpcomingDoubleCRLF(r *bufio.Reader) bool
send
method
#
didTimeout is non-nil only if err != nil.
func (c *Client) send(req *Request, deadline time.Time) (resp *Response, didTimeout func() bool, err error)
send
function
#
send issues an HTTP request.
Caller should close resp.Body when done reading from it.
func send(ireq *Request, rt RoundTripper, deadline time.Time) (resp *Response, didTimeout func() bool, err error)
sendExpectationFailed
method
#
func (w *response) sendExpectationFailed()
sendGoAway
method
#
func (cc *http2ClientConn) sendGoAway() error
sendResponse
method
#
func (pr *populateResponse) sendResponse()
sendServeMsg
method
#
func (sc *http2serverConn) sendServeMsg(msg interface{})
sendWindowUpdate
method
#
st may be nil for conn-level
func (sc *http2serverConn) sendWindowUpdate(st *http2stream, n int)
sendWindowUpdate32
method
#
st may be nil for conn-level
func (sc *http2serverConn) sendWindowUpdate32(st *http2stream, n int32)
serve
method
#
func (sc *http2serverConn) serve(conf http2http2Config)
serve
method
#
Serve a new connection.
func (c *conn) serve(ctx context.Context)
serveConn
method
#
func (s *http2Server) serveConn(c net.Conn, opts *http2ServeConnOpts, newf func(*http2serverConn))
serveContent
function
#
if name is empty, filename is unknown. (used for mime type, before sniffing)
if modtime.IsZero(), modtime is unknown.
content must be seeked to the beginning of the file.
The sizeFunc is called at most once. Its error, if any, is sent in the HTTP response.
func serveContent(w ResponseWriter, r *Request, name string, modtime time.Time, sizeFunc func() (int64, error), content io.ReadSeeker)
serveError
function
#
serveError serves an error from ServeFile, ServeFileFS, and ServeContent.
Because those can all be configured by the caller by setting headers like
Etag, Last-Modified, and Cache-Control to send on a successful response,
the error path needs to clear them, since they may not be meant for errors.
func serveError(w ResponseWriter, text string, code int)
serveFile
function
#
name is '/'-separated, not filepath.Separator.
func serveFile(w ResponseWriter, r *Request, fs FileSystem, name string, redirect bool)
set
method
#
set sets the pattern and handler for n, which
must be a leaf node.
func (n *routingNode) set(p *pattern, h Handler)
setBit
method
#
func (p *Protocols) setBit(bit uint8, ok bool)
setBuffer
method
#
setBuffer initializes the pipe buffer.
It has no effect if the pipe is already closed.
func (p *http2pipe) setBuffer(b http2pipeBuffer)
setConnFlow
method
#
func (f *http2outflow) setConnFlow(cf *http2outflow)
setConnState
method
#
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 *http2serverConn) setConnState(state ConnState)
setError
method
#
func (tr *transportRequest) setError(err error)
setGoAway
method
#
func (cc *http2ClientConn) setGoAway(f *http2GoAwayFrame)
setInfiniteReadLimit
method
#
func (cr *connReader) setInfiniteReadLimit()
setLastModified
function
#
func setLastModified(w ResponseWriter, modtime time.Time)
setParent
method
#
func (n *http2priorityNode) setParent(parent *http2priorityNode)
setReadLimit
method
#
func (cr *connReader) setReadLimit(remain int64)
setRequestCancel
function
#
setRequestCancel sets req.Cancel and adds a deadline context to req
if deadline is non-zero. The RoundTripper's type is used to
determine whether the legacy CancelRequest behavior should be used.
As background, there are three ways to cancel a request:
First was Transport.CancelRequest. (deprecated)
Second was Request.Cancel.
Third was Request.Context.
This function populates the second and third, and uses the first if it really needs to.
func setRequestCancel(req *Request, rt RoundTripper, deadline time.Time) (stopTimer func(), didTimeout func() bool)
setState
method
#
func (c *conn) setState(nc net.Conn, state ConnState, runHook bool)
setupHTTP2_Serve
method
#
setupHTTP2_Serve is called from (*Server).Serve and conditionally
configures HTTP/2 on s using a more conservative policy than
setupHTTP2_ServeTLS because Serve is called after tls.Listen,
and may be called concurrently. See shouldConfigureHTTP2ForServe.
The tests named TestTransportAutomaticHTTP2* and
TestConcurrentServerServe in server_test.go demonstrate some
of the supported use cases and motivations.
func (s *Server) setupHTTP2_Serve() error
setupHTTP2_ServeTLS
method
#
setupHTTP2_ServeTLS conditionally configures HTTP/2 on
s and reports whether there was an error setting it up. If it is
not configured for policy reasons, nil is returned.
func (s *Server) setupHTTP2_ServeTLS() error
setupRewindBody
function
#
setupRewindBody returns a new request with a custom body wrapper
that can report whether the body needs rewinding.
This lets rewindBody avoid an error result when the request
does not have GetBody but the body hasn't been read at all yet.
func setupRewindBody(req *Request) *Request
shift
method
#
func (q *http2writeQueue) shift() http2FrameWriteRequest
shouldClose
function
#
Determine whether to hang up after sending a request and body, or
receiving a response and body
'header' is the request headers.
func shouldClose(major int, minor int, header Header, removeCloseHeader bool) bool
shouldConfigureHTTP2ForServe
method
#
shouldConfigureHTTP2ForServe reports whether Server.Serve should configure
automatic HTTP/2. (which sets up the s.TLSNextProto map)
func (s *Server) shouldConfigureHTTP2ForServe() bool
shouldRedirectRLocked
method
#
shouldRedirectRLocked reports whether the given path and host should be redirected to
path+"/". This should happen if a handler is registered for path+"/" but
not path -- see comments at ServeMux.
func (mux *serveMux121) shouldRedirectRLocked(host string, path string) bool
shouldRetryRequest
method
#
shouldRetryRequest reports whether we should retry sending a failed
HTTP request on a new connection. The non-nil input error is the
error from roundTrip.
func (pc *persistConn) shouldRetryRequest(req *Request, err error) bool
shouldReuseConnection
method
#
shouldReuseConnection reports whether the underlying TCP connection can be reused.
It must only be called after the handler is done executing.
func (w *response) shouldReuseConnection() bool
shouldSendChunkedRequestBody
method
#
shouldSendChunkedRequestBody reports whether we should try to send a
chunked request body to the server. In particular, the case we really
want to prevent is sending a GET or other typically-bodyless request to a
server with a chunked body when the body has zero bytes, since GETs with
bodies (while acceptable according to specs), even zero-byte chunked
bodies, are approximately never seen in the wild and confuse most
servers. See Issue 18257, as one example.
The only reason we'd send such a request is if the user set the Body to a
non-nil value (say, io.NopCloser(bytes.NewReader(nil))) and didn't
set ContentLength, or NewRequest set it to -1 (unknown), so then we assume
there's bytes to send.
This code tries to read a byte from the Request.Body in such cases to see
whether the body actually has content (super rare) or is actually just
a non-nil content-less ReadCloser (the more common case). In that more
common case, we act as if their Body were nil instead, and don't send
a body.
func (t *transferWriter) shouldSendChunkedRequestBody() bool
shouldSendContentLength
method
#
func (t *transferWriter) shouldSendContentLength() bool
shutDownIn
method
#
func (sc *http2serverConn) shutDownIn(d time.Duration)
shuttingDown
method
#
func (s *Server) shuttingDown() bool
socksNewDialer
function
#
NewDialer returns a new Dialer that dials through the provided
proxy server's network and address.
func socksNewDialer(network string, address string) *socksDialer
sockssplitHostPort
function
#
func sockssplitHostPort(address string) (string, int, error)
sortedKeyValues
method
#
sortedKeyValues returns h's keys sorted in the returned kvs
slice. The headerSorter used to sort is also returned, for possible
return to headerSorterCache.
func (h Header) sortedKeyValues(exclude map[string]bool) (kvs []keyValues, hs *headerSorter)
startBackgroundRead
method
#
func (cr *connReader) startBackgroundRead()
startDialConnForLocked
method
#
startDialConnFor calls dialConn in a new goroutine.
t.connsPerHostMu must be held.
func (t *Transport) startDialConnForLocked(w *wantConn)
startFrameWrite
method
#
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 *http2serverConn) startFrameWrite(wr http2FrameWriteRequest)
startGracefulShutdown
method
#
func (s *http2serverInternalState) startGracefulShutdown()
startGracefulShutdown
method
#
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 *http2serverConn) startGracefulShutdown()
startGracefulShutdownInternal
method
#
func (sc *http2serverConn) startGracefulShutdownInternal()
startPush
method
#
func (sc *http2serverConn) startPush(msg *http2startPushRequest)
startWrite
method
#
func (f *http2Framer) startWrite(ftype http2FrameType, flags http2Flags, streamID uint32)
startWriteDataPadded
method
#
startWriteDataPadded is WriteDataPadded, but only writes the frame to the Framer's internal buffer.
The caller should call endWrite to flush the frame to the underlying writer.
func (f *http2Framer) startWriteDataPadded(streamID uint32, endStream bool, data []byte, pad []byte) error
state
method
#
func (sc *http2serverConn) state(streamID uint32) (http2streamState, *http2stream)
staysWithinBuffer
method
#
func (w http2writePing) staysWithinBuffer(max int) bool
staysWithinBuffer
method
#
func (w *http2writeData) staysWithinBuffer(max int) bool
staysWithinBuffer
method
#
func (w *http2writeResHeaders) staysWithinBuffer(max int) bool
staysWithinBuffer
method
#
func (w http2writePingAck) staysWithinBuffer(max int) bool
staysWithinBuffer
method
#
func (http2flushFrameWriter) staysWithinBuffer(max int) bool
staysWithinBuffer
method
#
func (s http2writeSettings) staysWithinBuffer(max int) bool
staysWithinBuffer
method
#
func (http2writeSettingsAck) staysWithinBuffer(max int) bool
staysWithinBuffer
method
#
func (w *http2writePushPromise) staysWithinBuffer(max int) bool
staysWithinBuffer
method
#
func (*http2writeGoAway) staysWithinBuffer(max int) bool
staysWithinBuffer
method
#
func (se http2StreamError) staysWithinBuffer(max int) bool
staysWithinBuffer
method
#
func (wu http2writeWindowUpdate) staysWithinBuffer(max int) bool
staysWithinBuffer
method
#
func (hp http2handlerPanicRST) staysWithinBuffer(max int) bool
staysWithinBuffer
method
#
func (w http2write100ContinueHeadersFrame) staysWithinBuffer(max int) bool
stopShutdownTimer
method
#
func (sc *http2serverConn) stopShutdownTimer()
streamByID
method
#
streamByID returns the stream with the given id, or nil if no stream has that id.
If headerOrData is true, it clears rst.StreamPingsBlocked.
func (rl *http2clientConnReadLoop) streamByID(id uint32, headerOrData bool) *http2clientStream
stringContainsCTLByte
function
#
stringContainsCTLByte reports whether s contains any ASCII control character.
func stringContainsCTLByte(s string) bool
stringToken
method
#
func (e http2ErrCode) stringToken() string
stripHostPort
function
#
stripHostPort returns h without any trailing ":".
func stripHostPort(h string) string
stripPassword
function
#
func stripPassword(u *url.URL) string
sumRangesSize
function
#
func sumRangesSize(ranges []httpRange) (size int64)
take
method
#
func (f *http2outflow) take(n int32)
take
method
#
take attempts to take n bytes from the peer's flow control window.
It reports whether the window has available capacity.
func (f *http2inflow) take(n uint32) bool
timeBeforeContextDeadline
function
#
timeBeforeContextDeadline reports whether the non-zero Time t is
before ctx's deadline, if any. If ctx does not have a deadline, it
always reports true (the deadline is considered infinite).
func timeBeforeContextDeadline(t time.Time, ctx context.Context) bool
timeSince
method
#
func (t *http2Transport) timeSince(when time.Time) time.Duration
tlsHandshakeTimeout
method
#
tlsHandshakeTimeout returns the time limit permitted for the TLS
handshake, or zero for unlimited.
It returns the minimum of any positive ReadHeaderTimeout,
ReadTimeout, or WriteTimeout.
func (s *Server) tlsHandshakeTimeout() time.Duration
tlsHost
method
#
tlsHost returns the host name to match against the peer's
TLS certificate.
func (cm *connectMethod) tlsHost() string
toHTTPError
function
#
toHTTPError returns a non-specific HTTP error message and status code
for a given non-nil error value. It's important that toHTTPError does not
actually return err.Error(), since msg and httpStatus are returned to users,
and historically Go's ServeContent always returned just "404 Not Found" for
all errors. We don't want to start leaking information in error messages.
func toHTTPError(err error) (msg string, httpStatus int)
tooIdleLocked
method
#
tooIdleLocked reports whether this connection has been been sitting idle
for too much wall time.
func (cc *http2ClientConn) tooIdleLocked() bool
trackConn
method
#
func (s *Server) trackConn(c *conn, add bool)
trackListener
method
#
trackListener adds or removes a net.Listener to the set of tracked
listeners.
We store a pointer to interface in the map set, in case the
net.Listener is not comparable. This is safe because we only call
trackListener via Serve and can track+defer untrack the same
pointer to local variable there. We never need to compare a
Listener from another caller.
It reports whether the server is still up (not Shutdown or Closed).
func (s *Server) trackListener(ln *net.Listener, add bool) bool
transport
method
#
func (c *Client) transport() RoundTripper
tryDeliver
method
#
tryDeliver attempts to deliver pc, err to w and reports whether it succeeded.
func (w *wantConn) tryDeliver(pc *persistConn, err error, idleAt time.Time) bool
tryPutIdleConn
method
#
tryPutIdleConn adds pconn to the list of idle persistent connections awaiting
a new request.
If pconn is no longer needed or not in a good state, tryPutIdleConn returns
an error explaining why it wasn't registered.
tryPutIdleConn does not close pconn. Use putOrCloseIdleConn instead for that.
func (t *Transport) tryPutIdleConn(pconn *persistConn) error
unencryptedTLSConn
function
#
func unencryptedTLSConn(c net.Conn) *tls.Conn
unlock
method
#
func (cr *connReader) unlock()
unreadDataSizeLocked
method
#
unreadDataSizeLocked returns the number of bytes of unread input.
It returns -1 if unknown.
b.mu must be held.
func (b *body) unreadDataSizeLocked() int64
unregisterConn
method
#
func (s *http2serverInternalState) unregisterConn(sc *http2serverConn)
unwrapBody
method
#
unwrapBody unwraps the body's inner reader if it's a
nopCloser. This is to ensure that body writes sourced from local
files (*os.File types) are properly optimized.
This function is only intended for use in writeBody.
func (t *transferWriter) unwrapBody() io.Reader
unwrapNopCloser
function
#
unwrapNopCloser return the underlying reader and true if r is a NopCloser
else it return false.
func unwrapNopCloser(r io.Reader) (underlyingReader io.Reader, isNopCloser bool)
upgradeRequest
method
#
func (sc *http2serverConn) upgradeRequest(req *Request)
urlErrorOp
function
#
urlErrorOp returns the (*url.Error).Op value to use for the
provided (*Request).Method value.
func urlErrorOp(method string) string
useRegisteredProtocol
method
#
useRegisteredProtocol reports whether an alternate protocol (as registered
with Transport.RegisterProtocol) should be respected for this request.
func (t *Transport) useRegisteredProtocol(req *Request) bool
validCookieDomain
function
#
validCookieDomain reports whether v is a valid cookie domain-value.
func validCookieDomain(v string) bool
validCookieExpires
function
#
validCookieExpires reports whether v is a valid cookie expires-value.
func validCookieExpires(t time.Time) bool
validCookiePathByte
function
#
func validCookiePathByte(b byte) bool
validCookieValueByte
function
#
func validCookieValueByte(b byte) bool
validMethod
function
#
func validMethod(method string) bool
validNextProto
function
#
validNextProto reports whether the proto is a valid ALPN protocol name.
Everything is valid except the empty string and built-in protocol types,
so that those can't be overridden with alternate implementations.
func validNextProto(proto string) bool
validateTarget
method
#
func (d *socksDialer) validateTarget(network string, address string) error
valueOrDefault
function
#
Return value if nonempty, def otherwise.
func valueOrDefault(value string, def string) string
vlogf
method
#
func (cc *http2ClientConn) vlogf(format string, args ...interface{})
vlogf
method
#
func (sc *http2serverConn) vlogf(format string, args ...interface{})
vlogf
method
#
func (t *http2Transport) vlogf(format string, args ...interface{})
waitForContinue
method
#
waitForContinue returns the function to block until
any response, timeout or connection close. After any of them,
the function returns a bool which indicates if the body should be sent.
func (pc *persistConn) waitForContinue(continueCh <-chan struct{...}) (func() bool)
waiting
method
#
waiting reports whether w is still waiting for an answer (connection or error).
func (w *wantConn) waiting() bool
walkReadyInOrder
method
#
walkReadyInOrder iterates over the tree in priority order, calling f for each node
with a non-empty write queue. When f returns true, this function returns true and the
walk halts. tmp is used as scratch space for sorting.
f(n, openParent) takes two arguments: the node to visit, n, and a bool that is true
if any ancestor p of n is still open (ignoring the root node).
func (n *http2priorityNode) walkReadyInOrder(openParent bool, tmp *[]*http2priorityNode, f func(*http2priorityNode, bool) bool) bool
wantsClose
method
#
func (r *Request) wantsClose() bool
wantsHttp10KeepAlive
method
#
func (r *Request) wantsHttp10KeepAlive() bool
write
method
#
extraHeaders may be nil
waitForContinue may be nil
always closes body
func (r *Request) write(w io.Writer, usingProxy bool, extraHeaders Header, waitForContinue func() bool) (err error)
write
method
#
func (h Header) write(w io.Writer, trace *httptrace.ClientTrace) error
write
method
#
either dataB or dataS is non-zero.
func (w *http2responseWriter) write(lenData int, dataB []byte, dataS string) (n int, err error)
write
method
#
either dataB or dataS is non-zero.
func (w *response) write(lenData int, dataB []byte, dataS string) (n int, err error)
writeBody
method
#
always closes t.BodyCloser
func (t *transferWriter) writeBody(w io.Writer) (err error)
writeBufferSize
method
#
func (t *Transport) writeBufferSize() int
writeByte
method
#
func (f *http2Framer) writeByte(v byte)
writeBytes
method
#
func (f *http2Framer) writeBytes(v []byte)
writeChunk
method
#
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 *http2responseWriterState) writeChunk(p []byte) (n int, err error)
writeDataFromHandler
method
#
writeDataFromHandler writes DATA response frames from a handler on
the given stream.
func (sc *http2serverConn) writeDataFromHandler(stream *http2stream, data []byte, endStream bool) error
writeDebug
method
#
func (h http2FrameHeader) writeDebug(buf *bytes.Buffer)
writeFrame
method
#
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 *http2serverConn) writeFrame(wr http2FrameWriteRequest)
writeFrame
method
#
func (w http2writePingAck) writeFrame(ctx http2writeContext) error
writeFrame
method
#
func (se http2StreamError) writeFrame(ctx http2writeContext) error
writeFrame
method
#
func (w *http2writeResHeaders) writeFrame(ctx http2writeContext) error
writeFrame
method
#
func (http2writeSettingsAck) writeFrame(ctx http2writeContext) error
writeFrame
method
#
func (hp http2handlerPanicRST) writeFrame(ctx http2writeContext) error
writeFrame
method
#
func (http2flushFrameWriter) writeFrame(ctx http2writeContext) error
writeFrame
method
#
func (w *http2writeData) writeFrame(ctx http2writeContext) error
writeFrame
method
#
func (w http2write100ContinueHeadersFrame) writeFrame(ctx http2writeContext) error
writeFrame
method
#
func (s http2writeSettings) writeFrame(ctx http2writeContext) error
writeFrame
method
#
func (w *http2writePushPromise) writeFrame(ctx http2writeContext) error
writeFrame
method
#
func (wu http2writeWindowUpdate) writeFrame(ctx http2writeContext) error
writeFrame
method
#
func (p *http2writeGoAway) writeFrame(ctx http2writeContext) error
writeFrame
method
#
func (w http2writePing) writeFrame(ctx http2writeContext) error
writeFrameAsync
method
#
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 *http2serverConn) writeFrameAsync(wr http2FrameWriteRequest, wd *http2writeData)
writeFrameFromHandler
method
#
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 *http2serverConn) writeFrameFromHandler(wr http2FrameWriteRequest) error
writeLoop
method
#
func (pc *persistConn) writeLoop()
writeMatchingPath
function
#
writeMatchingPath writes to b a path that matches the segments.
func writeMatchingPath(b *strings.Builder, segs []segment)
writeNotModified
function
#
func writeNotModified(w ResponseWriter)
writeRequest
method
#
writeRequest sends a request.
It returns nil after the request is written, the response read,
and the request stream is half-closed by the peer.
It returns non-nil if the request ends otherwise.
If the returned error is StreamError, the error Code may be used in resetting the stream.
func (cs *http2clientStream) writeRequest(req *Request, streamf func(*http2clientStream)) (err error)
writeRequestBody
method
#
func (cs *http2clientStream) writeRequestBody(req *Request) (err error)
writeSegment
function
#
func writeSegment(b *strings.Builder, s segment)
writeStatusLine
function
#
writeStatusLine writes an HTTP/1.x Status-Line (RFC 7230 Section 3.1.2)
to bw. is11 is whether the HTTP request is HTTP/1.1. false means HTTP/1.0.
code is the response status code.
scratch is an optional scratch buffer. If it has at least capacity 3, it's used.
func writeStatusLine(bw *bufio.Writer, is11 bool, code int, scratch []byte)
writeStreamReset
method
#
writeStreamReset sends a RST_STREAM frame.
When ping is true, it also sends a PING frame with a random payload.
func (cc *http2ClientConn) writeStreamReset(streamID uint32, code http2ErrCode, ping bool, err error)
writeSubset
method
#
func (h Header) writeSubset(w io.Writer, exclude map[string]bool, trace *httptrace.ClientTrace) error
writeUint16
method
#
func (f *http2Framer) writeUint16(v uint16)
writeUint32
method
#
func (f *http2Framer) writeUint32(v uint32)
wroteFrame
method
#
wroteFrame is called on the serve goroutine with the result of
whatever happened on writeFrameAsync.
func (sc *http2serverConn) wroteFrame(res http2frameWriteResult)
wroteRequest
method
#
wroteRequest is a check before recycling a connection that the previous write
(from writeLoop above) happened and was successful.
func (pc *persistConn) wroteRequest() bool