aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_xmlrpc.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-03-04 22:59:58 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-03-04 22:59:58 +0500
commit25a18ce239d4a7e342d6c7087c575555ef3a27bd (patch)
tree9933c6229f386570e3c69b545f81cdd9edf73586 /plugins/mod_xmlrpc.lua
parent1617a776769f5024db19d0725a301dcf63395bd0 (diff)
downloadprosody-25a18ce239d4a7e342d6c7087c575555ef3a27bd.tar.gz
prosody-25a18ce239d4a7e342d6c7087c575555ef3a27bd.zip
XML-RPC: Set appropriate Content-Type header in HTTP response
Diffstat (limited to 'plugins/mod_xmlrpc.lua')
-rw-r--r--plugins/mod_xmlrpc.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/mod_xmlrpc.lua b/plugins/mod_xmlrpc.lua
index 5a10c377..6fdfe8be 100644
--- a/plugins/mod_xmlrpc.lua
+++ b/plugins/mod_xmlrpc.lua
@@ -102,6 +102,7 @@ end
module:add_iq_handler({"c2s", "s2sin"}, "jabber:iq:rpc", handle_xmpp_request);
module:add_feature("jabber:iq:rpc");
+local default_headers = { ["Content-Type"] = "text/xml" };
local function handle_http_request(method, body, request)
local stanza = body and parse_xml(body);
if (not stanza) or request.method ~= "POST" then
@@ -109,8 +110,8 @@ local function handle_http_request(method, body, request)
end
local success, method, args = pcall(translate_request, stanza);
if success then
- return tostring(handle_xmlrpc_request(method, args));
+ return { headers = default_headers; body = tostring(handle_xmlrpc_request(method, args)) };
end
- return "<html><body>You really don't look like an XML-RPC client to me... what do you want?</body></html>";
+ return "<html><body>Error parsing XML-RPC request: "..tostring(method).."</body></html>";
end
httpserver.new{ port = 9000, base = "xmlrpc", handler = handle_http_request }