[vlc-commits] demux: adaptive: compute new location when processing header

Francois Cartegnie git at videolan.org
Tue Feb 13 14:07:37 CET 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Feb 13 13:46:11 2018 +0100| [b952a7fea62ddefeee4e9157354d5a9ae756f769] | committer: Francois Cartegnie

demux: adaptive: compute new location when processing header

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

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

diff --git a/modules/demux/adaptive/http/HTTPConnection.cpp b/modules/demux/adaptive/http/HTTPConnection.cpp
index 971f0c84a7..f30022aa4c 100644
--- a/modules/demux/adaptive/http/HTTPConnection.cpp
+++ b/modules/demux/adaptive/http/HTTPConnection.cpp
@@ -135,6 +135,7 @@ int HTTPConnection::request(const std::string &path, const BytesRange &range)
 
     /* Set new path for this query */
     params.setPath(path);
+    locationparams = ConnectionParams();
 
     msg_Dbg(p_object, "Retrieving %s @%zu", params.getUrl().c_str(),
                        range.isValid() ? range.getStartByte() : 0);
@@ -179,11 +180,6 @@ int HTTPConnection::request(const std::string &path, const BytesRange &range)
     else if(i_ret == VLC_ETIMEOUT) /* redir */
     {
         socket->disconnect();
-        if(locationparams.getScheme().empty())
-            params.setPath(locationparams.getPath());
-        else
-            params = locationparams;
-        locationparams = ConnectionParams();
     }
     else if(i_ret == VLC_EGENERIC)
     {
@@ -386,7 +382,14 @@ void HTTPConnection::onHeader(const std::string &key,
     }
     else if(key == "Location")
     {
-        locationparams = ConnectionParams( value );
+        locationparams = ConnectionParams();
+        ConnectionParams loc = ConnectionParams( value );
+        if(loc.getScheme().empty())
+        {
+            locationparams = params;
+            locationparams.setPath(loc.getPath());
+        }
+        else locationparams = loc;
     }
     else if(key == "Set-Cookie" && authStorage)
     {



More information about the vlc-commits mailing list