mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
Make URL parsing a bit stricter like MacOS-X
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@24375 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b2e8aa5583
commit
0a60eafdd2
2 changed files with 25 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
* Source/NSURLHandle.m: ([resourceData]) make sure value returned
|
* Source/NSURLHandle.m: ([resourceData]) make sure value returned
|
||||||
is autoreleased.
|
is autoreleased.
|
||||||
|
* Source/NSURL.m: Parse string a bit more strictly according to RFC
|
||||||
|
|
||||||
2007-01-16 Nicola Pero <nicola.pero@meta-innovation.com>
|
2007-01-16 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||||
|
|
||||||
|
|
|
@ -627,6 +627,10 @@ static unsigned urlAlign;
|
||||||
- (id) initWithString: (NSString*)aUrlString
|
- (id) initWithString: (NSString*)aUrlString
|
||||||
relativeToURL: (NSURL*)aBaseUrl
|
relativeToURL: (NSURL*)aBaseUrl
|
||||||
{
|
{
|
||||||
|
/* RFC 2396 'reserved' characters ...
|
||||||
|
*/
|
||||||
|
static const char *reserved = ";/?:@&=+$,";
|
||||||
|
|
||||||
if (aUrlString == nil)
|
if (aUrlString == nil)
|
||||||
{
|
{
|
||||||
[NSException raise: NSInvalidArgumentException
|
[NSException raise: NSInvalidArgumentException
|
||||||
|
@ -879,6 +883,11 @@ static unsigned urlAlign;
|
||||||
if (buf->fragment == 0 && base != 0)
|
if (buf->fragment == 0 && base != 0)
|
||||||
{
|
{
|
||||||
buf->fragment = base->fragment;
|
buf->fragment = base->fragment;
|
||||||
|
if (legal(buf->fragment, reserved) == NO)
|
||||||
|
{
|
||||||
|
[NSException raise: NSGenericException format:
|
||||||
|
@"illegal character in fragment part"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -899,6 +908,11 @@ static unsigned urlAlign;
|
||||||
if (buf->query == 0 && base != 0)
|
if (buf->query == 0 && base != 0)
|
||||||
{
|
{
|
||||||
buf->query = base->query;
|
buf->query = base->query;
|
||||||
|
if (legal(buf->query, reserved) == NO)
|
||||||
|
{
|
||||||
|
[NSException raise: NSGenericException format:
|
||||||
|
@"illegal character in query part"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -919,6 +933,11 @@ static unsigned urlAlign;
|
||||||
if (buf->parameters == 0 && base != 0)
|
if (buf->parameters == 0 && base != 0)
|
||||||
{
|
{
|
||||||
buf->parameters = base->parameters;
|
buf->parameters = base->parameters;
|
||||||
|
if (legal(buf->parameters, reserved) == NO)
|
||||||
|
{
|
||||||
|
[NSException raise: NSGenericException format:
|
||||||
|
@"illegal character in parameters part"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -944,6 +963,11 @@ static unsigned urlAlign;
|
||||||
* Store the path.
|
* Store the path.
|
||||||
*/
|
*/
|
||||||
buf->path = start;
|
buf->path = start;
|
||||||
|
if (legal(buf->path, reserved) == NO)
|
||||||
|
{
|
||||||
|
[NSException raise: NSGenericException format:
|
||||||
|
@"illegal character in path part"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
NS_HANDLER
|
NS_HANDLER
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue