AgentBull Internal Patched Clone (
AgentBull/wreq)This repository is an internal patched clone of
0x676e67/wreq, maintained as a single self-contained commit on top of upstreammain. It is referenced byrelay_nativeinAgentBull/saasvia Cargo's[patch.crates-io]with a pinnedrev.AgentBull Relay's outbound transport (
relay_native::transport) has two requirements that upstreamwreqdoes not support out of the box:
Proxy Tunnel Target Pinning (
wreq::conn::TunnelTarget) — SSRF & DNS Rebinding Defense
- Problem: Before opening an outbound connection, Relay resolves the upstream hostname locally and validates every resolved IP against private-network, loopback, link-local, and cloud-metadata blocklists. For direct connections, a custom DNS resolver pins the connection to those pre-validated IPs. However, when a request goes through an HTTP
CONNECTorSOCKS5proxy, upstreamwreq(connect_via_proxy) derives the tunnel target (CONNECT host:portauthority orSOCKS5target address) directly from the requestUri, bypassing the custom DNS resolver. Rewriting the requestUrihost to the validated IP is not an option because doing so corrupts the HTTPHost/:authorityheader, the TLS SNI server name, and X.509 certificate hostname verification.- Patch (P1): Adds a per-request extension
wreq::conn::TunnelTargetand threads it throughConnectionDescriptorintoconnect_via_proxyandsocks::connect. WhenTunnelTargetis present on a request, the HTTPCONNECTauthority andSOCKS5target use the pre-validated IP address while the requestUri,Host/:authority, TLS SNI, and certificate verification continue to use the original upstream hostname.Wire-Order HTTP/1.1 Header Emission (
wreq::header::OrderedHeaders) — Client Impersonation Fidelity
- Problem: Official LLM CLI clients (such as Claude Code and Codex CLI) send headers in a specific order and casing. Standard
http::HeaderMaplowercases all header names and does not guarantee iteration order across interleaved duplicate headers. UpstreamwreqprovidesOrigHeaderMap, butOrigHeaderMapgroups headers by lowercase name and retains only the first casing for duplicate header names, so interleaved duplicate headers (X-Trace: 1,Accept: */*,x-trace: 2) cannot be represented with their exact sequence and per-occurrence spelling.- Patch (P2): Adds a per-request extension
wreq::header::OrderedHeaderscarryingVec<(Bytes, HeaderValue)>. InConfigService, whenOrigHeaderMapis not set, a non-emptyOrderedHeadersextension installs an internalnetty::ext::OnPreserveHeaderCallbackimplementation that writes every listed header in exact wire order and original name bytes on HTTP/1.1, then drains any remaining unlisted entries (such as computedContent-Length) fromHeaderMapwithout exposing internalnettycallback traits inwreq's public API.All changes are kept in one single commit on top of upstream
main, touching only 8 files:
src/lib.rssrc/conn.rssrc/conn/descriptor.rssrc/conn/connector.rssrc/conn/proxy/socks.rssrc/client/layer/client.rssrc/client/layer/config.rssrc/header.rsTo sync with upstream
0x676e67/wreq:git fetch upstream git rebase --onto upstream/main HEAD^ git push --force-with-lease origin mainAfter pushing, update the
wreqrev(and matchingbtls/http2/netty[patch.crates-io]revs fromwreq/Cargo.toml) inAgentBull/saas(control_plane/native/relay_native/Cargo.toml) soCargo.lockand CI caches update atomically.
🚀 Help me work seamlessly with open source sharing by sponsoring me on GitHub
An ergonomic and modular Rust HTTP Client for high-fidelity protocol matching, featuring customizable TLS, JA3/JA4, and HTTP/2 signature capabilities.
- Plain bodies, JSON, urlencoded, multipart
- HTTP Trailer
- Cookie Store
- Redirect Policy
- Original Header
- Rotating Proxies
- Tower Middleware
- WebSocket Upgrade
- HTTPS via BoringSSL
- HTTP/2 over TLS Parity
- Certificate Store (CAs & mTLS)
- Multiple Runtime (Tokio, Compio)
The following example uses the Tokio runtime with optional features enabled by adding this to your Cargo.toml:
[dependencies]
tokio = { version = "1", features = ["full"] }
wreq = "0.16"
wreq-util = "0.2"And then the code:
use wreq::Client;
use wreq_util::Emulation;
#[tokio::main]
async fn main() -> wreq::Result<()> {
// Build a client
let client = Client::builder()
.emulation(Emulation::Safari26)
.build()?;
// Use the API you're already familiar with
let resp = client.get("https://pingly.us.kg/api/all").send().await?;
println!("{}", resp.text().await?);
Ok(())
}- HTTP/1 over TLS
In the Rust ecosystem, most HTTP clients rely on the http library, which performs well but does not preserve header case. This causes some WAFs to reject HTTP/1 requests with lowercase headers (see discussion). wreq addresses this by fully supporting HTTP/1 header case sensitivity.
- HTTP/2 over TLS
Due to the complexity of TLS encryption and the widespread adoption of HTTP/2, browser fingerprints such as JA3, JA4, and Akamai cannot be reliably emulated using simple fingerprint strings. Instead of parsing and emulating these string-based fingerprints, wreq provides fine-grained control over TLS and HTTP/2 extensions and settings for precise browser behavior emulation.
- Device Emulation
TLS and HTTP/2 fingerprints are often identical across various browser models because these underlying protocols evolve slower than browser release cycles. 100+ browser device emulation profiles are maintained in wreq-util.
The current MSRV is 1.98. The current edition is Rust 2024.
wreq has a rolling MSRV (Minimum Supported Rust Version) policy to support the current and previous Rust
compiler versions, and the latest edition of Rust.
We may periodically lag the MSRV behind this latest version/edition in rare cases for our dependencies to catch up and for us to perform any necessary fixes.
Compiling alongside openssl-sys can cause symbol conflicts with boringssl that lead to link failures, and on Linux and Android this can be avoided by enabling the prefix-symbols feature.
Install BoringSSL build dependencies and build with:
sudo apt-get install build-essential cmake perl pkg-config libclang-dev musl-tools git -y
cargo build --releaseThis GitHub Actions workflow can be used to compile the project on Linux, Windows, and macOS.
Help sustain the ongoing development of this open-source project by reaching out for commercial support. Receive private guidance, expert reviews, or direct access to the maintainer, with personalized technical assistance tailored to your needs.
Licensed under either of Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0).
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.
Solve reCAPTCHA in less than 2 seconds
Captcha.fun delivers fast, reliable CAPTCHA solving built for automation at scale.
With simple API integration, consistent performance, and competitive pricing, it's an easy way to keep your workflows moving without delays—use code WREQ for 10% bonus credits.
35M+ residential IPs with 99.9% success rates
UK-based Byteful provides ethically sourced residential, mobile, static residential (ISP), and datacenter proxies. Its API-first scraping, data collection, and AI automation tools handle tens of billions of monthly requests.
With free geo-targeting and ~0.5s response times, Byteful helps you collect data at scale. Use code WREQ10 for 10% off residential proxies.
TLS fingerprinting alone isn't enough for modern bot protection. Hyper Solutions provides the missing piece - API endpoints that generate valid antibot tokens for:
Akamai • DataDome • Kasada • Incapsula
No browser automation. Just simple API calls that return the exact cookies and headers these systems require.
A hard fork of reqwest.