From ddf88aca0961d1571669af8d057168928f81e673 Mon Sep 17 00:00:00 2001 From: Pierre Chapuis Date: Fri, 5 Jul 2013 17:59:52 +0200 Subject: [PATCH 1/2] http: do not set global TIMEOUT --- src/http.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/http.lua b/src/http.lua index ac4b2d6..5f70a37 100644 --- a/src/http.lua +++ b/src/http.lua @@ -22,7 +22,7 @@ local _M = socket.http -- Program constants ----------------------------------------------------------------------------- -- connection timeout in seconds -TIMEOUT = 60 +_M.TIMEOUT = 60 -- default port for document retrieval _M.PORT = 80 -- user agent field sent in request From 1f9ccb2b586c3a7e29db3c99a23ac1cee6907cf2 Mon Sep 17 00:00:00 2001 From: Pierre Chapuis Date: Fri, 5 Jul 2013 18:00:29 +0200 Subject: [PATCH 2/2] http: look for PROXY in _M, not as a global --- src/http.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/http.lua b/src/http.lua index 5f70a37..f83dcc5 100644 --- a/src/http.lua +++ b/src/http.lua @@ -186,7 +186,7 @@ end local function adjusturi(reqt) local u = reqt -- if there is a proxy, we need the full url. otherwise, just a part. - if not reqt.proxy and not PROXY then + if not reqt.proxy and not _M.PROXY then u = { path = socket.try(reqt.path, "invalid path 'nil'"), params = reqt.params, @@ -198,7 +198,7 @@ local function adjusturi(reqt) end local function adjustproxy(reqt) - local proxy = reqt.proxy or PROXY + local proxy = reqt.proxy or _M.PROXY if proxy then proxy = url.parse(proxy) return proxy.host, proxy.port or 3128