1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

fix issuing null extension header if none supported

Josh realized that with new Chrome, because we don't support the type of
compression extension yet we returned a null extension header.

This patch fixes that by deferring issuing the extension header until we
find we have something to say.

tested OK on google-chrome 19.0.1081.2-129295

Reported-by: Josh Roberson <josh@asteriasgi.com>
Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
Andy Green 2012-03-29 09:27:13 +08:00 committed by Andy Green
parent d515ddd51d
commit 15601fd8f1

View file

@ -340,8 +340,6 @@ handshake_0405(struct libwebsocket_context *context, struct libwebsocket *wsi)
*/
if (wsi->utf8_token[WSI_TOKEN_EXTENSIONS].token_len) {
strcpy(p, "\x0d\x0aSec-WebSocket-Extensions: ");
p += strlen("\x0d\x0aSec-WebSocket-Extensions: ");
/*
* break down the list of client extensions
@ -410,6 +408,10 @@ handshake_0405(struct libwebsocket_context *context, struct libwebsocket *wsi)
if (ext_count)
*p++ = ',';
else {
strcpy(p, "\x0d\x0aSec-WebSocket-Extensions: ");
p += strlen("\x0d\x0aSec-WebSocket-Extensions: ");
}
p += sprintf(p, "%s", ext_name);
ext_count++;
@ -444,7 +446,6 @@ handshake_0405(struct libwebsocket_context *context, struct libwebsocket *wsi)
}
}
/* end of response packet */
strcpy(p, "\x0d\x0a\x0d\x0a");