vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Mon Dec 14 
22:09:36 2015 +0200| [4fb4df7b5e43c4bc700dd84b98c40824da3c368f] | committer: 
Rémi Denis-Courmont

message: size is unknown if Transfer-Encoding is present

This is not really an issue with HTTP/2 as framing specifies the end of
the stream explicitly. This would become a problem with HTTP/1, notably
with chunked encoding.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4fb4df7b5e43c4bc700dd84b98c40824da3c368f
---

 modules/access/http/message.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/access/http/message.c b/modules/access/http/message.c
index 789b961..13cd053 100644
--- a/modules/access/http/message.c
+++ b/modules/access/http/message.c
@@ -699,7 +699,11 @@ uintmax_t vlc_http_msg_get_size(const struct vlc_http_msg 
*m)
      || m->status == 304 /* Not Modified */)
         return 0;
 
-    const char *str = vlc_http_msg_get_header(m, "Content-Length");
+    const char *str = vlc_http_msg_get_header(m, "Transfer-Encoding");
+    if (str != NULL) /* Transfer-Encoding preempts Content-Length */
+        return -1;
+
+    str = vlc_http_msg_get_header(m, "Content-Length");
     if (str == NULL)
     {
         if (m->status < 0)

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to