MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / http_shutdown

Function http_shutdown

libavformat/http.c:2026–2053  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2024}
2025
2026static int http_shutdown(URLContext *h, int flags)
2027{
2028 int ret = 0;
2029 char footer[] = "0\r\n\r\n";
2030 HTTPContext *s = h->priv_data;
2031
2032 /* signal end of chunked encoding if used */
2033 if (((flags & AVIO_FLAG_WRITE) && s->chunked_post) ||
2034 ((flags & AVIO_FLAG_READ) && s->chunked_post && s->listen)) {
2035 ret = ffurl_write(s->hd, footer, sizeof(footer) - 1);
2036 ret = ret > 0 ? 0 : ret;
2037 /* flush the receive buffer when it is write only mode */
2038 if (!(flags & AVIO_FLAG_READ)) {
2039 char buf[1024];
2040 int read_ret;
2041 s->hd->flags |= AVIO_FLAG_NONBLOCK;
2042 read_ret = ffurl_read(s->hd, buf, sizeof(buf));
2043 s->hd->flags &= ~AVIO_FLAG_NONBLOCK;
2044 if (read_ret < 0 && read_ret != AVERROR(EAGAIN)) {
2045 av_log(h, AV_LOG_ERROR, "URL read error: %s\n", av_err2str(read_ret));
2046 ret = read_ret;
2047 }
2048 }
2049 s->end_chunked_post = 1;
2050 }
2051
2052 return ret;
2053}
2054
2055static int http_close(URLContext *h)
2056{

Callers 2

ff_http_do_new_request2Function · 0.85
http_closeFunction · 0.85

Calls 3

ffurl_writeFunction · 0.85
ffurl_readFunction · 0.85
av_logFunction · 0.85

Tested by

no test coverage detected