Skip to content
Permalink
Browse files

http connect: retry five times before reporting about error

  • Loading branch information
akaWolf committed Sep 16, 2018
1 parent 0a155c5 commit 52673d0760a4ad751c2329a30b4e9f565eaa8a67
Showing with 11 additions and 3 deletions.
  1. +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) {

0 comments on commit 52673d0

Please sign in to comment.