mirror of
https://github.com/openai/codex.git
synced 2026-09-06 15:29:32 +00:00
## Why Route-aware clients select a direct or proxy route from the complete request URL. Letting `reqwest` follow redirects internally reuses the client chosen for the original URL, so the redirect destination cannot receive its own PAC or system proxy decision. ## What changed - Follow redirects through `RouteAwareClientPool` when respecting the system proxy, resolving and caching a route for every hop. - Preserve standard redirect method and body behavior, enforce one timeout across the request chain, and cap redirects at 10 hops. - Strip origin-sensitive credentials and stale proxy authorization when the destination or selected route changes, and apply safe `Referer` handling. - Log one final request outcome instead of intermediate redirect responses. ## Testing Added an integration test covering a redirect from a direct route to a proxy route, credential handling, and final-outcome logging. GitOrigin-RevId: e5cb2cc962e99d33df61ef649465e956b92279bb
51 lines
2.1 KiB
Rust
51 lines
2.1 KiB
Rust
mod chatgpt_cloudflare_cookies;
|
|
mod chatgpt_hosts;
|
|
mod custom_ca;
|
|
mod default_client;
|
|
mod error;
|
|
mod outbound_proxy;
|
|
mod request;
|
|
mod route_aware_client_pool;
|
|
mod route_aware_redirect;
|
|
mod transport;
|
|
|
|
pub use crate::chatgpt_cloudflare_cookies::with_chatgpt_cloudflare_cookie_store;
|
|
pub use crate::chatgpt_hosts::is_allowed_chatgpt_host;
|
|
pub use crate::custom_ca::BuildCustomCaTransportError;
|
|
/// Test-only subprocess hook for custom CA coverage.
|
|
///
|
|
/// This stays public only so the `custom_ca_probe` binary target can reuse the shared helper. It
|
|
/// is hidden from normal docs because ordinary callers should use
|
|
/// [`build_reqwest_client_with_custom_ca`] instead.
|
|
#[doc(hidden)]
|
|
pub use crate::custom_ca::build_reqwest_client_for_subprocess_tests;
|
|
pub use crate::custom_ca::build_reqwest_client_with_custom_ca;
|
|
pub use crate::custom_ca::build_rustls_client_config_with_custom_ca;
|
|
pub use crate::custom_ca::maybe_build_rustls_client_config_with_custom_ca;
|
|
pub use crate::default_client::HttpClient;
|
|
pub use crate::default_client::HttpError;
|
|
pub use crate::default_client::HttpResponse;
|
|
pub use crate::default_client::RequestBuilder;
|
|
pub use crate::error::StreamError;
|
|
pub use crate::error::TransportError;
|
|
pub use crate::outbound_proxy::BuildRouteAwareHttpClientError;
|
|
pub use crate::outbound_proxy::ClientRouteClass;
|
|
pub use crate::outbound_proxy::HttpClientFactory;
|
|
pub use crate::outbound_proxy::OutboundProxyPolicy;
|
|
pub use crate::outbound_proxy::OutboundProxyRoute;
|
|
pub use crate::outbound_proxy::RouteFailureClass;
|
|
pub use crate::request::EncodedJsonBody;
|
|
pub use crate::request::PreparedRequestBody;
|
|
pub use crate::request::Request;
|
|
pub use crate::request::RequestBody;
|
|
pub use crate::request::RequestCompression;
|
|
pub use crate::request::Response;
|
|
pub use crate::route_aware_client_pool::RouteAwareClientPool;
|
|
pub use crate::route_aware_client_pool::RouteAwareClientPoolError;
|
|
pub use crate::route_aware_client_pool::RouteAwareRequestBuilder;
|
|
pub use crate::route_aware_client_pool::RouteAwareRequestError;
|
|
pub use crate::transport::ByteStream;
|
|
pub use crate::transport::HttpTransport;
|
|
pub use crate::transport::ReqwestTransport;
|
|
pub use crate::transport::StreamResponse;
|