From b118c53ae521da55b6abd625df5cae08e5673642 Mon Sep 17 00:00:00 2001
From: "Stephen R. van den Berg" <srb@cuci.nl>
Date: Tue, 27 Sep 2016 23:45:25 +0200
Subject: [PATCH] WebSocket: Fix missing options checks.

---
 lib/modules/Protocols.pmod/WebSocket.pmod | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/modules/Protocols.pmod/WebSocket.pmod b/lib/modules/Protocols.pmod/WebSocket.pmod
index 4fc5df7c9c..f05804bcd4 100644
--- a/lib/modules/Protocols.pmod/WebSocket.pmod
+++ b/lib/modules/Protocols.pmod/WebSocket.pmod
@@ -759,7 +759,9 @@ class Request(function(array(string), Request:void) cb) {
     //! handshake. The protocol should be either @expr{0@} or a protocol
     //! advertised by the client when initiating the WebSocket connection.
     //! The returned connection object is in state @[Connection.OPEN].
-    Connection websocket_accept(string protocol) {
+    Connection websocket_accept(string protocol, void|mapping _options) {
+        if (_options)
+            options += _options;
 	string s = request_headers["sec-websocket-key"] + websocket_id;
 	mapping heads = ([
 	    "Upgrade" : "websocket",
@@ -811,7 +813,7 @@ class Request(function(array(string), Request:void) cb) {
             switch (name) {
 #if constant(Gz.deflate)
                 case "permessage-deflate":
-                    if (rext[name])
+                    if (rext[name] || !options->compressionLevel)
                         continue;
                     if (parm->client_no_context_takeover
                      || options->decompressionNoContextTakeover) {
-- 
GitLab