Movatterモバイル変換


[0]ホーム

URL:


httpcommon

packagestandard library
go1.25.4Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2025 License:BSD-3-ClauseImports:12Imported by:0

Details

Repository

cs.opensource.google/go/go

Links

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (ErrRequestHeaderListSize =errors.New("request header list larger than peer's advertised limit"))

Functions

funcCachedCanonicalHeader

func CachedCanonicalHeader(vstring) (string,bool)

CachedCanonicalHeader returns the canonical form of a well-known header name.

funcCanonicalHeader

func CanonicalHeader(vstring)string

CanonicalHeader canonicalizes a header name. (For example, "host" becomes "Host".)

funcIsRequestGzip

func IsRequestGzip(methodstring, header map[string][]string, disableCompressionbool)bool

IsRequestGzip reports whether we should add an Accept-Encoding: gzip headerfor a request.

funcLowerHeader

func LowerHeader(vstring) (lowerstring, asciibool)

LowerHeader returns the lowercase form of a header name,used on the wire for HTTP/2 and HTTP/3 requests.

Types

typeEncodeHeadersParam

type EncodeHeadersParam struct {RequestRequest// AddGzipHeader indicates that an "accept-encoding: gzip" header should be// added to the request.AddGzipHeaderbool// PeerMaxHeaderListSize, when non-zero, is the peer's MAX_HEADER_LIST_SIZE setting.PeerMaxHeaderListSizeuint64// DefaultUserAgent is the User-Agent header to send when the request// neither contains a User-Agent nor disables it.DefaultUserAgentstring}

EncodeHeadersParam is parameters to EncodeHeaders.

typeEncodeHeadersResult

type EncodeHeadersResult struct {HasBodyboolHasTrailersbool}

EncodeHeadersParam is the result of EncodeHeaders.

funcEncodeHeaders

func EncodeHeaders(ctxcontext.Context, paramEncodeHeadersParam, headerf func(name, valuestring)) (resEncodeHeadersResult, _error)

EncodeHeaders constructs request headers common to HTTP/2 and HTTP/3.It validates a request and calls headerf with each pseudo-header and headerfor the request.The headerf function is called with the validated, canonicalized header name.

typeRequest

type Request struct {URL                 *url.URLMethodstringHoststringHeader              map[string][]stringTrailer             map[string][]stringActualContentLengthint64// 0 means 0, -1 means unknown}

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/httpwithout creating a dependency cycle.

typeServerRequestParam

type ServerRequestParam struct {MethodstringScheme, Authority, PathstringProtocolstringHeader                  map[string][]string}

ServerRequestParam is parameters to NewServerRequest.

typeServerRequestResult

type ServerRequestResult struct {// Various http.Request fields.URL        *url.URLRequestURIstringTrailer    map[string][]stringNeedsContinuebool// client provided an "Expect: 100-continue" header// 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.InvalidReasonstring}

ServerRequestResult is the result of NewServerRequest.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp