app-server: fix connecting via websockets with Sec-WebSocket-Extensions: permessage-deflate (#12629)

# External (non-OpenAI) Pull Request Requirements

Before opening this Pull Request, please read the dedicated
"Contributing" markdown file or your PR may be closed:
https://github.com/openai/codex/blob/main/docs/contributing.md

If your PR conforms to our contribution guidelines, replace this text
with a detailed and high quality description of your changes.

Include a link to a bug report or enhancement request.
This commit is contained in:
Javi authored and GitHub committed 2026-02-24 02:41:03 +00:00
1 parent d580995957
commit 5a3bdcb27b
1 file changed
+10 -8
+10 -8
View File
@@ -30,8 +30,9 @@ use tokio::net::TcpListener;
use tokio::net::TcpStream; use tokio::net::TcpStream;
use tokio::sync::mpsc; use tokio::sync::mpsc;
use tokio::task::JoinHandle; use tokio::task::JoinHandle;
use tokio_tungstenite::accept_async; use tokio_tungstenite::accept_async_with_config;
use tokio_tungstenite::tungstenite::Message as WebSocketMessage; use tokio_tungstenite::tungstenite::Message as WebSocketMessage;
use tokio_tungstenite::tungstenite::protocol::WebSocketConfig;
use tokio_util::sync::CancellationToken; use tokio_util::sync::CancellationToken;
use tracing::debug; use tracing::debug;
use tracing::error; use tracing::error;
@@ -307,13 +308,14 @@ async fn run_websocket_connection(
stream: TcpStream, stream: TcpStream,
transport_event_tx: mpsc::Sender<TransportEvent>, transport_event_tx: mpsc::Sender<TransportEvent>,
) { ) {
let websocket_stream = match accept_async(stream).await { let websocket_stream =
Ok(stream) => stream, match accept_async_with_config(stream, Some(WebSocketConfig::default())).await {
Err(err) => { Ok(stream) => stream,
warn!("failed to complete websocket handshake: {err}"); Err(err) => {
return; warn!("failed to complete websocket handshake: {err}");
} return;
}; }
};
let (writer_tx, writer_rx) = mpsc::channel::<OutgoingMessage>(CHANNEL_CAPACITY); let (writer_tx, writer_rx) = mpsc::channel::<OutgoingMessage>(CHANNEL_CAPACITY);
let writer_tx_for_reader = writer_tx.clone(); let writer_tx_for_reader = writer_tx.clone();