[package]
name = "catcher-http"
version = "0.3.16"
edition = "2021"
description = "HTTP client for catcher — resilient transport with retry, circuit breaker, priority scheduling"
license = "MIT"
repository = "https://github.com/eric8810/catcher"

[features]
default = ["rustls-tls", "hickory-dns"]
rustls-tls = ["reqwest/rustls", "dep:rustls", "dep:rustls-pki-types", "dep:sha2", "dep:webpki-roots"]
native-tls = ["reqwest/native-tls"]
hickory-dns = ["catcher-dns/hickory-dns", "catcher-dns/reqwest-resolver"]
napi = ["dep:napi", "dep:napi-derive"]
system-proxy = ["catcher-dns/system-proxy"]

[dependencies]
catcher-core = { path = "../catcher-core", version = "0.3.16" }
catcher-dns = { path = "../catcher-dns", version = "0.3.16", default-features = false }

# ── 异步运行时 ──
tokio = { version = "1", features = ["sync", "time", "net", "io-util", "macros"] }
tokio-util = "0.7"
async-trait = "0.1"

# ── SSE streaming ──
tokio-stream = "0.1"
bytes = "1"

# ── HTTP 传输 ──
# ⚠️ 升级 reqwest 时务必重跑 tests/proxy_dns_behavior_test.rs：代理路径下「目标域名交给
# 代理远端解析、不被本地 resolver 解析」依赖 reqwest 内部行为，非明文 API 承诺（issue #031）。
reqwest = { version = "0.13", default-features = false, features = [
    "http2", "gzip", "brotli", "deflate", "stream", "charset", "query", "form", "socks"
] }
reqwest-middleware = "0.5"
reqwest-retry = "0.9"
retry-policies = "0.5"
http = "1"

# ── TLS pinning (pulled in by rustls-tls) ──
rustls = { version = "0.23", optional = true, default-features = false, features = ["aws_lc_rs", "logging", "std", "tls12"] }
rustls-pki-types = { version = "1", optional = true, features = ["std"] }
sha2 = { version = "0.10", optional = true }
base64 = { version = "0.22" }
webpki-roots = { version = "0.26", optional = true }

# ── 重试与退避 ──
backon = "1"

# ── 序列化 ──
serde = { version = "1", features = ["derive"] }
serde_json = "1"
rmp-serde = "1"

# ── 工具 ──
parking_lot = "0.12"

# ── FFI (napi, 可选) ──
napi = { version = "2", optional = true, default-features = false, features = ["napi4", "tokio_rt", "serde-json"] }
napi-derive = { version = "2", optional = true }

[dev-dependencies]
catcher-test-support = { path = "../catcher-test-support" }
tokio-test = "0.4"
wiremock = "0.6"
