From 82a3b3c3eb6213890f9b2b97b32378655f022ff9 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 23 Apr 2009 21:03:24 +0100 Subject: xmlhandlers: Fix tag pattern again for the default namespace --- core/xmlhandlers.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/xmlhandlers.lua b/core/xmlhandlers.lua index 67a0829d..7e09921c 100644 --- a/core/xmlhandlers.lua +++ b/core/xmlhandlers.lua @@ -57,7 +57,11 @@ function init_xmlhandlers(session, stream_callbacks) stanza:text(t_concat(chardata)); chardata = {}; end - local curr_ns,name = tagname:match("^(.+)|([^%|]+)$"); + local curr_ns,name = tagname:match("^(.-)|?([^%|]-)$"); + if not name then + curr_ns, name = "", curr_ns; + end + if curr_ns ~= stream_default_ns then attr.xmlns = curr_ns; end @@ -109,7 +113,10 @@ function init_xmlhandlers(session, stream_callbacks) end end function xml_handlers:EndElement(tagname) - curr_ns,name = tagname:match("^(.+)|([^%|]+)$"); + curr_ns,name = tagname:match("^(.-)|?([^%|]-)$"); + if not name then + curr_ns, name = "", curr_ns; + end if (not stanza) or (#stanza.last_add > 0 and name ~= stanza.last_add[#stanza.last_add].name) then if tagname == stream_tag then if cb_streamclosed then -- cgit v1.2.3 From 37db6110c31027f22f3a5eef3730762690ebb446 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 23 Apr 2009 21:04:07 +0100 Subject: net.httpserver: Don't log the response body (can be binary data...) --- net/httpserver.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/httpserver.lua b/net/httpserver.lua index b16e7f3a..db0cbc3e 100644 --- a/net/httpserver.lua +++ b/net/httpserver.lua @@ -30,7 +30,7 @@ local function send_response(request, response) -- Write status line local resp; if response.body then - log("debug", "Sending response to %s: %s", request.id, response.body); + log("debug", "Sending response to %s", request.id); resp = { "HTTP/1.0 ", response.status or "200 OK", "\r\n"}; local h = response.headers; if h then -- cgit v1.2.3 From d6b19a1b1b9b46e7c8fe7abe6c1aa234f3fd8096 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 23 Apr 2009 21:04:56 +0100 Subject: net.httpserver: Fix traceback when sending response to a destroyed request --- net/httpserver.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/httpserver.lua b/net/httpserver.lua index db0cbc3e..906ffaf7 100644 --- a/net/httpserver.lua +++ b/net/httpserver.lua @@ -99,7 +99,7 @@ local function call_callback(request, err) if response == true and not request.destroyed then -- Keep connection open, we will reply later log("warn", "Request %s left open, on_destroy is %s", request.id, tostring(request.on_destroy)); - else + elseif response ~= true then -- Assume response send_response(request, response); destroy_request(request); -- cgit v1.2.3