Commit e8d2d6d3 authored by Damien Fouilleul's avatar Damien Fouilleul

mozilla: backport absolute URL parsing from trunk

parent 9f319bf0
...@@ -303,9 +303,18 @@ char *VlcPlugin::getAbsoluteURL(const char *url) ...@@ -303,9 +303,18 @@ char *VlcPlugin::getAbsoluteURL(const char *url)
{ {
// validate protocol header // validate protocol header
const char *start = url; const char *start = url;
while( start != end ) { char c = *start;
char c = tolower(*start); if( isalpha(c) )
if( (c < 'a') || (c > 'z') ) {
++start;
while( start != end )
{
c = *start;
if( ! (isalnum(c)
|| ('-' == c)
|| ('+' == c)
|| ('.' == c)
|| ('/' == c)) ) /* VLC uses / to allow user to specify a demuxer */
// not valid protocol header, assume relative URL // not valid protocol header, assume relative URL
goto relativeurl; goto relativeurl;
++start; ++start;
...@@ -313,6 +322,8 @@ char *VlcPlugin::getAbsoluteURL(const char *url) ...@@ -313,6 +322,8 @@ char *VlcPlugin::getAbsoluteURL(const char *url)
/* we have a protocol header, therefore URL is absolute */ /* we have a protocol header, therefore URL is absolute */
return strdup(url); return strdup(url);
} }
// not a valid protocol header, assume relative URL
}
relativeurl: relativeurl:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment