mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:20:47 +00:00
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
This commit is contained in:
@@ -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<HttpClient, BuildCustomCaTransportError> {
|
||||
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<HttpClient, BuildCustomCaTransportError> {
|
||||
self.build_with_proxy_routing(ProxyRouting::Direct)
|
||||
pub fn build_direct(mut self) -> Result<HttpClient, BuildCustomCaTransportError> {
|
||||
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<HttpClient, BuildCustomCaTransportError> {
|
||||
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,
|
||||
|
||||
@@ -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<Arc<ChatGptCookieStore>> {
|
||||
self.chatgpt_cookie_store.clone()
|
||||
}
|
||||
|
||||
@@ -143,11 +143,6 @@ impl Request {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_raw_body(mut self, body: impl Into<Bytes>) -> Self {
|
||||
self.body = Some(RequestBody::Raw(body.into()));
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_compression(mut self, compression: RequestCompression) -> Self {
|
||||
self.compression = compression;
|
||||
self
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user