mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
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:
parent
abc61b49c3
commit
3bf7a26b78
3 changed files with 37 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
2009-07-23 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* GSHTTPURLHandle.m:
|
||||
* NSURLProtocol.m:
|
||||
Include the port in the 'Host' header if it's specified in the URL.
|
||||
|
||||
2009-07-21 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSInternal.h: New macros for CLANG/non-fragile ivar compat.
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1305,7 +1305,21 @@ static NSURLProtocol *placeholder = nil;
|
|||
}
|
||||
if ([this->request valueForHTTPHeaderField: @"Host"] == nil)
|
||||
{
|
||||
[m appendFormat: @"Host: %@\r\n", [u host]];
|
||||
id p = [u port];
|
||||
id h = [u host];
|
||||
|
||||
if (h == nil)
|
||||
{
|
||||
h = @""; // Must send an empty host header
|
||||
}
|
||||
if (p == nil)
|
||||
{
|
||||
[m appendFormat: @"Host: %@\r\n", h];
|
||||
}
|
||||
else
|
||||
{
|
||||
[m appendFormat: @"Host: %@:%@\r\n", h, p];
|
||||
}
|
||||
}
|
||||
if (l >= 0 && [this->request
|
||||
valueForHTTPHeaderField: @"Content-Length"] == nil)
|
||||
|
|
Loading…
Reference in a new issue