TachibanaGeneralLaboratories / download-navi

Free and Open Source software download manager
GNU General Public License v3.0
812 stars 86 forks source link

edge.forgecdn.net returns 404 error after download beginning #209

Closed Kita2345 closed 2 years ago

Kita2345 commented 2 years ago

I'm getting a 404 error when trying to download even a single file but when i copy-paste the url to my browser it downloads just fine.

An example url: https://edge.forgecdn.net/files/3533/204/TinySkeletons-v1.0.1-1.16.5-Forge.jar

proninyaroslav commented 2 years ago

It redirects to https://media.forgecdn.net/files/3533/204/TinySkeletons-v1.0.1-1.16.5-Forge.jar

HTTP/2 302 
date: Fri, 07 Jan 2022 15:51:47 GMT
location: https://media.forgecdn.net/files/3533/204/TinySkeletons-v1.0.1-1.16.5-Forge.jar

and media.forgecdn.net works fine if I download from it directly. It's strange.

proninyaroslav commented 2 years ago

It looks like this URL doesn't support range queries, i.e. multipiece downloading and resuming. So it returns error code like this, although its header says Accept-Ranges: bytes. Very strange site.

proninyaroslav commented 2 years ago

So, edge.forgecdn.net temporary redirects to media.forgecdn.net and range requests are working only in media.forgecdn.net. To fix badly designed sites like this, I decided that I would save temporary URL redirects like the browser does (https://github.com/TachibanaGeneralLaboratories/download-navi/commit/4e12707e5ebdce8dd0469bb2e075a13bbb0e5dfe). This means that the temporary URL becomes permanent after the download (even if we resume the download after a few days). I think it shouldn't break downloads from other sites, but it will fix downloads from sites like this one.