[FFmpeg-devel] [PATCH 2/3] Only add Transfer-Encoding header when not in authorization phase, because server will wait (indefinitely) for data when receiving this header Partial fix #3036

Jakob van Bethlehem jakob at jet-stream.nl
Wed Oct 9 10:25:33 CEST 2013


From: "J. van Bethlehem" <jakob at jet-stream.nl>


Signed-off-by: J. van Bethlehem <jakob at jet-stream.nl>
---
 libavformat/http.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 5f016a7..b34683a 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -651,6 +651,12 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
                            "Icy-MetaData: %d\r\n", 1);
     }
 
+    if (!auth_phase) {
+        if (!has_header(s->headers, "\r\nTransfer-Encoding") && post && s->chunked_post)
+            len += av_strlcatf(headers + len, sizeof(headers) - len,
+                               "Transfer-Encoding: %s\r\n", "chunked");
+    }
+
     /* now add in custom headers */
     if (s->headers)
         av_strlcpy(headers + len, s->headers, sizeof(headers) - len);
@@ -659,12 +665,10 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
              "%s %s HTTP/1.1\r\n"
              "%s"
              "%s"
-             "%s"
              "%s%s"
              "\r\n",
              method,
              path,
-             post && s->chunked_post ? "Transfer-Encoding: chunked\r\n" : "",
              headers,
              authstr ? authstr : "",
              proxyauthstr ? "Proxy-" : "", proxyauthstr ? proxyauthstr : "");
-- 
1.7.12.4 (Apple Git-37)



More information about the ffmpeg-devel mailing list