浏览代码

fixed file downloading with the HTTP(S) proxies in the download library

master
XeonSquared 4 年前
父节点
当前提交
8b4d0e4eb8
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. +3
    -1
      lib/download.lua

+ 3
- 1
lib/download.lua 查看文件

@@ -67,6 +67,7 @@ end

function dl.protos.http(host, optPort, path, dest, url) -- string string string number -- boolean -- Downloads *url* to *dest* via the internet card, if available.
if not component.list("internet")() then
print("Internet card unavailable, falling back to proxy.")
local proto,host,sPort,path = parseURL(url)
local proxy = os.getenv(proto:upper().."_PROXY")
if not proxy and fs.exists("/boot/cfg/"..proto.."_proxy") then
@@ -75,8 +76,9 @@ function dl.protos.http(host, optPort, path, dest, url) -- string string string
f:close()
end
if not proxy then error("No internet card or HTTP(S) proxy available") end
print("Proxy found: "..proxy)
if optPort then host=string.format("%s:%i",host,optPort) end
return dl.wget(string.format("%s/%s%s",proxy,host,path))
return dl.wget(string.format("%s/%s%s",proxy,host,path),dest)
end
if not dest then
error("Must provide local path to save remote files.")


正在加载...
取消
保存