mirror of
https://github.com/openai/codex.git
synced 2026-11-24 07:20:27 +00:00
Support configured ChatGPT cookies in HTTP clients (#36984)
## What changed - Let `HttpClientFactory` carry additional ChatGPT cookies and share their store across cloned factories. - Attach configured cookies when route-aware clients or explicitly opted-in clients enable the ChatGPT cookie store. - Combine configured cookies with the current path-scoped Cloudflare cookies only for HTTPS ChatGPT hosts, while preserving sensitive-header metadata. ## Testing - Cover cookie merging, path-scoped Cloudflare updates, host and scheme restrictions, sensitive values, and factory clone/equality behavior. GitOrigin-RevId: 5baf745859e14db739fd62ab931720dbe90c04e0
This commit is contained in:
1 parent
bf05737da4
commit
411f3f0680
4 files changed
+198
-4
No files matched your search
@@ -119,6 +119,28 @@ fn read_http_message(stream: &mut impl Read) -> String {
|
||||
String::from_utf8_lossy(&buffer).into_owned()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cloned_factories_share_chatgpt_cookie_stores_without_changing_value_equality() {
|
||||
let factory =
|
||||
HttpClientFactory::new(OutboundProxyPolicy::ReqwestDefault).with_chatgpt_cookies([
|
||||
HeaderValue::from_static("first=true"),
|
||||
HeaderValue::from_static("second=true"),
|
||||
]);
|
||||
let cloned = factory.clone();
|
||||
|
||||
assert!(Arc::ptr_eq(
|
||||
&factory.chatgpt_cookie_store().expect("configured store"),
|
||||
&cloned.chatgpt_cookie_store().expect("shared store"),
|
||||
));
|
||||
assert_eq!(
|
||||
factory,
|
||||
HttpClientFactory::new(OutboundProxyPolicy::ReqwestDefault).with_chatgpt_cookies([
|
||||
HeaderValue::from_static("first=true"),
|
||||
HeaderValue::from_static("second=true"),
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn websocket_route_uses_http_equivalent_for_system_resolution() {
|
||||
let env = MapEnv {
|
||||
|
||||
Reference in new issue
Block a user