Changeset

4880:6d96e2e717c1

mod_bosh: Set Content-Type to text/html for GET response (thanks Medics)
author Matthew Wild <mwild1@gmail.com>
date Tue, 15 May 2012 13:35:09 +0100
parents 4879:45bb378a4a98
children 4881:eafed1728be3
files plugins/mod_bosh.lua
diffstat 1 files changed, 13 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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;