http1

package
v0.15.7 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body struct {
	*stash.Reader
	// contains filtered or unexported fields
}

func NewBody

func NewBody(
	client tcp.Client, chunkedParser *chunkedbody.Parser, s settings.Body,
) *Body

func (*Body) Bytes

func (b *Body) Bytes() ([]byte, error)

func (*Body) Callback

func (b *Body) Callback(cb http.OnBodyCallback) error

func (*Body) Discard added in v0.15.0

func (b *Body) Discard() (err error)

func (*Body) Init

func (b *Body) Init(request *http.Request)

func (*Body) Retrieve

func (b *Body) Retrieve() ([]byte, error)

func (*Body) String

func (b *Body) String() (string, error)

type Parser

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

Parser is a stream-based http requests transport. It modifies request object by pointer in performance purposes. Decodes query-encoded values by its own, you can see that by presented states ePathDecode1Char, ePathDecode2Char, etc. When headers are parsed, parser returns state transport.HeadersCompleted to notify http server about this, attaching all the pending data as an extra. Body must be processed separately

func NewParser

func NewParser(
	request *http.Request, keyBuff, valBuff, startLineBuff *buffer.Buffer, headersSettings settings.Headers,
) *Parser

func (*Parser) Parse

func (p *Parser) Parse(data []byte) (state transport.RequestState, extra []byte, err error)

type Serializer added in v0.15.0

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

func NewSerializer added in v0.15.0

func NewSerializer(buff []byte, fileBuffSize int, defHdrs map[string]string) *Serializer

func (*Serializer) PreWrite added in v0.15.0

func (d *Serializer) PreWrite(protocol proto.Proto, response *http.Response)

PreWrite writes the response into the buffer without actually sending it. Usually used for informational responses

func (*Serializer) Write added in v0.15.0

func (d *Serializer) Write(
	protocol proto.Proto, request *http.Request, response *http.Response, writer transport.Writer,
) (err error)

Write writes the response, keeping in mind difference between 0.9, 1.0 and 1.1 HTTP versions

type Transport

type Transport struct {
	*Parser
	*Serializer
}

func New

func New(
	request *http.Request,
	keyBuff, valBuff, startLineBuff *buffer.Buffer,
	headersSettings settings.Headers,
	respBuff []byte,
	respFileBuffSize int,
	defaultHeaders map[string]string,
) *Transport

Jump to

Keyboard shortcuts

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