Documentation
¶
Index ¶
- Variables
- 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 ReadHeader(h *protocol.ResponseHeader, r network.Reader) error
- func ReadHeaderAndLimitBody(resp *protocol.Response, r network.Reader, maxBodySize int) error
- func ReadHeaderBodyStream(resp *protocol.Response, r network.Reader, maxBodySize int, ...) error
- func ReadHeaders(resp *protocol.Response, r network.Reader) error
- func ReadRespBody(resp *protocol.Response, r network.Reader, maxBodySize int) (err error)
- func ReadRespBodyStream(resp *protocol.Response, r network.Reader, maxBodySize int, ...) (err 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 ¶
var ReadBodyStream = ReadHeaderBodyStream
Deprecated: use ReadHeaderBodyStream
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
NewChunkedBodyWriter creates a new chunked body writer.
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 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 ...
func ReadHeaderBodyStream ¶ added in v0.10.0
func ReadHeaderBodyStream(resp *protocol.Response, r network.Reader, maxBodySize int, closeCallBack func(shouldClose bool) error) error
ReadHeaderBodyStream ...
func ReadHeaders ¶ added in v0.10.0
ReadHeaders reads http header into *protocol.Response
func ReadRespBody ¶ added in v0.10.0
ReadRespBody reads response body 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 ReadRespBodyStream ¶ added in v0.10.0
func ReadRespBodyStream(resp *protocol.Response, r network.Reader, maxBodySize int, closeCallBack func(shouldClose bool) error) (err error)
ReadRespBodyStream reads response body in stream
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.