Documentation
¶
Index ¶
- Variables
- func ReadRequest(r *bufio.Reader) (*http.Request, error)
- type Method
- type Parser
- func (p *Parser) EOF() bool
- func (p *Parser) Execute(setting *Setting, buf []byte) (success int, err error)
- func (p *Parser) GetUserData() interface{}
- func (p *Parser) Init(t ReqOrRsp)
- func (p *Parser) ReadyUpgradeData() bool
- func (p *Parser) Reset()
- func (p *Parser) SetUserData(d interface{})
- func (p *Parser) Status() string
- type ReqOrRsp
- type Setting
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 ¶
Types ¶
type Parser ¶
type Parser struct {
Method Method
Major uint8
Minor uint8
MaxHeaderSize int32
StatusCode uint16
Upgrade bool
// contains filtered or unexported fields
}
func (*Parser) GetUserData ¶
func (p *Parser) GetUserData() interface{}
func (*Parser) ReadyUpgradeData ¶
func (*Parser) SetUserData ¶
func (p *Parser) SetUserData(d interface{})
type ReqOrRsp ¶
type ReqOrRsp uint8
ReqOrRsp selects request parsing, response parsing, or auto-detect mode.
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.
Click to show internal directories.
Click to hide internal directories.