aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIgnacio Burgueño <ignaciob@inconcertcc.com>2015-04-17 15:58:10 -0300
committerIgnacio Burgueño <ignaciob@inconcertcc.com>2015-04-17 15:58:10 -0300
commit2c536b4bdd07b6f8983876a01296a1e8c752d2be (patch)
tree6eb1b5f0788764d9bed9f5d3a6fd2cde470974a4 /src
parentf022fe08167e67ae854120d472d273bed47ff3ff (diff)
downloadluarocks-2c536b4bdd07b6f8983876a01296a1e8c752d2be.tar.gz
luarocks-2c536b4bdd07b6f8983876a01296a1e8c752d2be.tar.bz2
luarocks-2c536b4bdd07b6f8983876a01296a1e8c752d2be.zip
Deal with 'no_proxy' env var
If the 'no_proxy' environment variable, delegate to the downloader to deal with it.
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/cfg.lua6
-rw-r--r--src/luarocks/fs/lua.lua6
2 files changed, 12 insertions, 0 deletions
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua
index b7e76535..f6993ba5 100644
--- a/src/luarocks/cfg.lua
+++ b/src/luarocks/cfg.lua
@@ -597,6 +597,12 @@ cfg.user_agent = "LuaRocks/"..cfg.program_version.." "..cfg.arch
597 597
598cfg.http_proxy = os.getenv("http_proxy") 598cfg.http_proxy = os.getenv("http_proxy")
599cfg.https_proxy = os.getenv("https_proxy") 599cfg.https_proxy = os.getenv("https_proxy")
600cfg.no_proxy = os.getenv("no_proxy")
601
602-- make sure that no_proxy is not 'alone'
603if cfg.no_proxy and not (cfg.https_proxy or cfg.http_proxy) then
604 cfg.no_proxy = nil
605end
600 606
601--- Check if platform was detected 607--- Check if platform was detected
602-- @param query string: The platform name to check. 608-- @param query string: The platform name to check.
diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua
index 1a2ec888..c0f6c1c6 100644
--- a/src/luarocks/fs/lua.lua
+++ b/src/luarocks/fs/lua.lua
@@ -653,6 +653,11 @@ function fs_lua.download(url, filename, cache)
653 assert(type(filename) == "string" or not filename) 653 assert(type(filename) == "string" or not filename)
654 654
655 filename = fs.absolute_name(filename or dir.base_name(url)) 655 filename = fs.absolute_name(filename or dir.base_name(url))
656
657 -- delegate to the configured downloader so we don't have to deal with whitelists
658 if cfg.no_proxy then
659 return fs.use_downloader(url, filename, cache)
660 end
656 661
657 local content, err, https_err 662 local content, err, https_err
658 if util.starts_with(url, "http:") then 663 if util.starts_with(url, "http:") then
@@ -660,6 +665,7 @@ function fs_lua.download(url, filename, cache)
660 elseif util.starts_with(url, "ftp:") then 665 elseif util.starts_with(url, "ftp:") then
661 content, err = ftp.get(url) 666 content, err = ftp.get(url)
662 elseif util.starts_with(url, "https:") then 667 elseif util.starts_with(url, "https:") then
668 -- skip LuaSec when proxy is enabled since it is not supported
663 if luasec_ok and not cfg.https_proxy then 669 if luasec_ok and not cfg.https_proxy then
664 content, err = http_request(url, https, cache and filename) 670 content, err = http_request(url, https, cache and filename)
665 else 671 else