Skip to content

Commit ef4a85d

Browse files
committed
ws: ext header is already delimited if present
1 parent a656eb5 commit ef4a85d

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

lib/roles/ws/server-ws.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -737,20 +737,21 @@ handshake_0405(struct lws_context *context, struct lws *wsi)
737737

738738
LWS_CPYAPP(p, "\x0d\x0aSec-WebSocket-Protocol: ");
739739
p += lws_snprintf(p, 128, "%s", prot);
740+
LWS_CPYAPP(p, "\x0d\x0a");
740741
}
741742

742743
#if !defined(LWS_WITHOUT_EXTENSIONS)
743744
/*
744745
* Figure out which extensions the client has that we want to
745746
* enable on this connection, and give him back the list.
746747
*
747-
* Give him a limited write bugdet
748+
* Give him a limited write bugdet.
749+
*
750+
* This appends a closing CRLF before returning, if h1
748751
*/
749-
LWS_CPYAPP(p, "\x0d\x0a");
750752
if (lws_extension_server_handshake(wsi, &p, 190))
751753
goto bail;
752754
#endif
753-
LWS_CPYAPP(p, "\x0d\x0a");
754755

755756
args.p = p;
756757
args.max_len = lws_ptr_diff((char *)pt->serv_buf +

0 commit comments

Comments
 (0)