Ver código fonte

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

master
XeonSquared 4 anos atrás
pai
commit
8b4d0e4eb8
1 arquivos alterados com 3 adições e 1 exclusões
  1. +3
    -1
      lib/download.lua

+ 3
- 1
lib/download.lua Ver arquivo

@@ -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.")


Carregando…
Cancelar
Salvar