mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-04 02:20:48 +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>
|
2010-10-12 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/Additions/GSXML.m: If we receive an attribute name with no
|
* 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)
|
if (strcmp(buf->scheme, "file") == 0)
|
||||||
{
|
{
|
||||||
usesFragments = NO;
|
|
||||||
usesParameters = NO;
|
|
||||||
usesQueries = NO;
|
|
||||||
buf->isFile = YES;
|
buf->isFile = YES;
|
||||||
}
|
}
|
||||||
else if (strcmp(buf->scheme, "mailto") == 0)
|
else if (strcmp(buf->scheme, "mailto") == 0)
|
||||||
|
@ -1060,6 +1057,7 @@ 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, filepath) == NO)
|
if (legal(buf->fragment, filepath) == NO)
|
||||||
{
|
{
|
||||||
[NSException raise: NSInvalidArgumentException
|
[NSException raise: NSInvalidArgumentException
|
||||||
|
@ -1070,7 +1068,6 @@ static unsigned urlAlign;
|
||||||
aUrlString, aBaseUrl];
|
aUrlString, aBaseUrl];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (usesQueries == YES)
|
if (usesQueries == YES)
|
||||||
{
|
{
|
||||||
|
@ -1089,6 +1086,7 @@ 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, filepath) == NO)
|
if (legal(buf->query, filepath) == NO)
|
||||||
{
|
{
|
||||||
[NSException raise: NSInvalidArgumentException
|
[NSException raise: NSInvalidArgumentException
|
||||||
|
@ -1099,7 +1097,6 @@ static unsigned urlAlign;
|
||||||
aUrlString, aBaseUrl];
|
aUrlString, aBaseUrl];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (usesParameters == YES)
|
if (usesParameters == YES)
|
||||||
{
|
{
|
||||||
|
@ -1118,6 +1115,7 @@ 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, filepath) == NO)
|
if (legal(buf->parameters, filepath) == NO)
|
||||||
{
|
{
|
||||||
[NSException raise: NSInvalidArgumentException
|
[NSException raise: NSInvalidArgumentException
|
||||||
|
@ -1128,13 +1126,15 @@ static unsigned urlAlign;
|
||||||
aUrlString, aBaseUrl];
|
aUrlString, aBaseUrl];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (buf->isFile == YES)
|
if (buf->isFile == YES)
|
||||||
{
|
{
|
||||||
buf->user = 0;
|
buf->user = 0;
|
||||||
buf->password = 0;
|
buf->password = 0;
|
||||||
buf->host = (char*) "localhost";
|
if (buf->host != 0 && *buf->host == 0)
|
||||||
|
{
|
||||||
|
buf->host = 0;
|
||||||
|
}
|
||||||
buf->port = 0;
|
buf->port = 0;
|
||||||
buf->isGeneric = YES;
|
buf->isGeneric = YES;
|
||||||
}
|
}
|
||||||
|
@ -1702,6 +1702,12 @@ static unsigned urlAlign;
|
||||||
*/
|
*/
|
||||||
- (NSString*) relativePath
|
- (NSString*) relativePath
|
||||||
{
|
{
|
||||||
|
if (nil == _baseURL)
|
||||||
|
{
|
||||||
|
return [self path];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
NSString *path = nil;
|
NSString *path = nil;
|
||||||
|
|
||||||
if (myData->path != 0)
|
if (myData->path != 0)
|
||||||
|
@ -1709,6 +1715,7 @@ static unsigned urlAlign;
|
||||||
path = [NSString stringWithUTF8String: myData->path];
|
path = [NSString stringWithUTF8String: myData->path];
|
||||||
}
|
}
|
||||||
return path;
|
return path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1758,7 +1765,7 @@ static unsigned urlAlign;
|
||||||
|
|
||||||
if (range.length > 0)
|
if (range.length > 0)
|
||||||
{
|
{
|
||||||
return [_urlString substringFromIndex: range.location + 1];
|
return [_urlString substringFromIndex: NSMaxRange(range)];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue