Fix minor error setting host header in request.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28404 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2009-07-23 08:31:35 +00:00
parent abc61b49c3
commit 3bf7a26b78
3 changed files with 37 additions and 2 deletions

View file

@ -424,7 +424,22 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
if ((id)NSMapGet(wProperties, (void*)@"Host") == nil)
{
NSMapInsert(wProperties, (void*)@"Host", (void*)[u host]);
id p = [u port];
id h = [u host];
if (h == nil)
{
h = @""; // Must use an empty host header
}
if (p == nil)
{
NSMapInsert(wProperties, (void*)@"Host", (void*)h);
}
else
{
NSMapInsert(wProperties, (void*)@"Host",
(void*)[NSString stringWithFormat: @"%@:%@", h, p]);
}
}
if ([wData length] > 0)