Documentation ¶
Index ¶
- func ConnectionUpgrade(h *protocol.ResponseHeader) bool
- func GetHTTP1Response(resp *protocol.Response) fmt.Stringer
- func NewChunkedBodyWriter(r *protocol.Response, w network.Writer) network.ExtWriter
- func Read(resp *protocol.Response, r network.Reader) error
- func ReadBodyStream(resp *protocol.Response, r network.Reader, maxBodySize int, ...) error
- func ReadHeader(h *protocol.ResponseHeader, r network.Reader) error
- func ReadHeaderAndLimitBody(resp *protocol.Response, r network.Reader, maxBodySize int) error
- func Write(resp *protocol.Response, w network.Writer) error
- func WriteHeader(h *protocol.ResponseHeader, w network.Writer) error
- type ErrBodyStreamWritePanic
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 NewChunkedBodyWriter ¶ added in v0.6.0
func Read ¶
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(shouldClose bool) 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 ¶
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 ¶
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
WriteHeader 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.