avformat/http: add ff_http_get_shutdown_status api for check the status of shutdown

this function is used to get the previous shutdown status
when reusing the old connection in block mode.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
This commit is contained in:
Steven Liu 2019-08-30 07:14:27 +08:00
parent 2b66c757d6
commit 6c593fee63
2 changed files with 25 additions and 0 deletions

View File

@ -304,6 +304,22 @@ fail:
return location_changed;
return ff_http_averror(s->http_code, AVERROR(EIO));
}
int ff_http_get_shutdown_status(URLContext *h)
{
int ret = 0;
HTTPContext *s = h->priv_data;
/* flush the receive buffer when it is write only mode */
char buf[1024];
int read_ret;
read_ret = ffurl_read(s->hd, buf, sizeof(buf));
if (read_ret < 0) {
ret = read_ret;
}
return ret;
}
int ff_http_do_new_request(URLContext *h, const char *uri)
{

View File

@ -37,6 +37,15 @@
*/
void ff_http_init_auth_state(URLContext *dest, const URLContext *src);
/**
* Get the HTTP shutdown response status, be used after http_shutdown.
*
* @param h pointer to the resource
* @return a negative value if an error condition occurred, 0
* otherwise
*/
int ff_http_get_shutdown_status(URLContext *h);
/**
* Send a new HTTP request, reusing the old connection.
*