mirror of
https://github.com/openai/codex.git
synced 2026-10-30 19:18:49 +00:00
Remove WebSocket transport from code-mode hosts (#40692)
## What changed - Accept only `http://` and `https://` gRPC endpoints for app server `--code-mode-host` connections. - Limit the standalone code-mode host to stdio and gRPC listeners. - Remove the WebSocket session provider, dual-WebSocket negotiation, transport lanes, and related dependencies and tests. - Keep coverage for shared and prewarmed gRPC hosts and reject WebSocket host URLs in CLI parsing tests. GitOrigin-RevId: 8792604e79ffd54ce776074a4dc3f7d55e63752a
This commit is contained in:
committed by
copyberry
parent
9be8d6e1c3
commit
725b3a44f8
@@ -4,21 +4,6 @@ use super::parse_host_url;
|
||||
use pretty_assertions::assert_eq;
|
||||
use url::Url;
|
||||
|
||||
#[test]
|
||||
fn websocket_host_accepts_local_and_secure_endpoints() {
|
||||
for endpoint in [
|
||||
"ws://127.0.0.1:8765",
|
||||
"wss://example.test/code-mode",
|
||||
"ws://alice:secret@example.test/code-mode",
|
||||
"wss://alice:secret@example.test/code-mode",
|
||||
] {
|
||||
assert_eq!(
|
||||
parse_host_url(endpoint),
|
||||
Ok(Url::parse(endpoint).expect("test endpoint should parse"))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn grpc_host_accepts_local_and_secure_endpoints() {
|
||||
for endpoint in ["http://127.0.0.1:8765", "https://example.test"] {
|
||||
@@ -50,8 +35,13 @@ fn code_mode_host_rejects_invalid_endpoints() {
|
||||
for endpoint in [
|
||||
"ftp://127.0.0.1:8765",
|
||||
"ws://",
|
||||
"not a host endpoint",
|
||||
"ws://127.0.0.1:8765",
|
||||
"wss://example.test/code-mode",
|
||||
"ws://alice:secret@example.test/code-mode",
|
||||
"wss://alice:secret@example.test/code-mode",
|
||||
"wss://example.test/code-mode#fragment",
|
||||
"http://",
|
||||
"not a host endpoint",
|
||||
"https://example.test/code-mode#fragment",
|
||||
"https://example.test/code-mode",
|
||||
"http://example.test/?token=secret",
|
||||
@@ -64,25 +54,13 @@ fn code_mode_host_rejects_invalid_endpoints() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn omitted_websocket_host_selects_local_transport() {
|
||||
fn omitted_host_selects_local_transport() {
|
||||
assert_eq!(
|
||||
CodeModeHostTransport::from(AppServerCodeModeHostArgs::default()),
|
||||
CodeModeHostTransport::Local
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn explicit_websocket_host_selects_remote_transport() {
|
||||
let url = Url::parse("wss://example.test/code-mode").expect("test endpoint should parse");
|
||||
|
||||
assert_eq!(
|
||||
CodeModeHostTransport::from(AppServerCodeModeHostArgs {
|
||||
code_mode_host: Some(url.clone()),
|
||||
}),
|
||||
CodeModeHostTransport::WebSocket(url)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn explicit_grpc_host_selects_remote_transport() {
|
||||
let url = Url::parse("https://example.test").expect("test endpoint should parse");
|
||||
|
||||
Reference in New Issue
Block a user