http1parser

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2025 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadProto = errors.New("bad protocol")

Functions

func Http1ExtractHeaders

func Http1ExtractHeaders(r *textproto.Reader) ([]string, error)

Http1ExtractHeaders is an HTTP/1.0 and HTTP/1.1 header-only parser, to extract the original header names for the received request. Fully inspired by readMIMEHeader() in https://github.com/golang/go/blob/master/src/net/textproto/reader.go

Types

type RequestReader

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

func NewRequestReader

func NewRequestReader(preventCanonicalization bool, conn io.Reader) *RequestReader

func (*RequestReader) IsEOF

func (r *RequestReader) IsEOF() bool

IsEOF returns true if there is no more data that can be read from the buffer and the underlying connection is closed.

func (*RequestReader) ReadRequest

func (r *RequestReader) ReadRequest() (*http.Request, error)

func (*RequestReader) Reader

func (r *RequestReader) Reader() *bufio.Reader

Reader is used to take over the buffered connection data (e.g. with HTTP/2 data). After calling this function, make sure to consume all the data related to the current request.

Jump to

Keyboard shortcuts

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