httpx

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Header(headers http.Header) string

func ValidateProxyURL

func ValidateProxyURL(proxy string) (string, error)

Types

type Client added in v1.0.0

type Client struct {
	Client      *req.Client
	Options     *Options
	RateLimiter ratelimit.Limiter // 每秒请求速率限制
}

func NewClient added in v1.0.0

func NewClient(o *Options) *Client

func (*Client) Basic added in v1.0.0

func (c *Client) Basic(target string, method string, body string, header map[string]string, username, password string) (*Response, error)

func (*Client) Request added in v1.0.0

func (c *Client) Request(target string, method string, body string, header map[string]string) (*Response, error)

func (*Client) Upload added in v1.0.0

func (c *Client) Upload(target string, params map[string]string, name, fileName string) (*Response, error)

type Options added in v1.0.0

type Options struct {
	Timeout         int
	RetryTimes      int    // 重定向次数 0 为不重试
	VerifySSL       bool   // default false
	AllowRedirect   int    // default false
	Proxy           string // proxy settings, support http/https proxy only, e.g. http://127.0.0.1:8080
	QPS             int    // 每秒最大请求数
	MaxConnsPerHost int    // 每个 host 最大连接数
	Headers         map[string]string
}

type Param

type Param struct {
	// Name of the posted parameter.
	Name string `json:"name"`
	// Value of the posted parameter.
	Value string `json:"value,omitempty"`
	// Filename of a posted file.
	Filename string `json:"fileName,omitempty"`
	// ContentType is the content type of posted file.
	ContentType string `json:"contentType,omitempty"`

	FileHeader   textproto.MIMEHeader
	FileSize     int64
	FileContent  []byte
	IsFile       bool
	Boundary     string
	FilenotFound bool
	IsBase64     bool
	Index        int //
}

Param describes an individual posted parameter.

type Response

type Response struct {
	Status           string
	StatusCode       int
	Body             string
	RequestDump      string
	ResponseDump     string
	Header           http.Header
	ContentLength    int
	RequestUrl       string
	Location         string
	ServerDurationMs float64 // 服务器响应时间
}

func Get added in v0.3.1

func Get(target string) (*Response, error)

func Request

func Request(target string, method string, body string, header map[string]string) (*Response, error)

func Request10 added in v1.0.0

func Request10(host, raw string) (*Response, error)

Request10 发送 http/1.0

type Variations

type Variations struct {
	// MimeType is the MIME type of the posted data.
	MimeType string `json:"mimeType"`
	// Params is a list of posted parameters (in case of URL encoded parameters).
	Params []Param `json:"params"`
	// OriginalParams 存储原始的值
	OriginalParams []Param `json:"original_params"`
	// Text contains the posted data. Although its type is string, it may contain
	// binary data.
	Text string `json:"text"`
}

func ParseUri

func ParseUri(uri string, body []byte, method string, contentType string, headers map[string]string) (*Variations, error)

ParseUri 对请求进行格式化

func (Variations) Len

func (p Variations) Len() int

func (Variations) Less

func (p Variations) Less(i, j int) bool

Less 顺序有低到高排序

func (*Variations) Release

func (p *Variations) Release() string

func (Variations) Set

func (p Variations) Set(key string, value string) error

func (*Variations) SetPayloadByIndex

func (p *Variations) SetPayloadByIndex(index int, uri string, payload string, method string) string

SetPayloadByIndex 根据索引设置payload

GET 返回 http://testphp.vulnweb.com/listproducts.php?artist=((,”"(,"","((

POST 返回 artist=')”,)'(())')(

func (Variations) Swap

func (p Variations) Swap(i, j int)

Jump to

Keyboard shortcuts

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