coollib.com/opds uses HTTPS and redirects
It's a known issue that redirects aren't supported in combination with HTTPS in our current luasec/luasocket backend.
https://github.com/brunoos/luasec/pull/38
https://github.com/diegonehab/luasocket/pull/133
For your particular case, it can be worked around like this:
Code:
diff --git a/frontend/ui/widget/opdsbrowser.lua b/frontend/ui/widget/opdsbrowser.lua
index c854f15d..6da606d4 100644
--- a/frontend/ui/widget/opdsbrowser.lua
+++ b/frontend/ui/widget/opdsbrowser.lua
@@ -497,7 +497,7 @@ function OPDSBrowser:downloadFile(item, format, remote_url)
local auth = string.format("%s:%s", item.username, item.password)
local hostname = parsed.host
- dummy, c = https.request {
+ dummy, c, h = https.request {
url = remote_url,
headers = { Authorization = "Basic " .. mime.b64(auth), ["Host"] = hostname },
sink = ltn12.sink.file(io.open(local_path, "w")),
@@ -515,6 +515,13 @@ function OPDSBrowser:downloadFile(item, format, remote_url)
self.file_downloaded_callback(local_path)
end
else
+if c and c > 299 and c < 400 and h and h["location"] then -- handle 301, 302...
+ local redirected_url = h["location"]
+ dummy, c = https.request {
+ url = redirected_url,
+ sink = ltn12.sink.file(io.open(local_path, "w")),
+ }
+end
UIManager:show(InfoMessage:new {
text = _("Could not save file to:\n") .. local_path,
timeout = 3,
Perhaps someone would like to flesh that out a bit more?