From 42907ced08178a2a99662148870ff5217959bf78 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Fri, 21 Dec 2012 13:37:39 +0500 Subject: net.http.parser: Skip url.parse when we don't have a full URL (also fixes traceback on paths starting with '//'). --- net/http/parser.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'net') diff --git a/net/http/parser.lua b/net/http/parser.lua index c760a0a4..b53dfa4e 100644 --- a/net/http/parser.lua +++ b/net/http/parser.lua @@ -91,7 +91,14 @@ function httpstream.new(success_cb, error_cb, parser_type, options_cb) responseheaders = headers; }; else - local parsed_url = url_parse(path); + local parsed_url; + if path:byte() == 47 then -- starts with / + local _path, _query = path:match("([^?]*).?(.*)"); + if _query == "" then _query = nil; end + parsed_url = { path = _path, query = _query }; + else + parsed_url = url_parse(path); + end path = preprocess_path(parsed_url.path); headers.host = parsed_url.host or headers.host; -- cgit v1.2.3 From 81b3ba144214371cbfa3ac39d0fae1880cac1302 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sat, 22 Dec 2012 12:06:36 +0000 Subject: net.dns: Clean up query list when a server is marked down --- net/dns.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'net') diff --git a/net/dns.lua b/net/dns.lua index 5b32a56c..1950ba73 100644 --- a/net/dns.lua +++ b/net/dns.lua @@ -549,6 +549,7 @@ function resolver:decode(packet, force) -- - - - - - - - - - - - - - decode if not force then if not self.active[response.header.id] or not self.active[response.header.id][response.question.raw] then + self.active[response.header.id] = nil; return nil; end end @@ -796,6 +797,9 @@ function resolver:servfail(sock) end end end + if next(queries) == nil then + self.active[id] = nil; + end end if num == self.best_server then @@ -852,6 +856,7 @@ function resolver:receive(rset) -- - - - - - - - - - - - - - - - - receive set(self.wanted, q.class, q.type, q.name, nil); end end + end end end -- cgit v1.2.3 From a7f6283a2e582f5b6b0a920b6e0418ebb9c379d9 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 22 Dec 2012 14:20:12 +0100 Subject: net.dns: Close voided sockets, so they don't stay in net.server --- net/dns.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'net') diff --git a/net/dns.lua b/net/dns.lua index 1950ba73..a134eceb 100644 --- a/net/dns.lua +++ b/net/dns.lua @@ -643,6 +643,7 @@ function resolver:voidsocket(sock) self.socket[self.socketset[sock]] = nil; self.socketset[sock] = nil; end + sock:close(); end function resolver:socket_wrapper_set(func) -- - - - - - - socket_wrapper_set -- cgit v1.2.3