mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
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:
parent
49fff1859e
commit
e702cfb145
1 changed files with 17 additions and 0 deletions
|
@ -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)
|
||||
{
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue