aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_websocket.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2020-04-20 11:30:59 +0100
committerMatthew Wild <mwild1@gmail.com>2020-04-20 11:30:59 +0100
commitff9bdefc7e961f217580194146ee6bda8c6b9827 (patch)
tree504095993b367f283ef80bc679bf8d653a224ecc /plugins/mod_websocket.lua
parenta63e5be1b71a74d78c5d95288c759d70d971f729 (diff)
downloadprosody-ff9bdefc7e961f217580194146ee6bda8c6b9827.tar.gz
prosody-ff9bdefc7e961f217580194146ee6bda8c6b9827.zip
mod_bosh, mod_websocket: Add config options to override GET responses
Diffstat (limited to 'plugins/mod_websocket.lua')
-rw-r--r--plugins/mod_websocket.lua10
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/mod_websocket.lua b/plugins/mod_websocket.lua
index 4d3e79bb..1a0c0046 100644
--- a/plugins/mod_websocket.lua
+++ b/plugins/mod_websocket.lua
@@ -130,6 +130,12 @@ local function filter_open_close(data)
return data;
end
+
+local default_get_response_body = [[<!DOCTYPE html><html><head><title>Websocket</title></head><body>
+<p>It works! Now point your WebSocket client to this URL to connect to Prosody.</p>
+</body></html>]]
+local websocket_get_response_body = module:get_option_string("websocket_get_response_body", default_get_response_body)
+
function handle_request(event)
local request, response = event.request, event.response;
local conn = response.conn;
@@ -138,9 +144,7 @@ function handle_request(event)
if not request.headers.sec_websocket_key or request.method ~= "GET" then
response.headers.content_type = "text/html";
- return [[<!DOCTYPE html><html><head><title>Websocket</title></head><body>
- <p>It works! Now point your WebSocket client to this URL to connect to Prosody.</p>
- </body></html>]];
+ return websocket_get_response_body;
end
local wants_xmpp = contains_token(request.headers.sec_websocket_protocol or "", "xmpp");