package httpcommon
Import Path
golang.org/x/net/internal/httpcommon (on go.dev)
Dependency Relation
imports 12 packages, and imported by one package
Package-Level Type Names (total 5, all are exported)
EncodeHeadersParam is parameters to EncodeHeaders.
AddGzipHeader indicates that an "accept-encoding: gzip" header should be
added to the request.
DefaultUserAgent is the User-Agent header to send when the request
neither contains a User-Agent nor disables it.
PeerMaxHeaderListSize, when non-zero, is the peer's MAX_HEADER_LIST_SIZE setting.
Request Request
func EncodeHeaders(ctx context.Context, param EncodeHeadersParam, headerf func(name, value string)) (res EncodeHeadersResult, _ error)
EncodeHeadersParam is the result of EncodeHeaders.
HasBody bool
HasTrailers bool
func EncodeHeaders(ctx context.Context, param EncodeHeadersParam, headerf func(name, value string)) (res EncodeHeadersResult, _ error)
func golang.org/x/net/http2.encodeRequestHeaders(req *http.Request, addGzipHeader bool, peerMaxHeaderListSize uint64, headerf func(name, value string)) (EncodeHeadersResult, error)
Request is a subset of http.Request.
It'd be simpler to pass an *http.Request, of course, but we can't depend on net/http
without creating a dependency cycle.
// 0 means 0, -1 means unknown
Header map[string][]string
Host string
Method string
Trailer map[string][]string
URL *url.URL
ServerRequestParam is parameters to NewServerRequest.
Authority string
Header map[string][]string
Method string
Path string
Protocol string
Scheme string
func NewServerRequest(rp ServerRequestParam) ServerRequestResult
ServerRequestResult is the result of NewServerRequest.
If the request should be rejected, this is a short string suitable for passing
to the http2 package's CountError function.
It might be a bit odd to return errors this way rather than returing an error,
but this ensures we don't forget to include a CountError reason.
// client provided an "Expect: 100-continue" header
RequestURI string
Trailer map[string][]string
Various http.Request fields.
func NewServerRequest(rp ServerRequestParam) ServerRequestResult
Package-Level Functions (total 17, in which 6 are exported)
CachedCanonicalHeader returns the canonical form of a well-known header name.
CanonicalHeader canonicalizes a header name. (For example, "host" becomes "Host".)
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.
IsRequestGzip reports whether we should add an Accept-Encoding: gzip header
for a request.
LowerHeader returns the lowercase form of a header name,
used on the wire for HTTP/2 and HTTP/3 requests.
Package-Level Variables (total 4, in which 1 is exported)
The pages are generated with Golds v0.7.6. (GOOS=linux GOARCH=amd64)