mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-10 16:20:42 +00:00
Fix error in last 'host' mod, and add some chacks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@13576 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d9c4a7f47b
commit
65541445d0
2 changed files with 30 additions and 26 deletions
|
@ -14,7 +14,9 @@
|
|||
|
||||
* Source/NSURLHandle.m: Implement ([-hash]) and ([-isEqual:]) based on
|
||||
([-absoluteString]) rather than simple pointer comparison.
|
||||
* Source/GSHTTPURLHandle.m: ([-bgdConnect]) set host header
|
||||
* Source/GSHTTPURLHandle.m: ([-bgdConnect]) check for existing
|
||||
headers before writing ... avoid overriding them and only set things
|
||||
that the programmer has not bothered to set.
|
||||
([-loadInBackGround]) use URL port if available.
|
||||
More fixes thanks to lcampbel via savannah
|
||||
* Headers/Foundation/NSURLHanlde.h: include NSObject.h
|
||||
|
|
|
@ -568,24 +568,22 @@ static void debugWrite(NSData *data)
|
|||
{
|
||||
s = [[NSMutableString alloc] initWithFormat: @"%@ http://%@%@",
|
||||
method, [url host], [url path]];
|
||||
if ([[url query] length] > 0)
|
||||
{
|
||||
[s appendFormat: @"?%@", [url query]];
|
||||
}
|
||||
[s appendFormat: @" HTTP/%@\r\n", httpVersion];
|
||||
}
|
||||
else // no proxy
|
||||
{
|
||||
s = [[NSMutableString alloc] initWithFormat: @"%@ %@",
|
||||
method, [url path]];
|
||||
if ([[url query] length] > 0)
|
||||
{
|
||||
[s appendFormat: @"?%@", [url query]];
|
||||
}
|
||||
[s appendFormat: @" HTTP/%@\nHost: %@\r\n", httpVersion, [url host]];
|
||||
}
|
||||
if ([[url query] length] > 0)
|
||||
{
|
||||
[s appendFormat: @"?%@", [url query]];
|
||||
}
|
||||
[s appendFormat: @" HTTP/%@\r\n", httpVersion];
|
||||
|
||||
[wProperties setObject: [url host] forKey: @"host"];
|
||||
if ([wProperties objectForKey: @"host"] == nil)
|
||||
{
|
||||
[wProperties setObject: [url host] forKey: @"host"];
|
||||
}
|
||||
|
||||
if ([wData length] > 0)
|
||||
{
|
||||
|
@ -600,24 +598,28 @@ static void debugWrite(NSData *data)
|
|||
forKey: @"content-type"];
|
||||
}
|
||||
}
|
||||
if ([url user] != nil)
|
||||
if ([wProperties objectForKey: @"authorisation"] == nil)
|
||||
{
|
||||
NSString *auth;
|
||||
|
||||
if ([[url password] length] > 0)
|
||||
{
|
||||
auth = [NSString stringWithFormat: @"%@:%@",
|
||||
[url user], [url password]];
|
||||
}
|
||||
else
|
||||
if ([url user] != nil)
|
||||
{
|
||||
auth = [NSString stringWithFormat: @"%@", [url user]];
|
||||
NSString *auth;
|
||||
|
||||
if ([[url password] length] > 0)
|
||||
{
|
||||
auth = [NSString stringWithFormat: @"%@:%@",
|
||||
[url user], [url password]];
|
||||
}
|
||||
else
|
||||
{
|
||||
auth = [NSString stringWithFormat: @"%@", [url user]];
|
||||
}
|
||||
auth = [NSString stringWithFormat: @"Basic %@",
|
||||
[self encodebase64: auth]];
|
||||
[wProperties setObject: auth
|
||||
forKey: @"authorization"];
|
||||
}
|
||||
auth = [NSString stringWithFormat: @"Basic %@",
|
||||
[self encodebase64: auth]];
|
||||
[wProperties setObject: auth
|
||||
forKey: @"Authorization"];
|
||||
}
|
||||
|
||||
wpEnumerator = [wProperties keyEnumerator];
|
||||
while ((key = [wpEnumerator nextObject]))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue