Skip to content

check nightlies/pr features with etag availability#1387

Merged
IanButterworth merged 5 commits intomainfrom
ib/1347
Jan 18, 2026
Merged

check nightlies/pr features with etag availability#1387
IanButterworth merged 5 commits intomainfrom
ib/1347

Conversation

@IanButterworth
Copy link
Member

@IanButterworth IanButterworth commented Jan 17, 2026

Suggested changes (c36a95e 53f292e) ontop of #1347 plus an update from main.

@johnnychen94 thanks for the original PR #1347 I just wanted to help this along, so will merge this with these tweaks and update.

Closes #1347
Closes #917

Description by @johnnychen94 from #1347


Users in China often don't have a stable connection to AWS S3, so mirror sites like https://mirrors.tuna.tsinghua.edu.cn exist; they are typically simple static-file HTTP servers and don't have advanced S3-like features such as etags.

Previously, we have provided the JULIAUP_SERVER feature to change the download baseurl, but at that time, I didn't realize that the server mirror should support ETag.

This commit introduces a server feature check operation for custom JULIAUP_SERVER:

  • if JULIAUP_SERVER equals the default official ones, it works as usual. No extra overhead.
  • Otherwise, send a HEAD check request and set the NIGHTLY_SERVER_SUPPORTS_ETAG feature flag

If this feature flag is false, then the PR/nightlies download will be disabled. This doesn't affect the mirror sites because they don't support mirroring Julia nightlies deliberately; too few people use it, and it consumes too much unnecessary sync bandwidth.

Known JuliaUp mirror sites in China that can be used to test:

https://mirrors.ustc.edu.cn/juliaup-releases
https://mirrors.tuna.tsinghua.edu.cn/juliaup-releases https://mirrors.bfsu.edu.cn/juliaup-releases

This commit makes it work for the above mirror sites and thus fixes #917.

Disclaimer: This commit is primarily generated by AI (cursor + claude 4.5 opus). I've tested it locally on Windows and Linux, and it works as expected. MacOS is not tested.

Example: PR/nightlies features are disabled with a proper error message:

❯ target/debug/juliaup add nightly
Error: The configured nightly server does not support etag headers, which are required for nightly and PR channels.
Nightly and PR channels cannot be installed from this server.

❯ target/debug/julia +nightly
Question: The Juliaup channel 'nightly' is not installed. Would you like to install it?: Yes (install this time only)
Installing Julia nightly as requested
Error: The configured nightly server does not support etag headers, which are required for nightly and PR channels.
Nightly and PR channels cannot be installed from this server.
Error: The Julia launcher failed to determine the command for the `nightly` channel.

Caused by:
Failed to install channel 'nightly'. juliaup add command failed with exit code: Some(1)

Example: normal release download just works

❯ target/debug/juliaup add 1.10
Checking for new Julia versions
Installing Julia 1.10.10+0.x64.linux.gnu
DEBUG: Starting download from URL: https://mirrors.ustc.edu.cn/julia-releases/bin/linux/x64/1.10/julia-1.10.10-linux-x86_64.tar.gz
Downloading ━━━━━━━━━━━━━━━━━━━━━━━━╸ 165.61 MiB/165.79 MiB eta: 0s
Add Installed Julia channel '1.10'

johnnychen94 and others added 4 commits November 28, 2025 17:31
Users in China often don't have a stable connection to AWS S3, so mirror
sites like https://mirrors.tuna.tsinghua.edu.cn exist; they are
typically simple static-file HTTP servers and don't have advanced
S3-like features such as etags.

Previously, we have provided the JULIAUP_SERVER feature to change the
download baseurl, but at that time, I didn't realize that the server
mirror should support ETag.

This commit introduces a server feature check operation for custom
JULIAUP_SERVER:

* if JULIAUP_SERVER equals the default official ones, it works as usual
* Otherwise, send a HEAD check request and set the
  NIGHTLY_SERVER_SUPPORTS_ETAG feature flag

If this feature flag is false, then the PR/nightlies download will be
disabled. This doesn't affect the mirror sites because they don't
support mirroring Julia nightlies deliberately; too few people use it,
and it consumes too much unnecessary sync bandwidth.

Known JuliaUp mirror sites in China that can be used to test:

https://mirrors.ustc.edu.cn/juliaup-releases
https://mirrors.tuna.tsinghua.edu.cn/juliaup-releases
https://mirrors.bfsu.edu.cn/juliaup-releases

This commit makes it work for the above mirror sites and thus fixes

Disclaimer: This commit is primarily generated by AI (cursor + claude
4.5 opus). I've tested it manually on both Windows and Linux, and it
works as expected.

Example: PR/nightlies features are disabled with a proper error message:

```
❯ target/debug/juliaup add nightly
Error: The configured nightly server does not support etag headers, which are required for nightly and PR channels.
Nightly and PR channels cannot be installed from this server.

❯ target/debug/julia +nightly
Question: The Juliaup channel 'nightly' is not installed. Would you like to install it?: Yes (install this time only)
Installing Julia nightly as requested
Error: The configured nightly server does not support etag headers, which are required for nightly and PR channels.
Nightly and PR channels cannot be installed from this server.
Error: The Julia launcher failed to determine the command for the `nightly` channel.

Caused by:
Failed to install channel 'nightly'. juliaup add command failed with exit code: Some(1)
```

Example: normal release download just works

```
❯ target/debug/juliaup add 1.10
Checking for new Julia versions
Installing Julia 1.10.10+0.x64.linux.gnu
DEBUG: Starting download from URL: https://mirrors.ustc.edu.cn/julia-releases/bin/linux/x64/1.10/julia-1.10.10-linux-x86_64.tar.gz
Downloading ━━━━━━━━━━━━━━━━━━━━━━━━╸ 165.61 MiB/165.79 MiB eta: 0s
Add Installed Julia channel '1.10'
```

closes #917
Fixes critical issues in PR #1347 for better mirror server compatibility:

Critical fixes:
- Add early etag support check in install_from_url BEFORE downloading
  to avoid wasting bandwidth (~165MB) when server doesn't support etags
- Remove redundant etag check after download

Robustness improvements:
- Use proper URL parsing for default server detection instead of string comparison
- Handle URL variations (http/https, trailing slashes) correctly
- Remove unwrap() from Windows HEAD request that could panic
- Add debug logging for all error paths in server capability checks

These changes prevent users from downloading large tarballs only to get
an error, and make the server capability detection more reliable across
different mirror configurations.
@IanButterworth IanButterworth changed the title check nightlies/pr features with etag avalibility (suggestions) check nightlies/pr features with etag availability Jan 18, 2026
@IanButterworth IanButterworth marked this pull request as ready for review January 18, 2026 01:29
- Add .context() to check_server_supports_nightlies() calls in
  install_from_url and install_non_db_version for clearer error messages
- Improves error diagnostics when etag support check fails
- Update functions continue to use unwrap_or(false) for graceful
  degradation during non-critical update checks
@IanButterworth IanButterworth merged commit 55658fc into main Jan 18, 2026
29 checks passed
@IanButterworth IanButterworth deleted the ib/1347 branch January 18, 2026 03:12
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.

custom JULIAUP_SERVER for normal http server

2 participants