mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-02 09:31:07 +00:00
file URL compatibility
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31508 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ee0690defa
commit
2916e80032
2 changed files with 49 additions and 37 deletions
|
@ -1,3 +1,8 @@
|
|||
2010-10-13 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSURL.m: Match OSX behavior with file scheme URLS (treat
|
||||
them like http/https rather than accorinding to the RFCs).
|
||||
|
||||
2010-10-12 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/Additions/GSXML.m: If we receive an attribute name with no
|
||||
|
|
|
@ -835,9 +835,6 @@ static unsigned urlAlign;
|
|||
{
|
||||
if (strcmp(buf->scheme, "file") == 0)
|
||||
{
|
||||
usesFragments = NO;
|
||||
usesParameters = NO;
|
||||
usesQueries = NO;
|
||||
buf->isFile = YES;
|
||||
}
|
||||
else if (strcmp(buf->scheme, "mailto") == 0)
|
||||
|
@ -1060,6 +1057,7 @@ static unsigned urlAlign;
|
|||
if (buf->fragment == 0 && base != 0)
|
||||
{
|
||||
buf->fragment = base->fragment;
|
||||
}
|
||||
if (legal(buf->fragment, filepath) == NO)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
|
@ -1070,7 +1068,6 @@ static unsigned urlAlign;
|
|||
aUrlString, aBaseUrl];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (usesQueries == YES)
|
||||
{
|
||||
|
@ -1089,6 +1086,7 @@ static unsigned urlAlign;
|
|||
if (buf->query == 0 && base != 0)
|
||||
{
|
||||
buf->query = base->query;
|
||||
}
|
||||
if (legal(buf->query, filepath) == NO)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
|
@ -1099,7 +1097,6 @@ static unsigned urlAlign;
|
|||
aUrlString, aBaseUrl];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (usesParameters == YES)
|
||||
{
|
||||
|
@ -1118,6 +1115,7 @@ static unsigned urlAlign;
|
|||
if (buf->parameters == 0 && base != 0)
|
||||
{
|
||||
buf->parameters = base->parameters;
|
||||
}
|
||||
if (legal(buf->parameters, filepath) == NO)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
|
@ -1128,13 +1126,15 @@ static unsigned urlAlign;
|
|||
aUrlString, aBaseUrl];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (buf->isFile == YES)
|
||||
{
|
||||
buf->user = 0;
|
||||
buf->password = 0;
|
||||
buf->host = (char*) "localhost";
|
||||
if (buf->host != 0 && *buf->host == 0)
|
||||
{
|
||||
buf->host = 0;
|
||||
}
|
||||
buf->port = 0;
|
||||
buf->isGeneric = YES;
|
||||
}
|
||||
|
@ -1701,6 +1701,12 @@ static unsigned urlAlign;
|
|||
* Returns nil if there is no path specified for the URL.
|
||||
*/
|
||||
- (NSString*) relativePath
|
||||
{
|
||||
if (nil == _baseURL)
|
||||
{
|
||||
return [self path];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSString *path = nil;
|
||||
|
||||
|
@ -1710,6 +1716,7 @@ static unsigned urlAlign;
|
|||
}
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the relative portion of the URL string. If the receiver is not
|
||||
|
@ -1758,7 +1765,7 @@ static unsigned urlAlign;
|
|||
|
||||
if (range.length > 0)
|
||||
{
|
||||
return [_urlString substringFromIndex: range.location + 1];
|
||||
return [_urlString substringFromIndex: NSMaxRange(range)];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue