ext

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoBody = noBody{}

NoBody is an io.ReadCloser with no bytes. Read always returns EOF and Close always returns nil. It can be used in an outgoing client request to explicitly signal that a request has zero bytes. An alternative, however, is to simply set Request.Body to nil.

Functions

func AcquireBodyStream

func AcquireBodyStream(b *bytebufferpool.ByteBuffer, r network.Reader, contentLength int) io.Reader

func BufferSnippet

func BufferSnippet(b []byte) string

func HasHeaderValue

func HasHeaderValue(s, value []byte) bool

func HeaderError

func HeaderError(typ string, err, errParse error, b []byte) error

func LimitedReaderSize

func LimitedReaderSize(r io.Reader) int64

func MustDiscard

func MustDiscard(r network.Reader, n int)

func MustPeekBuffered

func MustPeekBuffered(r network.Reader) []byte

func ReadBody

func ReadBody(r network.Reader, contentLength, maxBodySize int, dst []byte) ([]byte, error)

func ReadBodyWithStreaming

func ReadBodyWithStreaming(zr network.Reader, contentLength, maxBodySize int, dst []byte) (b []byte, err error)

func ReadRawHeaders

func ReadRawHeaders(dst, buf []byte) ([]byte, int, error)

func ReleaseBodyStream

func ReleaseBodyStream(requestReader io.Reader) (err error)

ReleaseBodyStream releases the body stream.

NOTE: Be careful to use this method unless you know what it's for.

func WriteBodyChunked

func WriteBodyChunked(w network.Writer, r io.Reader) error

func WriteBodyFixedSize

func WriteBodyFixedSize(w network.Writer, r io.Reader, size int64) error

Types

type HeaderScanner

type HeaderScanner struct {
	B     []byte
	Key   []byte
	Value []byte
	Err   error

	// HLen stores header subslice len
	HLen int

	DisableNormalizing bool
	// contains filtered or unexported fields
}

func (*HeaderScanner) Next

func (s *HeaderScanner) Next() bool

type HeaderValueScanner

type HeaderValueScanner struct {
	B     []byte
	Value []byte
}

Jump to

Keyboard shortcuts

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