@@ -1611,6 +1611,18 @@ static int http_write(URLContext *h, const uint8_t *buf, int size)
return size;
}
+static int http_read_response(URLContext *h) {
+ HTTPContext *s = h->priv_data;
+ char buf[1024];
+ int ret;
+
+ /* dummy read in nonblocking mode to clear the receive buffer */
+ s->hd->flags |= AVIO_FLAG_NONBLOCK;
+ ret = ffurl_read(s->hd, buf, sizeof(buf));
+ s->hd->flags &= ~AVIO_FLAG_NONBLOCK;
+ return ret;
+}
+
static int http_shutdown(URLContext *h, int flags)
{
int ret = 0;
@@ -1622,6 +1634,7 @@ static int http_shutdown(URLContext *h, int flags)
((flags & AVIO_FLAG_READ) && s->chunked_post && s->listen)) {
ret = ffurl_write(s->hd, footer, sizeof(footer) - 1);
ret = ret > 0 ? 0 : ret;
+ http_read_response(h);
s->end_chunked_post = 1;
}
From: Ravindra <rpatagar@akamai.com> When http persistent conenction is enabled for streaming, TCP window size reduces consistently and reaches zero --- libavformat/http.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)