client ext hdr skip if no arg

https://github.com/warmcat/libwebsockets/issues/453#event-583227314

abnf does say has to be at least one arg

Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
Andy Green 2016-03-09 23:13:31 +08:00
parent 43befcba91
commit 4f5ebec3ef
2 changed files with 5 additions and 2 deletions

View file

@ -38,6 +38,7 @@ using up the pool.
8) MAJOR windows-only-POLLHUP was not coming
9) Client should not send ext hdr if no exts
Changes
-------

View file

@ -1081,7 +1081,6 @@ lws_generate_client_handshake(struct lws *wsi, char *pkt)
/* tell the server what extensions we could support */
p += sprintf(p, "Sec-WebSocket-Extensions: ");
#ifndef LWS_NO_EXTENSIONS
ext = context->extensions;
while (ext && ext->callback) {
@ -1113,13 +1112,16 @@ lws_generate_client_handshake(struct lws *wsi, char *pkt)
if (ext_count)
*p++ = ',';
else
p += sprintf(p, "Sec-WebSocket-Extensions: ");
p += sprintf(p, "%s", ext->client_offer);
ext_count++;
ext++;
}
if (ext_count)
p += sprintf(p, "\x0d\x0a");
#endif
p += sprintf(p, "\x0d\x0a");
if (wsi->ietf_spec_revision)
p += sprintf(p, "Sec-WebSocket-Version: %d\x0d\x0a",