Help us shape the future of Go! Take the 2026 Go Developer Survey

req

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: Apache-2.0 Imports: 15 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContinueReadBody

func ContinueReadBody(req *protocol.Request, r network.Reader, maxBodySize int, preParseMultipartForm ...bool) error

func ContinueReadBodyStream

func ContinueReadBodyStream(req *protocol.Request, zr network.Reader, maxBodySize int, preParseMultipartForm ...bool) error

ContinueReadBodyStream reads request body in stream if request header contains 'Expect: 100-continue'.

The caller must send StatusContinue response before calling this method.

If maxBodySize > 0 and the body size exceeds maxBodySize, then errBodyTooLarge is returned.

func GetHTTP1Request

func GetHTTP1Request(req *protocol.Request) fmt.Stringer

func ProxyWrite

func ProxyWrite(req *protocol.Request, w network.Writer) error

ProxyWrite is like Write but writes the request in the form expected by an HTTP proxy. In particular, ProxyWrite writes the initial Request-URI line of the request with an absolute URI, per section 5.3 of RFC 7230, including the scheme and host.

func Read

func Read(req *protocol.Request, r network.Reader, preParse ...bool) error

Read reads request (including body) from the given r.

RemoveMultipartFormFiles or Reset must be called after reading multipart/form-data request in order to delete temporarily uploaded files.

If MayContinue returns true, the caller must:

  • Either send StatusExpectationFailed response if request headers don't satisfy the caller.
  • Or send StatusContinue response before reading request body with ContinueReadBody.
  • Or close the connection.

io.EOF is returned if r is closed before reading the first header byte.

func ReadBodyStream

func ReadBodyStream(req *protocol.Request, zr network.Reader, maxBodySize int, getOnly, preParseMultipartForm bool) error

func ReadHeader

func ReadHeader(h *protocol.RequestHeader, r network.Reader) error

func ReadHeaderAndLimitBody

func ReadHeaderAndLimitBody(req *protocol.Request, r network.Reader, maxBodySize int, preParse ...bool) error

ReadHeaderAndLimitBody reads request from the given r, limiting the body size.

If maxBodySize > 0 and the body size exceeds maxBodySize, then errBodyTooLarge is returned.

RemoveMultipartFormFiles or Reset must be called after reading multipart/form-data request in order to delete temporarily uploaded files.

If MayContinue returns true, the caller must:

  • Either send StatusExpectationFailed response if request headers don't satisfy the caller.
  • Or send StatusContinue response before reading request body with ContinueReadBody.
  • Or close the connection.

io.EOF is returned if r is closed before reading the first header byte.

func ReadLimitBody

func ReadLimitBody(req *protocol.Request, r network.Reader, maxBodySize int, getOnly, preParseMultipartForm bool) error

func Write

func Write(req *protocol.Request, w network.Writer) error

Write writes request to w.

Write doesn't flush request to w for performance reasons.

See also WriteTo.

func WriteHeader

func WriteHeader(h *protocol.RequestHeader, w network.Writer) error

Write writes request header to w.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL