Blame luasocket-no-global-vars.patch
|
|
8f3cbfa |
diff --git a/src/http.lua b/src/http.lua
|
|
|
8f3cbfa |
index ac4b2d6..f83dcc5 100644
|
|
|
8f3cbfa |
--- a/src/http.lua
|
|
|
8f3cbfa |
+++ b/src/http.lua
|
|
|
8f3cbfa |
@@ -22,7 +22,7 @@ local _M = socket.http
|
|
|
8f3cbfa |
-- Program constants
|
|
|
8f3cbfa |
-----------------------------------------------------------------------------
|
|
|
8f3cbfa |
-- connection timeout in seconds
|
|
|
8f3cbfa |
-TIMEOUT = 60
|
|
|
8f3cbfa |
+_M.TIMEOUT = 60
|
|
|
8f3cbfa |
-- default port for document retrieval
|
|
|
8f3cbfa |
_M.PORT = 80
|
|
|
8f3cbfa |
-- user agent field sent in request
|
|
|
8f3cbfa |
@@ -186,7 +186,7 @@ end
|
|
|
8f3cbfa |
local function adjusturi(reqt)
|
|
|
8f3cbfa |
local u = reqt
|
|
|
8f3cbfa |
-- if there is a proxy, we need the full url. otherwise, just a part.
|
|
|
8f3cbfa |
- if not reqt.proxy and not PROXY then
|
|
|
8f3cbfa |
+ if not reqt.proxy and not _M.PROXY then
|
|
|
8f3cbfa |
u = {
|
|
|
8f3cbfa |
path = socket.try(reqt.path, "invalid path 'nil'"),
|
|
|
8f3cbfa |
params = reqt.params,
|
|
|
8f3cbfa |
@@ -198,7 +198,7 @@ local function adjusturi(reqt)
|
|
|
8f3cbfa |
end
|
|
|
8f3cbfa |
|
|
|
8f3cbfa |
local function adjustproxy(reqt)
|
|
|
8f3cbfa |
- local proxy = reqt.proxy or PROXY
|
|
|
8f3cbfa |
+ local proxy = reqt.proxy or _M.PROXY
|
|
|
8f3cbfa |
if proxy then
|
|
|
8f3cbfa |
proxy = url.parse(proxy)
|
|
|
8f3cbfa |
return proxy.host, proxy.port or 3128
|