package httpcommon
Import Path
net/http/internal/httpcommon (on go.dev)
Dependency Relation
imports 12 packages, and imported by one package
Involved Source Files
httpcommon.go
Package-Level Type Names (total 5)
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)
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 6)
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 (only one)
![]() |
The pages are generated with Golds v0.7.7-preview. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |