Documentation
¶
Overview ¶
Package requestsutls provides a concurrent, profile-driven HTTP client. This Go prototype deliberately has no mutable default headers or cookie jar.
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type HeaderField ¶
HeaderField is one field occurrence. Slices retain duplicates and their order.
type Options ¶
type Options struct {
// Connect/TLS/Proxy timeouts default to 10s when zero. Header/body zero disables
// the phase limit. The caller context always bounds the whole operation.
ConnectTimeout time.Duration
ProxyConnectTimeout time.Duration
TLSHandshakeTimeout time.Duration
ResponseHeaderTimeout time.Duration
BodyTimeout time.Duration
Profile *profile.Profile
ProxyURL string // Explicit http:// CONNECT proxy; empty means direct.
ProxyAuth *ProxyAuth // Optional separate Basic credentials; cannot combine with URL userinfo.
RootCAs *x509.CertPool
InsecureSkipVerify bool
DisableSessionResumption bool // Default false: cache TLS tickets within this Session.
ForceHTTP1 bool // Advertise only HTTP/1.1 and use its ordered wire transport.
RandomJA3 bool // Shuffle eligible TLS extensions for each new connection.
DisableContentDecoding bool // Return the compressed response bytes unchanged.
MaxConcurrentRequests int // 0 means 64; includes body consumption.
MaxPendingRequests int // 0 means no waiting queue.
MaxResponseBytes int64 // 0 means 32 MiB.
MaxUnprocessedRetries int // 0 means 3; -1 disables; maximum 32. Only proven-unprocessed requests.
}
Options are snapshotted by NewSession. A Session's transport never changes.
type ProxyAuth ¶
ProxyAuth is snapshotted when the Session is created. Credentials are sent only to the proxy in the CONNECT request, never as origin request headers.
type Request ¶
type Request struct {
Method string `json:"method"`
URL string `json:"url"`
Headers []HeaderField `json:"headers"`
// HeadersOrder matches regular header names case-insensitively. A name listed once
// groups all its values; repeated names specify each occurrence's position.
// For a present name, repeated entries must match its number of values.
// Absent names are ignored, unlisted fields follow in their original order,
// and an empty list preserves field order. Generated fields also participate.
// Content-Length is calculated from Body. HTTP/1 retains field casing;
// HTTP/2 lowercases wire names. Pseudo-header order is part of the profile.
HeadersOrder []string `json:"headers_order,omitempty"`
Body []byte `json:"body,omitempty"`
}
Request owns the input for a single operation. Do snapshots its slices; callers must not mutate them concurrently with Do taking that snapshot.
type Response ¶
type Response struct {
StatusCode int `json:"status_code"`
Headers []HeaderField `json:"headers"`
Body []byte `json:"body"`
Protocol string `json:"protocol"`
Decoded bool `json:"decoded"`
}
Response contains the final response's ordered regular fields and body. Content decoding is enabled by default; Decoded identifies transformed bodies while Headers always retain their original wire values. Redirects are not followed.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session is safe for concurrent Do and Close calls. Create another Session to change the profile or trust configuration; connections cannot cross Sessions.
func NewSession ¶
func (*Session) Close ¶
Close cancels all admitted requests, closes active/idle connections and waits for Do calls to release resources. Concurrent/repeated calls are idempotent.
func (*Session) ProfileHash ¶
ProfileHash identifies the immutable configuration used for this Session.
type StageError ¶ added in v0.3.0
StageError identifies the operation that failed. Unwrap preserves cancellation, deadline and size-limit classification. The underlying error remains inspectable.
func (*StageError) Error ¶ added in v0.3.0
func (e *StageError) Error() string
func (*StageError) Unwrap ¶ added in v0.3.0
func (e *StageError) Unwrap() error
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
peetcheck
command
Command peetcheck performs an opt-in live acceptance probe.
|
Command peetcheck performs an opt-in live acceptance probe. |
|
requests-utls
command
Command requests-utls validates profiles and exercises the Go prototype.
|
Command requests-utls validates profiles and exercises the Go prototype. |
|
requests-utls-shared
command
Command requests-utls-shared builds ABI v1 with -buildmode=c-shared.
|
Command requests-utls-shared builds ABI v1 with -buildmode=c-shared. |
|
requests-utls-testpeer
command
requests-utls-testpeer is a loopback-only HTTP/2 peer for external bindings' integration tests.
|
requests-utls-testpeer is a loopback-only HTTP/2 peer for external bindings' integration tests. |
|
internal
|
|
|
h2
Package http2 implements the HTTP/2 protocol.
|
Package http2 implements the HTTP/2 protocol. |
|
h2/internal/httpsfv
Package httpsfv provides functionality for dealing with HTTP Structured Field Values.
|
Package httpsfv provides functionality for dealing with HTTP Structured Field Values. |
|
testserver
Package testserver provides a local HTTP/2 peer that exposes wire ordering.
|
Package testserver provides a local HTTP/2 peer that exposes wire ordering. |
|
Package native implements the handle and completion lifecycle behind ABI v1.
|
Package native implements the handle and completion lifecycle behind ABI v1. |
|
Code generated from the IANA TLS Cipher Suites registry; DO NOT EDIT.
|
Code generated from the IANA TLS Cipher Suites registry; DO NOT EDIT. |