resp

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: Apache-2.0 Imports: 15 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectionUpgrade

func ConnectionUpgrade(h *protocol.ResponseHeader) bool

ConnectionUpgrade returns true if 'Connection: Upgrade' header is set.

func GetHTTP1Response

func GetHTTP1Response(resp *protocol.Response) fmt.Stringer

func Read

func Read(resp *protocol.Response, r network.Reader) error

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

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

func ReadBodyStream

func ReadBodyStream(resp *protocol.Response, r network.Reader, maxBodySize int, closeCallBack func() error) error

ReadBodyStream reads response body in stream

func ReadHeader

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

Read reads response header from r.

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

func ReadHeaderAndLimitBody

func ReadHeaderAndLimitBody(resp *protocol.Response, r network.Reader, maxBodySize int) error

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

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

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

func Write

func Write(resp *protocol.Response, w network.Writer) error

Write writes response to w.

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

See also WriteTo.

func WriteHeader

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

Write writes response header to w.

Types

type ErrBodyStreamWritePanic

type ErrBodyStreamWritePanic struct {
	// contains filtered or unexported fields
}

ErrBodyStreamWritePanic is returned when panic happens during writing body stream.

Jump to

Keyboard shortcuts

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