diff options
author | Matthew Wild <mwild1@gmail.com> | 2020-04-20 11:30:59 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2020-04-20 11:30:59 +0100 |
commit | 325833753210cd7bd87f997096237e53624f9726 (patch) | |
tree | 504095993b367f283ef80bc679bf8d653a224ecc | |
parent | ee80be9fa402a8c8656a56a2028101890c97a1d2 (diff) | |
download | prosody-325833753210cd7bd87f997096237e53624f9726.tar.gz prosody-325833753210cd7bd87f997096237e53624f9726.zip |
mod_bosh, mod_websocket: Add config options to override GET responses
-rw-r--r-- | plugins/mod_bosh.lua | 10 | ||||
-rw-r--r-- | plugins/mod_websocket.lua | 10 |
2 files changed, 13 insertions, 7 deletions
diff --git a/plugins/mod_bosh.lua b/plugins/mod_bosh.lua index b45a9dc2..d4c1ac6a 100644 --- a/plugins/mod_bosh.lua +++ b/plugins/mod_bosh.lua @@ -511,14 +511,16 @@ function stream_callbacks.error(context, error) end end +local GET_response_body = [[<html><body> + <p>It works! Now point your BOSH client to this URL to connect to Prosody.</p> + <p>For more information see <a href="https://prosody.im/doc/setting_up_bosh">Prosody: Setting up BOSH</a>.</p> + </body></html>]]; + local GET_response = { headers = { content_type = "text/html"; }; - body = [[<html><body> - <p>It works! Now point your BOSH client to this URL to connect to Prosody.</p> - <p>For more information see <a href="https://prosody.im/doc/setting_up_bosh">Prosody: Setting up BOSH</a>.</p> - </body></html>]]; + body = module:get_option_string("bosh_get_response_body", GET_response_body); }; module:depends("http"); 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"); |