protocol

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package internal contains HTTP internals shared by net/http and net/http/httputil.

Index

Constants

View Source
const (
	UNKNOWN_PRO    = "UNKNOWN"
	HTTP_PRO       = "HTTP"
	MYSQL_PRO      = "MYSQL"
	REDIS_PRO      = "REDIS"
	BIN_THRIFT_PRO = "BinaryThrift"
	COM_THRIFT_PRO = "CompactThrift"
	PUB_PRO        = "PUBLIC"
)

Variables

View Source
var ErrLineTooLong = errors.New("header line too long")
View Source
var NonsupportErr = errors.New("don't support the protocol parsing")

Functions

func NewChunkedReader

func NewChunkedReader(r io.Reader) io.Reader

NewChunkedReader returns a new chunkedReader that translates the data read from r out of HTTP "chunked" format before returning it. The chunkedReader returns io.EOF when the final 0-length chunk is read.

NewChunkedReader is not needed by normal applications. The http package automatically decodes chunking when reading response bodies.

func NewChunkedWriter

func NewChunkedWriter(w io.Writer) io.WriteCloser

NewChunkedWriter returns a new chunkedWriter that translates writes into HTTP "chunked" format before writing them to w. Closing the returned chunkedWriter sends the final 0-length chunk that marks the end of the stream.

NewChunkedWriter is not needed by normal applications. The http package adds chunking automatically if handlers don't set a Content-Length header. Using newChunkedWriter inside a handler would result in double chunking or chunking with a Content-Length length, both of which are wrong.

func ParseHTTP

func ParseHTTP(body string) (pairs map[string]json.RawMessage, requestMark string, err error)

func ParsePublic

func ParsePublic(body string) (pairs map[string]json.RawMessage, requestMark string, err error)

func SortHTTP

func SortHTTP(body []byte) (sortBody []byte, err error)

SortHTTP 对http参数排序,提高匹配成功率

Types

type BinaryThrift

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

func (*BinaryThrift) Parse

func (this *BinaryThrift) Parse(body string) (pairs map[string]json.RawMessage, requestMark string, err error, protocal string)

type CompactThrift

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

func (*CompactThrift) Parse

func (this *CompactThrift) Parse(body string) (pairs map[string]json.RawMessage, requestMark string, err error, protocal string)

type FlushAfterChunkWriter

type FlushAfterChunkWriter struct {
	*bufio.Writer
}

FlushAfterChunkWriter signals from the caller of NewChunkedWriter that each chunk should be followed by a flush. It is used by the http.Transport code to keep the buffering behavior for headers and trailers, but flush out chunks aggressively in the middle for request bodies which may be generated slowly. See Issue 6574.

type HTTP

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

func (*HTTP) Parse

func (this *HTTP) Parse(body string) (pairs map[string]json.RawMessage, requestMark string, err error, protocal string)

type Mysql

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

func (*Mysql) Parse

func (this *Mysql) Parse(body string) (pairs map[string]json.RawMessage, requestMark string, err error, protocal string)

type Protocol

type Protocol interface {
	Parse(string) (pairs map[string]json.RawMessage, requestMark string, err error, protocal string)
}

type Public

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

func (*Public) Parse

func (this *Public) Parse(body string) (pairs map[string]json.RawMessage, requestMark string, err error, protocal string)

type Redis

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

func (*Redis) Parse

func (this *Redis) Parse(body string) (pairs map[string]json.RawMessage, requestMark string, err error, protocal string)

Jump to

Keyboard shortcuts

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