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

Andy Green andy at warmcat.com
Mon May 20 17:17:19 CEST 2019

On May 20, 2019 7:55:00 AM PDT, Dave Horton <daveh at beachdognet.com> wrote:
>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
>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

It should be okay.  Does it help if you add this flag to the tokenizer init for the code calling that?



>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org

More information about the Libwebsockets mailing list