From f192c01a135ddf21b11e650ba15eed131772f97d Mon Sep 17 00:00:00 2001 From: Andy Green Date: Wed, 9 Mar 2016 23:35:41 +0800 Subject: [PATCH] client ext hdr skip if no arg https://github.com/warmcat/libwebsockets/issues/453 Signed-off-by: Andy Green --- changelog | 5 +++++ lib/client.c | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/changelog b/changelog index ba12a03b5..88367dbc8 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,11 @@ Changelog --------- +Fixes +----- + +1) MINOR: d9n't send ext hdr if no exts to discuss + v1.7.3 ====== diff --git a/lib/client.c b/lib/client.c index 33d990e41..1ba809b9f 100644 --- a/lib/client.c +++ b/lib/client.c @@ -956,7 +956,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) { @@ -988,13 +987,17 @@ 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",