From ef4a85d0e14270e83ce74213a0b4bb53e29a07be Mon Sep 17 00:00:00 2001 From: Andy Green Date: Wed, 5 Mar 2025 07:10:25 +0000 Subject: [PATCH] ws: ext header is already delimited if present --- lib/roles/ws/server-ws.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/roles/ws/server-ws.c b/lib/roles/ws/server-ws.c index 24d1a4d5a..fcbed28e8 100644 --- a/lib/roles/ws/server-ws.c +++ b/lib/roles/ws/server-ws.c @@ -737,6 +737,7 @@ handshake_0405(struct lws_context *context, struct lws *wsi) LWS_CPYAPP(p, "\x0d\x0aSec-WebSocket-Protocol: "); p += lws_snprintf(p, 128, "%s", prot); + LWS_CPYAPP(p, "\x0d\x0a"); } #if !defined(LWS_WITHOUT_EXTENSIONS) @@ -744,13 +745,13 @@ handshake_0405(struct lws_context *context, struct lws *wsi) * Figure out which extensions the client has that we want to * enable on this connection, and give him back the list. * - * Give him a limited write bugdet + * Give him a limited write bugdet. + * + * This appends a closing CRLF before returning, if h1 */ - LWS_CPYAPP(p, "\x0d\x0a"); if (lws_extension_server_handshake(wsi, &p, 190)) goto bail; #endif - LWS_CPYAPP(p, "\x0d\x0a"); args.p = p; args.max_len = lws_ptr_diff((char *)pt->serv_buf +