void-linux / xbps

The X Binary Package System (XBPS)
https://voidlinux.org/xbps/
Other
821 stars 124 forks source link

xbps-install doesn't follow 308 Permanent Redirects #579

Open PhotonQuantum opened 11 months ago

PhotonQuantum commented 11 months ago

Problem

~> sudo xbps-install -Sv                                                                                                                                                1 12/23/23 21:42:57 PM
[*] Updating repository `https://mirror.sjtu.edu.cn/voidlinux/current/x86_64-repodata' ...
ERROR: [reposync] failed to fetch file `https://mirror.sjtu.edu.cn/voidlinux/current/x86_64-repodata': Permanent Redirect
[*] Updating repository `https://mirror.sjtu.edu.cn/voidlinux/current/multilib/nonfree/x86_64-repodata' ...
ERROR: [reposync] failed to fetch file `https://mirror.sjtu.edu.cn/voidlinux/current/multilib/nonfree/x86_64-repodata': Permanent Redirect
[*] Updating repository `https://mirror.sjtu.edu.cn/voidlinux/current/multilib/x86_64-repodata' ...
ERROR: [reposync] failed to fetch file `https://mirror.sjtu.edu.cn/voidlinux/current/multilib/x86_64-repodata': Permanent Redirect
[*] Updating repository `https://mirror.sjtu.edu.cn/voidlinux/current/nonfree/x86_64-repodata' ...
ERROR: [reposync] failed to fetch file `https://mirror.sjtu.edu.cn/voidlinux/current/nonfree/x86_64-repodata': Permanent Redirect
~>

(mirror.sjtu.edu.cn is now using HTTP 302 to work around this issue)

Expected behavior

xbps should follow HTTP 308 redirects.

Suspected cause

https://github.com/void-linux/xbps/blob/b75e151c629b336e8a8b78e2314436b93528d16c/lib/fetch/http.c#L111-L115

I believe we can solve this issue by adding HTTP_PERM_REDIRECT to HTTP_REDIRECT.

Possible PR to blame: https://github.com/void-linux/xbps/commit/90eb1d94337b380c50859defe119feab19aad269