From 6b7a16fe76a9d5666df025af8ccd1c445aad3a67 Mon Sep 17 00:00:00 2001 From: jif Date: Tue, 24 Nov 2026 15:16:26 +0000 Subject: [PATCH] Remove unused HTTP client APIs (#63669) ## What changed - Remove the deprecated `build_with_transport_default_proxy` method and inline its shared helper into the remaining caller, `build_direct`. - Remove the unused `has_chatgpt_cookies` accessor, `with_raw_body` setter, and `with_chatgpt_cloudflare_cookies_without_redirects` pool constructor. GitOrigin-RevId: 9dd19b7a28b1aac6f196968b53160ffbc7443b8a --- codex-rs/http-client/src/client_builder.rs | 33 +++---------------- codex-rs/http-client/src/outbound_proxy.rs | 5 --- codex-rs/http-client/src/request.rs | 5 --- .../src/route_aware_client_pool.rs | 15 --------- 4 files changed, 5 insertions(+), 53 deletions(-) diff --git a/codex-rs/http-client/src/client_builder.rs b/codex-rs/http-client/src/client_builder.rs index 982402ac26..58a755a200 100644 --- a/codex-rs/http-client/src/client_builder.rs +++ b/codex-rs/http-client/src/client_builder.rs @@ -264,22 +264,6 @@ impl HttpClientBuilder { self } - /// Builds a client using the transport's default proxy behavior. - /// - /// # Legacy compatibility only - /// - /// This bypasses [`HttpClientFactory`] and therefore does not honor its configured outbound - /// proxy policy. New product traffic must use [`Self::build_respecting_outbound_proxy_policy`] - /// or [`HttpClientFactory::build_client`]. - #[deprecated( - note = "legacy compatibility only; use HttpClientFactory::build_client or build_respecting_outbound_proxy_policy" - )] - pub fn build_with_transport_default_proxy( - self, - ) -> Result { - self.build_with_proxy_routing(ProxyRouting::TransportDefault) - } - /// Builds a client that connects directly without using a proxy. /// /// # Exceptional use only @@ -289,8 +273,11 @@ impl HttpClientBuilder { /// sandbox traffic whose egress routing is handled separately. Ordinary outbound product /// traffic must use [`Self::build_respecting_outbound_proxy_policy`] or /// [`HttpClientFactory::build_client`]. - pub fn build_direct(self) -> Result { - self.build_with_proxy_routing(ProxyRouting::Direct) + pub fn build_direct(mut self) -> Result { + let request_logging = self.request_logging; + let default_headers = self.default_headers.take().unwrap_or_default(); + build_reqwest_client_with_custom_ca(self.reqwest_builder(ProxyRouting::Direct)) + .map(|inner| HttpClient::from_parts(inner, request_logging, default_headers)) } /// Builds a transport-default client while preserving the legacy custom-CA fallback. @@ -328,16 +315,6 @@ impl HttpClientBuilder { } } - fn build_with_proxy_routing( - mut self, - proxy_routing: ProxyRouting, - ) -> Result { - let request_logging = self.request_logging; - let default_headers = self.default_headers.take().unwrap_or_default(); - build_reqwest_client_with_custom_ca(self.reqwest_builder(proxy_routing)) - .map(|inner| HttpClient::from_parts(inner, request_logging, default_headers)) - } - pub(crate) fn build_with_custom_ca_fallback( self, proxy_routing: ProxyRouting, diff --git a/codex-rs/http-client/src/outbound_proxy.rs b/codex-rs/http-client/src/outbound_proxy.rs index 7e385bcfd3..61240dc73f 100644 --- a/codex-rs/http-client/src/outbound_proxy.rs +++ b/codex-rs/http-client/src/outbound_proxy.rs @@ -262,11 +262,6 @@ impl HttpClientFactory { self } - /// Returns whether ChatGPT cookie-store clients have additional configured cookies. - pub fn has_chatgpt_cookies(&self) -> bool { - self.chatgpt_cookie_store.is_some() - } - pub(crate) fn chatgpt_cookie_store(&self) -> Option> { self.chatgpt_cookie_store.clone() } diff --git a/codex-rs/http-client/src/request.rs b/codex-rs/http-client/src/request.rs index 2ef88d0c2c..d4f6c391b9 100644 --- a/codex-rs/http-client/src/request.rs +++ b/codex-rs/http-client/src/request.rs @@ -143,11 +143,6 @@ impl Request { self } - pub fn with_raw_body(mut self, body: impl Into) -> Self { - self.body = Some(RequestBody::Raw(body.into())); - self - } - pub fn with_compression(mut self, compression: RequestCompression) -> Self { self.compression = compression; self diff --git a/codex-rs/http-client/src/route_aware_client_pool.rs b/codex-rs/http-client/src/route_aware_client_pool.rs index 558a58fccb..df8e5986ea 100644 --- a/codex-rs/http-client/src/route_aware_client_pool.rs +++ b/codex-rs/http-client/src/route_aware_client_pool.rs @@ -428,21 +428,6 @@ impl RouteAwareClientPool { ) } - /// Creates a no-redirect pool that retains the Cloudflare cookies required by ChatGPT - /// endpoints. - pub fn with_chatgpt_cloudflare_cookies_without_redirects( - http_client_factory: HttpClientFactory, - route_class: ClientRouteClass, - ) -> Self { - Self::with_builder( - http_client_factory, - route_class, - HttpClientBuilder::new() - .with_chatgpt_cloudflare_cookie_store() - .without_redirects(), - ) - } - /// Creates a no-redirect ChatGPT Cloudflare-cookie pool without request diagnostics. pub fn with_chatgpt_cloudflare_cookies_without_redirects_or_request_logging( http_client_factory: HttpClientFactory,