aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorFlorian Zeitz <florob@babelmonkeys.de>2014-09-26 22:12:21 +0200
committerFlorian Zeitz <florob@babelmonkeys.de>2014-09-26 22:12:21 +0200
commit89a01cc8d9df143ec83a6bafbc4864fb7f3353df (patch)
treef831ddad5898ff1f96da6bf5d77647f5c1be1540 /net
parent65b12619a33a83952023bd802bc89a3bec929455 (diff)
downloadprosody-89a01cc8d9df143ec83a6bafbc4864fb7f3353df.tar.gz
prosody-89a01cc8d9df143ec83a6bafbc4864fb7f3353df.zip
net.websocket: Make data masking configurable
Diffstat (limited to 'net')
-rw-r--r--net/websocket.lua2
-rw-r--r--net/websocket/frames.lua4
2 files changed, 3 insertions, 3 deletions
diff --git a/net/websocket.lua b/net/websocket.lua
index f8daa278..a4274eec 100644
--- a/net/websocket.lua
+++ b/net/websocket.lua
@@ -134,7 +134,7 @@ function websocket_methods:close(code, reason)
log("debug", "closing WebSocket with code %i: %s" , code , tostring(reason));
self.readyState = 2;
local handler = self.handler;
- handler:write(frames.build_close(code, reason));
+ handler:write(frames.build_close(code, reason, true));
-- Do not close socket straight away, wait for acknowledgement from server.
self.close_timer = timer.add_task(close_timeout, close_timeout_cb, self);
elseif self.readyState == 2 then
diff --git a/net/websocket/frames.lua b/net/websocket/frames.lua
index 8bbddd1c..fa0e130d 100644
--- a/net/websocket/frames.lua
+++ b/net/websocket/frames.lua
@@ -171,7 +171,7 @@ local function parse_close(data)
return code, message
end
-local function build_close(code, message)
+local function build_close(code, message, mask)
local data = pack_uint16be(code);
if message then
assert(#message<=123, "Close reason must be <=123 bytes");
@@ -180,7 +180,7 @@ local function build_close(code, message)
return build_frame({
opcode = 0x8;
FIN = true;
- MASK = true;
+ MASK = mask;
data = data;
});
end