avformat/http: allow adjusting the redirect limit
Idea from: BapToutatis and also curl and wget have equivalent options Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
committed by
michaelni
parent
0833dd3665
commit
ba3639bc90
+3
-1
@@ -156,6 +156,7 @@ typedef struct HTTPContext {
|
||||
int nb_redirects;
|
||||
int sum_latency; /* divide by nb_requests */
|
||||
int max_latency;
|
||||
int max_redirects;
|
||||
} HTTPContext;
|
||||
|
||||
#define OFFSET(x) offsetof(HTTPContext, x)
|
||||
@@ -202,6 +203,7 @@ static const AVOption options[] = {
|
||||
{ "resource", "The resource requested by a client", OFFSET(resource), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
|
||||
{ "reply_code", "The http status code to return to a client", OFFSET(reply_code), AV_OPT_TYPE_INT, { .i64 = 200}, INT_MIN, 599, E},
|
||||
{ "short_seek_size", "Threshold to favor readahead over seek.", OFFSET(short_seek_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, D },
|
||||
{ "max_redirects", "Maximum number of redirects", OFFSET(max_redirects), AV_OPT_TYPE_INT, { .i64 = MAX_REDIRECTS }, 0, INT_MAX, D },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@@ -480,7 +482,7 @@ redo:
|
||||
s->new_location) {
|
||||
/* url moved, get next */
|
||||
ffurl_closep(&s->hd);
|
||||
if (redirects++ >= MAX_REDIRECTS)
|
||||
if (redirects++ >= s->max_redirects)
|
||||
return AVERROR(EIO);
|
||||
|
||||
if (!s->expires) {
|
||||
|
||||
Reference in New Issue
Block a user