[vlc-commits] demux: adaptive: handle obsolete http header line folding

Francois Cartegnie git at videolan.org
Wed Oct 11 19:33:56 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Oct 11 19:29:26 2017 +0200| [8145fb941d9639119c3db059cf7a9cc6c6b1517f] | committer: Francois Cartegnie

demux: adaptive: handle obsolete http header line folding

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

 modules/demux/adaptive/http/HTTPConnection.cpp | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/modules/demux/adaptive/http/HTTPConnection.cpp b/modules/demux/adaptive/http/HTTPConnection.cpp
index 91e3709a3c..21cf1dc97d 100644
--- a/modules/demux/adaptive/http/HTTPConnection.cpp
+++ b/modules/demux/adaptive/http/HTTPConnection.cpp
@@ -235,18 +235,24 @@ int HTTPConnection::parseReply()
     int replycode;
     ss >> replycode;
 
-    std::string line = readLine();
-
-    while(!line.empty() && line.compare("\r\n"))
+    std::string lines;
+    for( ;; )
     {
-        size_t split = line.find_first_of(':');
-        size_t value = split + 1;
+        std::string l = readLine();
+        if(!l.empty() && l.compare("\r\n"))
+            break;
+        lines.append(l);
 
-        while(line.at(value) == ' ')
-            value++;
+        size_t split = lines.find_first_of(':');
+        if(split != std::string::npos)
+        {
+            size_t value = split + 1;
+            while(lines.at(value) == ' ')
+                value++;
 
-        onHeader(line.substr(0, split), line.substr(value));
-        line = readLine();
+            onHeader(lines.substr(0, split), lines.substr(value));
+            lines = std::string();
+        }
     }
 
     if((replycode == 301 || replycode == 302 || replycode == 307 || replycode == 308) &&



More information about the vlc-commits mailing list