@@ -14,9 +14,28 @@ static NIGHTLY_SERVER_SUPPORTS_ETAG: OnceLock<bool> = OnceLock::new();
1414/// to track versions of these builds.
1515///
1616/// The result is cached after the first check.
17+ /// If JULIAUP_SERVER equals the default official ones, it works as usual (assumes ETAG support).
18+ /// Otherwise, sends a HEAD check request to verify ETAG support.
1719#[ cfg( not( windows) ) ]
1820pub fn check_server_supports_nightlies ( ) -> Result < bool > {
1921 Ok ( * NIGHTLY_SERVER_SUPPORTS_ETAG . get_or_init ( || {
22+ // Check if JULIAUP_SERVER equals the default official one
23+ let is_default_server = {
24+ let julia_server = std:: env:: var ( "JULIAUP_SERVER" )
25+ . unwrap_or_else ( |_| "https://julialang-s3.julialang.org" . to_string ( ) ) ;
26+
27+ // Normalize URL (remove trailing slashes for comparison)
28+ let julia_server_normalized = julia_server. trim_end_matches ( '/' ) ;
29+
30+ julia_server_normalized == "https://julialang-s3.julialang.org"
31+ } ;
32+
33+ // If using default official servers, assume ETAG support
34+ if is_default_server {
35+ return true ;
36+ }
37+
38+ // For custom servers, check via HEAD request
2039 let base_url = match get_julianightlies_base_url ( ) {
2140 Ok ( url) => url,
2241 Err ( _) => return false ,
@@ -40,6 +59,8 @@ pub fn check_server_supports_nightlies() -> Result<bool> {
4059/// to track versions of these builds.
4160///
4261/// The result is cached after the first check.
62+ /// If JULIAUP_SERVER equals the default official ones, it works as usual (assumes ETAG support).
63+ /// Otherwise, sends a HEAD check request to verify ETAG support.
4364#[ cfg( windows) ]
4465pub fn check_server_supports_nightlies ( ) -> Result < bool > {
4566 use windows:: core:: HSTRING ;
@@ -49,6 +70,23 @@ pub fn check_server_supports_nightlies() -> Result<bool> {
4970 use windows:: Web :: Http :: HttpRequestMessage ;
5071
5172 Ok ( * NIGHTLY_SERVER_SUPPORTS_ETAG . get_or_init ( || {
73+ // Check if JULIAUP_SERVER equals the default official one
74+ let is_default_server = {
75+ let julia_server = std:: env:: var ( "JULIAUP_SERVER" )
76+ . unwrap_or_else ( |_| "https://julialang-s3.julialang.org" . to_string ( ) ) ;
77+
78+ // Normalize URL (remove trailing slashes for comparison)
79+ let julia_server_normalized = julia_server. trim_end_matches ( '/' ) ;
80+
81+ julia_server_normalized == "https://julialang-s3.julialang.org"
82+ } ;
83+
84+ // If using default official servers, assume ETAG support
85+ if is_default_server {
86+ return true ;
87+ }
88+
89+ // For custom servers, check via HEAD request
5290 let base_url = match get_julianightlies_base_url ( ) {
5391 Ok ( url) => url,
5492 Err ( _) => return false ,
0 commit comments