Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2013)

Unified Diff: net/websockets/websocket_deflate_parameters.h

Issue 1340523002: Fix WebSocketServer extension parser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ws-constructor-fix
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/server/web_socket_encoder_unittest.cc ('k') | net/websockets/websocket_extension.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_deflate_parameters.h
diff --git a/net/websockets/websocket_deflate_parameters.h b/net/websockets/websocket_deflate_parameters.h
index d0c73bfff5a14157356c2a9ae8c42ca9f108abad..a377e523a91d672a31c5c2aac6072f5ff07fe3cb 100644
--- a/net/websockets/websocket_deflate_parameters.h
+++ b/net/websockets/websocket_deflate_parameters.h
@@ -95,6 +95,13 @@ class NET_EXPORT_PRIVATE WebSocketDeflateParameters {
client_max_window_bits_ = WindowBits(bits, true, true);
}
+ int PermissiveServerMaxWindowBits() const {
+ return server_max_window_bits_.PermissiveBits();
+ }
+ int PermissiveClientMaxWindowBits() const {
+ return client_max_window_bits_.PermissiveBits();
+ }
+
// Return true if |bits| is valid as a max_window_bits value.
static bool IsValidWindowBits(int bits) { return 8 <= bits && bits <= 15; }
@@ -104,6 +111,10 @@ class NET_EXPORT_PRIVATE WebSocketDeflateParameters {
WindowBits(int16_t bits, bool is_specified, bool has_value)
: bits(bits), is_specified(is_specified), has_value(has_value) {}
+ int PermissiveBits() const {
+ return (is_specified && has_value) ? bits : 15;
+ }
+
int16_t bits;
// True when "window bits" parameter appears in the parameters.
bool is_specified;
« no previous file with comments | « net/server/web_socket_encoder_unittest.cc ('k') | net/websockets/websocket_extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698