# HG changeset patch # User Waqas Hussain # Date 1236189598 -18000 # Node ID ff4a08d73772a7d2b977ecab3259ed1e48677211 # Parent 2189baddedb8ac05c615fe8147f96758ab00a265 XML-RPC: Set appropriate Content-Type header in HTTP response diff -r 2189baddedb8 -r ff4a08d73772 plugins/mod_xmlrpc.lua --- a/plugins/mod_xmlrpc.lua Wed Mar 04 22:45:06 2009 +0500 +++ b/plugins/mod_xmlrpc.lua Wed Mar 04 22:59:58 2009 +0500 @@ -102,6 +102,7 @@ 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 @@ 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 "You really don't look like an XML-RPC client to me... what do you want?"; + return "Error parsing XML-RPC request: "..tostring(method)..""; end httpserver.new{ port = 9000, base = "xmlrpc", handler = handle_http_request }