package httpcommon
import "golang.org/x/net/internal/httpcommon"
Index ¶
- Variables
- func ActualContentLength(req *http.Request) int64
- func CachedCanonicalHeader(v string) (string, bool)
- func CanonicalHeader(v string) string
- func IsRequestGzip(req *http.Request, disableCompression bool) bool
- func LowerHeader(v string) (lower string, ascii bool)
- type EncodeHeadersParam
- type EncodeHeadersResult
Variables ¶
var ( ErrRequestHeaderListSize = errors.New("request header list larger than peer's advertised limit") )
Functions ¶
func ActualContentLength ¶
ActualContentLength returns a sanitized version of req.ContentLength, where 0 actually means zero (not unknown) and -1 means unknown.
func CachedCanonicalHeader ¶
CachedCanonicalHeader returns the canonical form of a well-known header name.
func CanonicalHeader ¶
CanonicalHeader canonicalizes a header name. (For example, "host" becomes "Host".)
func IsRequestGzip ¶
IsRequestGzip reports whether we should add an Accept-Encoding: gzip header for a request.
func LowerHeader ¶
LowerHeader returns the lowercase form of a header name, used on the wire for HTTP/2 and HTTP/3 requests.
Types ¶
type EncodeHeadersParam ¶
type EncodeHeadersParam struct { Request *http.Request // AddGzipHeader indicates that an "accept-encoding: gzip" header should be // added to the request. AddGzipHeader bool // PeerMaxHeaderListSize, when non-zero, is the peer's MAX_HEADER_LIST_SIZE setting. PeerMaxHeaderListSize uint64 // DefaultUserAgent is the User-Agent header to send when the request // neither contains a User-Agent nor disables it. DefaultUserAgent string }
EncodeHeadersParam is parameters to EncodeHeaders.
type EncodeHeadersResult ¶
EncodeHeadersParam is the result of EncodeHeaders.
func EncodeHeaders ¶
func EncodeHeaders(param EncodeHeadersParam, headerf func(name, value string)) (res EncodeHeadersResult, _ error)
EncodeHeaders constructs request headers common to HTTP/2 and HTTP/3. It validates a request and calls headerf with each pseudo-header and header for the request. The headerf function is called with the validated, canonicalized header name.
Source Files ¶
ascii.go headermap.go request.go
- Version
- v0.35.0 (latest)
- Published
- Feb 10, 2025
- Platform
- linux/amd64
- Imports
- 10 packages
- Last checked
- 5 hours ago –
Tools for package owners.