Skip to content

Conversation

@johnnychen94
Copy link
Member

@johnnychen94 johnnychen94 commented Nov 28, 2025

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'

closes #917

@johnnychen94 johnnychen94 marked this pull request as draft November 28, 2025 08:54
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 JuliaLang#917
@johnnychen94 johnnychen94 marked this pull request as ready for review November 28, 2025 09:44
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

1 participant