parser

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMethod         = errors.New("http method fail")
	ErrStatusLineHTTP = errors.New("http status line http")
	ErrHTTPVersionNum = errors.New("http version number")
	ErrHeaderOverflow = errors.New("http header overflow")
	ErrNoEndLF        = errors.New("http there is no end symbol")
	ErrChunkSize      = errors.New("http wrong chunk size")
	ErrReqMethod      = errors.New("http request wrong method")
	ErrRequestLineLF  = errors.New("http request line wrong LF")
)
View Source
var (
	MaxHeaderSize int32 = 4096
)

Functions

This section is empty.

Types

type Method

type Method int8
const (
	GET Method = iota + 1
	HEAD
	POST
	PUT
	DELETE
	CONNECT
	OPTIONS
	TRACE
	ACL
	BIND
	COPY
	CHECKOUT
	LOCK
	UNLOCK
	LINK
	MKCOL
	MOVE
	MKACTIVITY
	MERGE
	MSEARCH
	MKCALENDAR
	NOTIFY
	PROPFIND
	PROPPATCH
	PATCH
	PURGE
	REPORT
	REBIND
	SUBSCRIBE
	SEARCH
	SOURCE
	UNSUBSCRIBE
	UNBIND
	UNLINK
)

func (Method) String

func (m Method) String() string

type Parser

type Parser struct {
	Method        Method
	Major         uint8
	Minor         uint8
	MaxHeaderSize int32

	StatusCode uint16

	Upgrade bool
	// contains filtered or unexported fields
}

func New

func New(t ReqOrRsp) *Parser

func (*Parser) EOF

func (p *Parser) EOF() bool

func (*Parser) Execute

func (p *Parser) Execute(setting *Setting, buf []byte) (success int, err error)

func (*Parser) GetUserData

func (p *Parser) GetUserData() interface{}

func (*Parser) Init

func (p *Parser) Init(t ReqOrRsp)

func (*Parser) ReadyUpgradeData

func (p *Parser) ReadyUpgradeData() bool

func (*Parser) Reset

func (p *Parser) Reset()

func (*Parser) SetUserData

func (p *Parser) SetUserData(d interface{})

func (*Parser) Status

func (p *Parser) Status() string

type ReqOrRsp

type ReqOrRsp uint8

ReqOrRsp selects request parsing, response parsing, or auto-detect mode.

const (
	REQUEST ReqOrRsp = iota + 1
	RESPONSE
	BOTH
)

type Setting

type Setting struct {
	MessageBegin    func(*Parser, int)
	URL             func(*Parser, []byte, int)
	Status          func(*Parser, []byte, int)
	HeaderField     func(*Parser, []byte, int)
	HeaderValue     func(*Parser, []byte, int)
	HeadersComplete func(*Parser, int)
	Body            func(*Parser, []byte, int)
	MessageComplete func(*Parser, int)
}

Setting holds parser callbacks for streaming message events.

Jump to

Keyboard shortcuts

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