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

Zhao Zhili git at videolan.org
Wed Feb 21 23:26:41 CET 2018


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

demux: adaptive: case-insensitive compare of scheme

Signed-off-by: Francois Cartegnie <fcvlcdev at free.fr>

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

 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