soup_websocket_client_prepare_handshake may generate invalid Sec-Websocket-Protocol header
Hi,
The WebSocket RFC requires in section 4.1 item 10 for the Sec-WebSocket-Protocol
header that
If present, this value indicates one or more comma-separated subprotocol the client wishes to speak [...]
Strict implementations like the popular Node.js library ws follow that definition to the letter and abort the handshake, if the Sec-WebSocket-Protocol
header is set but empty. Ideally, soup should reject an empty list of protocols or handle it gracefully (as in: not setting the header, if the list of protocols is empty) but unfortunately does neither.
I’m not a C guy, so I don’t really know how to fix this, but spotted this issue when working with a GJS userland WebSocket implementation.
Thank you for your time!
Konrad