Skip to content

Commit 214414e

Browse files
Fix: Add HTTP status code error handling to prevent download hangs (#495)
When download requests receive HTTP error responses (like 429, 503, etc.), the code was previously waiting indefinitely for chunks that would never arrive. This adds `response.error_for_status_ref()?` which immediately fails with a clear error message when the server returns an error status code. Fixes an issue where some modpack downloads would hang at 0 B/s indefinitely.
1 parent 9b9d085 commit 214414e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

libium/src/upgrade/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ impl DownloadData {
284284
);
285285

286286
let mut response = client.get(url).send().await?;
287+
response.error_for_status_ref()?;
287288

288289
while let Some(chunk) = response.chunk().await? {
289290
temp_file.write_all(&chunk)?;

0 commit comments

Comments
 (0)