[Libwebsockets] subprotocol parsing issue (is dot a delimiter?)

Dave Horton daveh at beachdognet.com
Mon May 20 16:55:00 CEST 2019


I’m sure this is an issue / misunderstanding on my side, but my client is using a subprotocol named “audiostream.drachtio.org”, ie my upgrade request looks like this

GET / HTTP/1.1
Pragma: no-cache
Cache-Control: no-cache
Host: 127.0.0.1
Origin: http://127.0.0.1
Upgrade: websocket
Connection: close, Upgrade
Sec-WebSocket-Key: O/QI+xJO4BEDFQKSNYQyhA==
Sec-WebSocket-Protocol: audiostream.drachtio.org
Sec-WebSocket-Version: 13


However, my lws server is parsing that as “audiostream”, i.e. it is taking a dot (.) as a delimiter.  I’ve stepped through the code in gdb and I can see that it is doing this.  At the end of lws_tokenize it is returning this

(gdb) n
3324			return LWS_TOKZE_TOKEN;
(gdb) p *ts
$19 = {start = 0x7fffffffdbcb ".drachtio.org", token = 0x7fffffffdbc0 "audiostream.drachtio.org", len = 13, token_len = 11, flags = 13, delim = 1}

I thought using dot domain separated subprotocols was a recommended practice.  What am I doing wrong?  This is on the v3.1.0 tag BTW

Dave


More information about the Libwebsockets mailing list