lib/dload: unlink on response code >=400
ftp and http both define >=400 as being "something bad happened" Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
24824b54ce
commit
9934b3bd34
1 changed files with 7 additions and 1 deletions
|
@ -189,7 +189,7 @@ static int curl_download_internal(struct dload_payload *payload,
|
||||||
char hostname[256];
|
char hostname[256];
|
||||||
char error_buffer[CURL_ERROR_SIZE];
|
char error_buffer[CURL_ERROR_SIZE];
|
||||||
struct stat st;
|
struct stat st;
|
||||||
long timecond, remote_time = -1;
|
long timecond, respcode = 0, remote_time = -1;
|
||||||
double remote_size, bytes_dl;
|
double remote_size, bytes_dl;
|
||||||
struct sigaction sig_pipe[2], sig_int[2];
|
struct sigaction sig_pipe[2], sig_int[2];
|
||||||
/* shortcut to our handle within the payload */
|
/* shortcut to our handle within the payload */
|
||||||
|
@ -309,6 +309,12 @@ static int curl_download_internal(struct dload_payload *payload,
|
||||||
/* was it a success? */
|
/* was it a success? */
|
||||||
switch(handle->curlerr) {
|
switch(handle->curlerr) {
|
||||||
case CURLE_OK:
|
case CURLE_OK:
|
||||||
|
/* get http/ftp response code */
|
||||||
|
curl_easy_getinfo(handle->curl, CURLINFO_RESPONSE_CODE, &respcode);
|
||||||
|
if(respcode >=400) {
|
||||||
|
payload->unlink_on_fail = 1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CURLE_ABORTED_BY_CALLBACK:
|
case CURLE_ABORTED_BY_CALLBACK:
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
Loading…
Add table
Reference in a new issue