Support username:password@ prefix to host when initialising from schem,

host and path.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27290 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2008-12-14 19:03:58 +00:00
parent 49fff1859e
commit e702cfb145

View file

@ -542,6 +542,17 @@ static unsigned urlAlign;
= [aPath stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
if ([aHost length] > 0)
{
NSRange r = [aHost rangeOfString: @"@"];
NSString *auth = nil;
/* Allow for authentication (username:password) before actual host.
*/
if (r.length > 0)
{
auth = [aHost substringToIndex: r.location];
aHost = [aHost substringFromIndex: NSMaxRange(r)];
}
/* Add square brackets around ipv6 address if necessary
*/
if ([[aHost componentsSeparatedByString: @":"] count] > 2
@ -549,6 +560,12 @@ static unsigned urlAlign;
{
aHost = [NSString stringWithFormat: @"[%@]", aHost];
}
if (auth != nil)
{
aHost = [NSString stringWithFormat: @"%@@%@", auth, aHost];
}
if ([aPath length] > 0)
{
/*