Versions in this module Expand all Collapse all v1 v1.3.13 May 10, 2023 Changes in this version + const DefaultBlockingReadBufferSize + const DefaultHTTPReadLimit + const DefaultIOMod + const DefaultKeepaliveTime + const DefaultMaxBlockingOnline + const DefaultMaxLoad + const DefaultMaxWebsocketFramePayloadSize + const IOModBlocking + const IOModMixed + const IOModNonBlocking + const MaxInt + const MaxUint + var ErrCRExpected = errors.New("CR character expected") + var ErrClientClosed = errors.New("http client closed") + var ErrClientTimeout = errors.New("timeout") + var ErrClientUnsupportedSchema = errors.New("unsupported schema") + var ErrInvalidCRLF = errors.New("invalid cr/lf at the end of line") + var ErrInvalidCharInHeader = errors.New("invalid character in header") + var ErrInvalidChunkSize = errors.New("invalid chunk size") + var ErrInvalidContentLength = errors.New("invalid ContentLength") + var ErrInvalidFragment = errors.New("invalid fragment") + var ErrInvalidH2HeaderR = errors.New("invalid http2 SM characters") + var ErrInvalidH2SM = errors.New("invalid http2 SM characters") + var ErrInvalidHTTPStatus = errors.New("invalid HTTP status") + var ErrInvalidHTTPStatusCode = errors.New("invalid HTTP status code") + var ErrInvalidHTTPVersion = errors.New("invalid HTTP version") + var ErrInvalidHost = errors.New("invalid host") + var ErrInvalidMethod = errors.New("invalid HTTP method") + var ErrInvalidPath = errors.New("invalid path") + var ErrInvalidPort = errors.New("invalid port") + var ErrInvalidQueryString = errors.New("invalid query string") + var ErrInvalidRequestURI = errors.New("invalid URL") + var ErrLFExpected = errors.New("LF character expected") + var ErrNilConn = errors.New("nil Conn") + var ErrTooLong = errors.New("invalid http message: too long") + var ErrTrailerExpected = errors.New("trailer expected") + var ErrUnexpectedContentLength = errors.New("unexpected content-length header") + type BodyReader struct + func NewBodyReader(data []byte) *BodyReader + func (br *BodyReader) Append(data []byte) + func (br *BodyReader) Close() error + func (br *BodyReader) RawBody() []byte + func (br *BodyReader) Read(p []byte) (int, error) + func (br *BodyReader) Reset() error + func (br *BodyReader) TakeOver() []byte + type Client struct + CheckRedirect func(req *http.Request, via []*http.Request) error + Engine *Engine + IdleConnTimeout time.Duration + Jar http.CookieJar + MaxConnsPerHost int32 + Proxy func(*http.Request) (*url.URL, error) + TLSClientConfig *tls.Config + Timeout time.Duration + func (c *Client) Close() + func (c *Client) CloseWithError(err error) + func (c *Client) Do(req *http.Request, handler func(res *http.Response, conn net.Conn, err error)) + type ClientConn struct + CheckRedirect func(req *http.Request, via []*http.Request) error + Engine *Engine + IdleConnTimeout time.Duration + Jar http.CookieJar + Proxy func(*http.Request) (*url.URL, error) + TLSClientConfig *tls.Config + Timeout time.Duration + func (c *ClientConn) Close() + func (c *ClientConn) CloseWithError(err error) + func (c *ClientConn) Do(req *http.Request, handler func(res *http.Response, conn net.Conn, err error)) + func (c *ClientConn) OnClose(h func()) + func (c *ClientConn) Reset() + type ClientProcessor struct + func (p *ClientProcessor) Close(parser *Parser, err error) + func (p *ClientProcessor) Conn() net.Conn + func (p *ClientProcessor) OnBody(data []byte) + func (p *ClientProcessor) OnComplete(parser *Parser) + func (p *ClientProcessor) OnContentLength(contentLength int) + func (p *ClientProcessor) OnHeader(key, value string) + func (p *ClientProcessor) OnMethod(method string) + func (p *ClientProcessor) OnProto(proto string) error + func (p *ClientProcessor) OnStatus(code int, status string) + func (p *ClientProcessor) OnTrailerHeader(key, value string) + func (p *ClientProcessor) OnURL(uri string) error + type ConfAddr struct + Addr string + NListener int + Network string + TLSConfig *tls.Config + type Config struct + AddrConfigs []ConfAddr + AddrConfigsTLS []ConfAddr + Addrs []string + AddrsTLS []string + BlockingReadBufferSize int + BodyAllocator mempool.Allocator + Cancel func() + ClientExecutor func(f func()) + Context context.Context + DisableSendfile bool + Handler http.Handler + IOMod int + KeepaliveTime time.Duration + Listen func(network, addr string) (net.Listener, error) + ListenUDP func(network string, laddr *net.UDPAddr) (*net.UDPConn, error) + LockListener bool + LockPoller bool + MaxBlockingOnline int + MaxConnReadTimesPerEventLoop int + MaxLoad int + MaxWebsocketFramePayloadSize int + MaxWriteBufferSize int + MessageHandlerPoolSize int + NListener int + NParser int + NPoller int + Name string + Network string + ReadBufferSize int + ReadLimit int + ReleaseWebsocketPayload bool + RetainHTTPBody bool + ServerExecutor func(f func()) + SupportServerOnly bool + TLSAllocator tls.Allocator + TLSConfig *tls.Config + TimerExecutor func(f func()) + WriteTimeout time.Duration + type EmptyProcessor struct + func (p *EmptyProcessor) Close(parser *Parser, err error) + func (p *EmptyProcessor) Conn() net.Conn + func (p *EmptyProcessor) OnBody(data []byte) + func (p *EmptyProcessor) OnComplete(parser *Parser) + func (p *EmptyProcessor) OnContentLength(contentLength int) + func (p *EmptyProcessor) OnHeader(key, value string) + func (p *EmptyProcessor) OnMethod(method string) + func (p *EmptyProcessor) OnProto(proto string) error + func (p *EmptyProcessor) OnStatus(code int, status string) + func (p *EmptyProcessor) OnTrailerHeader(key, value string) + func (p *EmptyProcessor) OnURL(uri string) error + type Engine struct + BaseCtx context.Context + Cancel func() + CheckUtf8 func(data []byte) bool + ExecuteClient func(f func()) + func NewEngine(conf Config) *Engine + func (e *Engine) DataHandler(c *nbio.Conn, data []byte) + func (e *Engine) OnClose(h func(c net.Conn, err error)) + func (e *Engine) OnOpen(h func(c net.Conn)) + func (e *Engine) OnStop(h func()) + func (e *Engine) Online() int + func (e *Engine) Shutdown(ctx context.Context) error + func (e *Engine) Start() error + func (e *Engine) Stop() + func (e *Engine) TLSDataHandler(c *nbio.Conn, data []byte) + func (engine *Engine) AddConnNonTLSBlocking(conn net.Conn, tlsConfig *tls.Config, decrease func()) + func (engine *Engine) AddConnNonTLSNonBlocking(c net.Conn, tlsConfig *tls.Config, decrease func()) + func (engine *Engine) AddConnTLSBlocking(conn net.Conn, tlsConfig *tls.Config, decrease func()) + func (engine *Engine) AddConnTLSNonBlocking(conn net.Conn, tlsConfig *tls.Config, decrease func()) + type Hijacker interface + Hijack func() (net.Conn, *bufio.ReadWriter, error) + type Parser struct + Conn net.Conn + Engine *Engine + Execute func(f func()) bool + Processor Processor + Reader ReadCloser + func NewParser(processor Processor, isClient bool, readLimit int, ...) *Parser + func (p *Parser) Close(err error) + func (p *Parser) OnClose(h func(p *Parser, err error)) + func (p *Parser) Read(data []byte) error + type Processor interface + Close func(p *Parser, err error) + Conn func() net.Conn + OnBody func(data []byte) + OnComplete func(parser *Parser) + OnContentLength func(contentLength int) + OnHeader func(key, value string) + OnMethod func(method string) + OnProto func(proto string) error + OnStatus func(code int, status string) + OnTrailerHeader func(key, value string) + OnURL func(uri string) error + func NewClientProcessor(conn *ClientConn, handler func(res *http.Response, err error)) Processor + func NewEmptyProcessor() Processor + func NewServerProcessor(conn net.Conn, handler http.Handler, keepaliveTime time.Duration, ...) Processor + type ReadCloser interface + Close func(p *Parser, err error) + Read func(p *Parser, data []byte) error + type Response struct + Parser *Parser + func NewResponse(parser *Parser, request *http.Request, enableSendfile bool) *Response + func (res *Response) Header() http.Header + func (res *Response) Hijack() (net.Conn, *bufio.ReadWriter, error) + func (res *Response) ReadFrom(r io.Reader) (n int64, err error) + func (res *Response) Write(data []byte) (int, error) + func (res *Response) WriteHeader(statusCode int) + func (res *Response) WriteString(s string) (int, error) + type Server struct + func NewServer(conf Config, v ...interface{}) *Server + func NewServerTLS(conf Config, v ...interface{}) *Server + type ServerProcessor struct + func (p *ServerProcessor) Close(parser *Parser, err error) + func (p *ServerProcessor) Conn() net.Conn + func (p *ServerProcessor) OnBody(data []byte) + func (p *ServerProcessor) OnComplete(parser *Parser) + func (p *ServerProcessor) OnContentLength(contentLength int) + func (p *ServerProcessor) OnHeader(key, value string) + func (p *ServerProcessor) OnMethod(method string) + func (p *ServerProcessor) OnProto(proto string) error + func (p *ServerProcessor) OnStatus(code int, status string) + func (p *ServerProcessor) OnTrailerHeader(key, value string) + func (p *ServerProcessor) OnURL(rawurl string) error + type Upgrader interface + Upgrade func(w http.ResponseWriter, r *http.Request, responseHeader http.Header) (net.Conn, error)