ext

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoBody = protocol.NoBody

Deprecated: Use github.com/cloudwego/hertz/pkg/protocol.NoBody instead.

Functions

func AcquireBodyStream

func AcquireBodyStream(b *bytebufferpool.ByteBuffer, r network.Reader, t *protocol.Trailer, 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 ReadTrailer

func ReadTrailer(t *protocol.Trailer, r network.Reader) error

func ReleaseBodyStream

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

ReleaseBodyStream releases the body stream. Error of skipRest may be returned if there is one.

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

func SkipTrailer

func SkipTrailer(r network.Reader) error

func WriteBodyChunked

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

func WriteBodyFixedSize

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

func WriteChunk

func WriteChunk(w network.Writer, b []byte, withFlush bool) (err error)

func WriteTrailer

func WriteTrailer(t *protocol.Trailer, w network.Writer) error

writeTrailer writes response trailer to w

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