From 5e9baee9fa265ace952bcb93366947c1a7037b8c Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Thu, 25 Jun 2020 10:29:22 +1000 Subject: [PATCH] stole some code from AmandaC to handle an undocumented condition with 404 errors returned by the internet card --- lib/download.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/download.lua b/lib/download.lua index c11730c..c1d67ac 100644 --- a/lib/download.lua +++ b/lib/download.lua @@ -85,8 +85,15 @@ function dl.protos.http(host, optPort, path, dest, url) -- string string string local R,r=component.invoke(component.list("internet")(),"request",url) if not R then error(r) end repeat + ok, err = R.finishConnect() + if type(ok) ~= "boolean" then + if err == url then + return 404, "This is a bug in OC, I think?" + end + return -1, err or "Connection Error" + end coroutine.yield() - until R.finishConnect() + until ok local code, messsage, headers repeat coroutine.yield()