package httpcommon
Import Path
golang.org/x/net/internal/httpcommon (on go.dev)
Dependency Relation
imports 16 packages, and imported by one package
Package-Level Type Names (total 6)
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)
EncodeHeadersResult is the result of EncodeHeaders.
HasBody bool
HasTrailers bool
func EncodeHeaders(ctx context.Context, param EncodeHeadersParam, headerf func(name, value string)) (res EncodeHeadersResult, _ error)
GzipReader wraps a response body so it can lazily
get gzip.Reader from the pool on the first call to Read.
After Close is called it puts gzip.Reader to the pool immediately
if there is no Read in progress or later when Read completes.
// underlying Response.Body
(*GzipReader) Close() error
(*GzipReader) Read(p []byte) (n int, err error)
*GzipReader : github.com/prometheus/common/expfmt.Closer
*GzipReader : io.Closer
*GzipReader : io.ReadCloser
*GzipReader : io.Reader
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.
Various http.Request fields.
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 returning 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
URL *url.URL
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.8.7. (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. |