# HG changeset patch # User Matthew Wild <mwild1@gmail.com> # Date 1337085309 -3600 # Node ID 6d96e2e717c1293d6fa66fdedf399aba54380113 # Parent 45bb378a4a982effd0ad0fd9bf2c9f779e7a3a23 mod_bosh: Set Content-Type to text/html for GET response (thanks Medics) diff -r 45bb378a4a98 -r 6d96e2e717c1 plugins/mod_bosh.lua --- a/plugins/mod_bosh.lua Tue May 15 14:00:57 2012 +0200 +++ b/plugins/mod_bosh.lua Tue May 15 13:35:09 2012 +0100 @@ -98,13 +98,6 @@ end end -local function handle_GET(request) - return [[<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="http://prosody.im/doc/setting_up_bosh">Prosody: Setting up BOSH</a>.</p> -</body></html>]]; -end - function handle_OPTIONS(request) local headers = {}; for k,v in pairs(default_headers) do headers[k] = v; end @@ -428,13 +421,24 @@ end module:add_timer(1, on_timer); + +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="http://prosody.im/doc/setting_up_bosh">Prosody: Setting up BOSH</a>.</p> + </body></html>]]; +}; + function module.add_host(module) module:depends("http"); module:provides("http", { default_path = "/http-bind"; route = { - ["GET"] = handle_GET; - ["GET /"] = handle_GET; + ["GET"] = GET_response; + ["GET /"] = GET_response; ["OPTIONS"] = handle_OPTIONS; ["OPTIONS /"] = handle_OPTIONS; ["POST"] = handle_POST;