]> git.sesse.net Git - vlc/blobdiff - activex/utils.cpp
URI: when pasring for protocol headers allow for more characters than just alpha
[vlc] / activex / utils.cpp
index 8750aa1ce2e6749e3e3b9492829a4d2dd58b975f..8cb0b0e08a6ba212e800e2947419d5caefb4afa1 100644 (file)
@@ -181,22 +181,32 @@ LPWSTR CombineURL(LPCWSTR baseUrl, LPCWSTR url)
         {
             // validate protocol header
             const wchar_t *start = url;
-            while( start != end ) {
-                wchar_t c = towlower(*start);
-                if( (c < L'a') || (c > L'z') )
-                    // not a valid protocol header, assume relative URL
-                    goto relativeurl;
-                ++start;
-            }
-            /* we have a protocol header, therefore URL is absolute */
-            UINT len = wcslen(url);
-            wchar_t *href = (LPWSTR)CoTaskMemAlloc((len+1)*sizeof(wchar_t));
-            if( href )
+            wchar_t c = *start;
+            if( iswalpha(c) )
             {
-                memcpy(href, url, len*sizeof(wchar_t));
-                href[len] = L'\0';
+                ++start;
+                while( start != end )
+                {
+                    c = *start;
+                    if( ! (iswalnum(c)
+                       || (L'-' == c)
+                       || (L'+' == c)
+                       || (L'.' == c)
+                       || (L'/' == c)) ) /* VLC uses / to allow user to specify a demuxer */
+                        // not valid protocol header, assume relative URL
+                        goto relativeurl;
+                    ++start;
+                }
+                /* we have a protocol header, therefore URL is absolute */
+                UINT len = wcslen(url);
+                wchar_t *href = (LPWSTR)CoTaskMemAlloc((len+1)*sizeof(wchar_t));
+                if( href )
+                {
+                    memcpy(href, url, len*sizeof(wchar_t));
+                    href[len] = L'\0';
+                }
+                return href;
             }
-            return href;
         }
 
 relativeurl: