1
1
mirror of https://git.shadowkat.net/izaya/OC-PsychOS2.git synced 2024-11-13 00:27:00 -05:00

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

This commit is contained in:
XeonSquared 2020-06-06 14:42:30 +10:00
parent edbe787ea6
commit 8b4d0e4eb8

View File

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