Commit 6ff833f9 authored by Carlos Garcia Campos's avatar Carlos Garcia Campos Committed by Claudio Saavedra

WebSockets: client_max_window_bits in server response must have a value

The value is optional in the request offer, but not in the server
response.

Fixes: #166
parent 2ec94649
Pipeline #121428 passed with stage
in 4 minutes and 16 seconds
...@@ -44,8 +44,7 @@ typedef enum { ...@@ -44,8 +44,7 @@ typedef enum {
PARAM_SERVER_NO_CONTEXT_TAKEOVER = 1 << 0, PARAM_SERVER_NO_CONTEXT_TAKEOVER = 1 << 0,
PARAM_CLIENT_NO_CONTEXT_TAKEOVER = 1 << 1, PARAM_CLIENT_NO_CONTEXT_TAKEOVER = 1 << 1,
PARAM_SERVER_MAX_WINDOW_BITS = 1 << 2, PARAM_SERVER_MAX_WINDOW_BITS = 1 << 2,
PARAM_CLIENT_MAX_WINDOW_BITS = 1 << 3, PARAM_CLIENT_MAX_WINDOW_BITS = 1 << 3
PARAM_CLIENT_MAX_WINDOW_BITS_VALUE = 1 << 4
} ParamFlags; } ParamFlags;
typedef struct { typedef struct {
...@@ -180,8 +179,6 @@ parse_params (GHashTable *params, ...@@ -180,8 +179,6 @@ parse_params (GHashTable *params,
if (value) { if (value) {
if (!parse_window_bits ((char *)value, &out->client_max_window_bits)) if (!parse_window_bits ((char *)value, &out->client_max_window_bits))
return return_invalid_param_value_error(error, "client_max_window_bits"); return return_invalid_param_value_error(error, "client_max_window_bits");
out->flags |= PARAM_CLIENT_MAX_WINDOW_BITS_VALUE;
} else { } else {
out->client_max_window_bits = 15; out->client_max_window_bits = 15;
} }
...@@ -274,12 +271,8 @@ soup_websocket_extension_deflate_get_response_params (SoupWebsocketExtension *ex ...@@ -274,12 +271,8 @@ soup_websocket_extension_deflate_get_response_params (SoupWebsocketExtension *ex
params = g_string_append (params, "; client_no_context_takeover"); params = g_string_append (params, "; client_no_context_takeover");
if (priv->params.flags & PARAM_SERVER_MAX_WINDOW_BITS) if (priv->params.flags & PARAM_SERVER_MAX_WINDOW_BITS)
g_string_append_printf (params, "; server_max_window_bits=%u", priv->params.server_max_window_bits); g_string_append_printf (params, "; server_max_window_bits=%u", priv->params.server_max_window_bits);
if (priv->params.flags & PARAM_CLIENT_MAX_WINDOW_BITS) { if (priv->params.flags & PARAM_CLIENT_MAX_WINDOW_BITS)
if (priv->params.flags & PARAM_CLIENT_MAX_WINDOW_BITS_VALUE) g_string_append_printf (params, "; client_max_window_bits=%u", priv->params.client_max_window_bits);
g_string_append_printf (params, "; client_max_window_bits=%u", priv->params.client_max_window_bits);
else
params = g_string_append (params, "; client_max_window_bits");
}
return g_string_free (params, FALSE); return g_string_free (params, FALSE);
} }
......
...@@ -1486,7 +1486,7 @@ static struct { ...@@ -1486,7 +1486,7 @@ static struct {
{ "permessage-deflate; client_max_window_bits", { "permessage-deflate; client_max_window_bits",
/* prepare supported check accepted verify */ /* prepare supported check accepted verify */
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
"permessage-deflate; client_max_window_bits" "permessage-deflate; client_max_window_bits=15"
}, },
{ "permessage-deflate; client_max_window_bits=10", { "permessage-deflate; client_max_window_bits=10",
/* prepare supported check accepted verify */ /* prepare supported check accepted verify */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment