Add 2 new options:
- reconnect_on_http_error - a list of http status codes that should be
retried. the list can contain explicit status codes / the strings
4xx/5xx.
- reconnect_on_network_error - reconnects on arbitrary errors during
connect, e.g. ECONNRESET/ETIMEDOUT
the retry employs the same exponential backoff logic as the existing
reconnect/reconnect_at_eof flags.
related tickets:
https://trac.ffmpeg.org/ticket/6066https://trac.ffmpeg.org/ticket/7768
Signed-off-by: Marton Balint <cus@passwd.hu>
{"method","Override the HTTP method or set the expected HTTP method from a client",OFFSET(method),AV_OPT_TYPE_STRING,{.str=NULL},0,0,D|E},
{"reconnect","auto reconnect after disconnect before EOF",OFFSET(reconnect),AV_OPT_TYPE_BOOL,{.i64=0},0,1,D},
{"reconnect_at_eof","auto reconnect at EOF",OFFSET(reconnect_at_eof),AV_OPT_TYPE_BOOL,{.i64=0},0,1,D},
{"reconnect_on_network_error","auto reconnect in case of tcp/tls error during connect",OFFSET(reconnect_on_network_error),AV_OPT_TYPE_BOOL,{.i64=0},0,1,D},
{"reconnect_on_http_error","list of http status codes to reconnect on",OFFSET(reconnect_on_http_error),AV_OPT_TYPE_STRING,{.str=NULL},0,0,D},
{"reconnect_streamed","auto reconnect streamed / non seekable streams",OFFSET(reconnect_streamed),AV_OPT_TYPE_BOOL,{.i64=0},0,1,D},
{"reconnect_delay_max","max reconnect delay in seconds after which to give up",OFFSET(reconnect_delay_max),AV_OPT_TYPE_INT,{.i64=120},0,UINT_MAX/1000/1000,D},
{"listen","listen on HTTP",OFFSET(listen),AV_OPT_TYPE_INT,{.i64=0},0,2,D|E},
@ -258,21 +262,73 @@ static int http_open_cnx_internal(URLContext *h, AVDictionary **options)