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

Francois Cartegnie git at videolan.org
Thu Feb 15 10:17:56 CET 2018


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

demux: adaptive: compute new location when processing header

(cherry picked from commit b952a7fea62ddefeee4e9157354d5a9ae756f769)

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

 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