From f022fe08167e67ae854120d472d273bed47ff3ff Mon Sep 17 00:00:00 2001 From: Ignacio BurgueƱo Date: Fri, 17 Apr 2015 12:22:54 -0300 Subject: Drop use of config.proxy Alwways fallback to defined downloader if https_proxy env var is set. --- src/luarocks/cfg.lua | 3 +++ src/luarocks/fs/lua.lua | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index ba8c7f22..b7e76535 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua @@ -595,6 +595,9 @@ end cfg.user_agent = "LuaRocks/"..cfg.program_version.." "..cfg.arch +cfg.http_proxy = os.getenv("http_proxy") +cfg.https_proxy = os.getenv("https_proxy") + --- Check if platform was detected -- @param query string: The platform name to check. -- @return boolean: true if LuaRocks is currently running on queried platform. diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua index 48db4a0d..1a2ec888 100644 --- a/src/luarocks/fs/lua.lua +++ b/src/luarocks/fs/lua.lua @@ -545,7 +545,7 @@ local redirect_protocols = { local function request(url, method, http, loop_control) local result = {} - local proxy = cfg.proxy + local proxy = cfg.http_proxy if type(proxy) ~= "string" then proxy = nil end -- LuaSocket's http.request crashes when given URLs missing the scheme part. if proxy and not proxy:find("://") then @@ -660,7 +660,7 @@ function fs_lua.download(url, filename, cache) elseif util.starts_with(url, "ftp:") then content, err = ftp.get(url) elseif util.starts_with(url, "https:") then - if luasec_ok then + if luasec_ok and not cfg.https_proxy then content, err = http_request(url, https, cache and filename) else https_err = true -- cgit v1.2.3-55-g6feb