forked from izaya/OC-PsychOS2
fixed file downloading with the HTTP(S) proxies in the download library
This commit is contained in:
parent
edbe787ea6
commit
8b4d0e4eb8
@ -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.")
|
||||
|
Loading…
Reference in New Issue
Block a user