Skip to content

fix: filter out mirrors with failed curl connections in rank_mirrors()#185

Merged
exequtic merged 1 commit into
exequtic:mainfrom
MykolaVaskevych:fix/mirrorlist-dead-mirrors
Feb 21, 2026
Merged

fix: filter out mirrors with failed curl connections in rank_mirrors()#185
exequtic merged 1 commit into
exequtic:mainfrom
MykolaVaskevych:fix/mirrorlist-dead-mirrors

Conversation

@MykolaVaskevych
Copy link
Copy Markdown
Contributor

@MykolaVaskevych MykolaVaskevych commented Feb 21, 2026

Summary

  • Check for any non-zero curl exit code, not just timeout (28)
  • Only accept HTTP 200-299 instead of rejecting >= 400 — catches status 000 from broken mirrors that accept TCP but return no valid HTTP response

Fixes #184

Test plan

  • Set mirrorlist URL to UK (?country=GBmirror.marcusn.net is currently broken)
  • Refresh mirrorlist via widget
  • Verify broken mirrors are excluded from /etc/pacman.d/mirrorlist

Tested against real mirrors:

Unreachable - https://mirror.marcusn.net/...  (exit=0, response='0.046616 000')
Unreachable - http://mirror.marcusn.net/...   (exit=0, response='0.046763 000')
OK 0.089373s - https://london.mirror.pkgbuild.com/...  (exit=0, response='0.089373 200')
OK 0.083120s - https://archlinux.uk.mirror.allworldit.com/...  (exit=0, response='0.083120 200')
OK 0.095233s - https://mirrors.ukfast.co.uk/...  (exit=0, response='0.095233 200')

rank_mirrors() only caught curl exit code 28 (timeout). Other failures
like connection refused (7) or DNS errors (6) fell through with HTTP
status 000, which passed the >= 400 check. These dead mirrors got fast
time_total values and ranked first in the mirrorlist.

- Check for any non-zero curl exit code, not just timeout
- Only accept HTTP 200-299 responses instead of rejecting >= 400,
  which also filters out status 000 and unexpected redirects

Fixes exequtic#184
@MykolaVaskevych MykolaVaskevych force-pushed the fix/mirrorlist-dead-mirrors branch from 3a51f5a to a6b29fa Compare February 21, 2026 15:15
@exequtic exequtic merged commit 70bc560 into exequtic:main Feb 21, 2026
@MykolaVaskevych MykolaVaskevych deleted the fix/mirrorlist-dead-mirrors branch February 24, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Dead mirrors pass rank_mirrors() health check and end up first in mirrorlist

2 participants