[vlc-commits] demux: adaptive: case-insensitive compare of scheme

Zhao Zhili git at videolan.org
Mon Feb 26 12:14:38 CET 2018


vlc/vlc-3.0 | branch: master | Zhao Zhili <quinkblack at foxmail.com> | Mon Feb  5 16:05:38 2018 +0800| [e07f3b0c31997eccd248221a1980d3a82a996ae3] | committer: Francois Cartegnie

demux: adaptive: case-insensitive compare of scheme

Signed-off-by: Francois Cartegnie <fcvlcdev at free.fr>
(cherry picked from commit eaac4ae23121be244f76e2a35e77b2132e7d7918)

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

 modules/demux/adaptive/http/ConnectionParams.cpp | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/modules/demux/adaptive/http/ConnectionParams.cpp b/modules/demux/adaptive/http/ConnectionParams.cpp
index 1df660db44..8fbfc87853 100644
--- a/modules/demux/adaptive/http/ConnectionParams.cpp
+++ b/modules/demux/adaptive/http/ConnectionParams.cpp
@@ -24,6 +24,8 @@
 #include "ConnectionParams.hpp"
 
 #include <vlc_url.h>
+#include <ctype.h>
+#include <algorithm>
 #include <sstream>
 
 using namespace adaptive::http;
@@ -83,15 +85,14 @@ uint16_t ConnectionParams::getPort() const
 
 void ConnectionParams::parse()
 {
-    std::size_t pos = uri.find("://");
-    if(pos != std::string::npos)
-    {
-        scheme = uri.substr(0, pos);
-    }
-
     vlc_url_t url_components;
     vlc_UrlParse(&url_components, uri.c_str());
 
+    if(url_components.psz_protocol)
+    {
+        scheme = url_components.psz_protocol;
+        std::transform(scheme.begin(), scheme.end(), scheme.begin(), tolower);
+    }
     if(url_components.psz_path)
         path = url_components.psz_path;
     if(url_components.psz_option)



More information about the vlc-commits mailing list