Now retry on HTTP 520 (Unknown error)

This commit is contained in:
Fufu Fang 2019-09-04 17:57:15 +01:00
parent 56e1095287
commit ff67794b02
No known key found for this signature in database
GPG Key ID: 0F6BB5EF6F8BB729
2 changed files with 5 additions and 2 deletions

View File

@ -200,9 +200,11 @@ void Link_set_file_stat(Link* this_link, CURL *curl)
} }
} else { } else {
fprintf(stderr, "Link_set_file_stat(): HTTP %ld", http_resp); fprintf(stderr, "Link_set_file_stat(): HTTP %ld", http_resp);
if (http_resp == HTTP_TOO_MANY_REQUESTS) { if ((http_resp == HTTP_TOO_MANY_REQUESTS) ||
(http_resp == HTTP_UNKNOWN_ERROR)) {
fprintf(stderr, ", retrying later.\n"); fprintf(stderr, ", retrying later.\n");
} else { } else {
fprintf(stderr, "\n");
this_link->type = LINK_INVALID; this_link->type = LINK_INVALID;
} }
fprintf(stderr, ".\n"); fprintf(stderr, ".\n");

View File

@ -12,7 +12,8 @@ typedef enum {
HTTP_OK = 200, HTTP_OK = 200,
HTTP_PARTIAL_CONTENT = 206, HTTP_PARTIAL_CONTENT = 206,
HTTP_RANGE_NOT_SATISFIABLE = 416, HTTP_RANGE_NOT_SATISFIABLE = 416,
HTTP_TOO_MANY_REQUESTS = 429 HTTP_TOO_MANY_REQUESTS = 429,
HTTP_UNKNOWN_ERROR = 520
} HTTPResponseCode; } HTTPResponseCode;
typedef enum { typedef enum {