Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
http connect: retry five times before reporting about error
- Loading branch information
Showing
with
11 additions
and
3 deletions.
-
+11
−3
libavformat/http.c
|
|
@@ -259,11 +259,19 @@ static int http_open_cnx(URLContext *h, AVDictionary **options) |
|
|
cur_auth_type = s->auth_state.auth_type; |
|
|
cur_proxy_auth_type = s->auth_state.auth_type; |
|
|
|
|
|
attempts++; |
|
|
|
|
|
location_changed = http_open_cnx_internal(h, options); |
|
|
if (location_changed < 0) |
|
|
goto fail; |
|
|
if (location_changed < 0) { |
|
|
if (attempts < 5) { |
|
|
av_log(h, AV_LOG_ERROR, "Couldn't get HTTP resource, retrying...\n"); |
|
|
if (s->hd) |
|
|
ffurl_closep(&s->hd); |
|
|
goto redo; |
|
|
} else |
|
|
goto fail; |
|
|
} |
|
|
|
|
|
attempts++; |
|
|
if (s->http_code == 401) { |
|
|
if ((cur_auth_type == HTTP_AUTH_NONE || s->auth_state.stale) && |
|
|
s->auth_state.auth_type != HTTP_AUTH_NONE && attempts < 4) { |
|
|
|