diff --git a/src/hawkbit-client.c b/src/hawkbit-client.c index e39997f..ce63110 100644 --- a/src/hawkbit-client.c +++ b/src/hawkbit-client.c @@ -971,9 +971,16 @@ static gpointer download_thread(gpointer data) resume_from, &sha1sum, &speed, &error)) break; + // resume download under certain conditions for (const gint *code = &resumable_codes[0]; *code; code++) resumable |= g_error_matches(error, RHU_HAWKBIT_CLIENT_CURL_ERROR, *code); + // but do not resume download on persistent HTTP server errors + if (error->domain == RHU_HAWKBIT_CLIENT_HTTP_ERROR && + error->code >= 400 && error->code < 500 && + error->code != 408 && error->code != 429) + resumable = FALSE; + if (!hawkbit_config->resume_downloads || !resumable) { g_prefix_error(&error, "Download failed: "); goto report_err;