mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 09:02:01 +00:00
Workaround for buggy server-side software
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37895 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ca7c8ec08b
commit
e6dfab4119
3 changed files with 34 additions and 4 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2014-05-20 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/GSHTTPURLHandle.m:
|
||||||
|
* Source/NSURLProtocol.m:
|
||||||
|
When creating the 'Host' header, omit the port part if the scheme is
|
||||||
|
http/https and the port is the normal 80/443. A workaround for buggy
|
||||||
|
software which doesn't understand the spec saying that the port is
|
||||||
|
'optional', not 'omitted' in these cases.
|
||||||
|
|
||||||
2014-05-09 Richard Frith-Macdonald <rfm@gnu.org>
|
2014-05-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSDebug.m:
|
* Source/NSDebug.m:
|
||||||
|
|
|
@ -407,6 +407,7 @@ debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
||||||
|
|
||||||
if ((id)NSMapGet(wProperties, (void*)@"Host") == nil)
|
if ((id)NSMapGet(wProperties, (void*)@"Host") == nil)
|
||||||
{
|
{
|
||||||
|
NSString *s = [u scheme];
|
||||||
id p = [u port];
|
id p = [u port];
|
||||||
id h = [u host];
|
id h = [u host];
|
||||||
|
|
||||||
|
@ -414,7 +415,16 @@ debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
||||||
{
|
{
|
||||||
h = @""; // Must use an empty host header
|
h = @""; // Must use an empty host header
|
||||||
}
|
}
|
||||||
if (p == nil)
|
if (([s isEqualToString: @"http"] && [p intValue] == 80)
|
||||||
|
|| ([s isEqualToString: @"https"] && [p intValue] == 443))
|
||||||
|
{
|
||||||
|
/* Some buggy systems object to the port being in the Host
|
||||||
|
* header when it's the default (optional) value. To keep
|
||||||
|
* them happy let's omit it in those cases.
|
||||||
|
*/
|
||||||
|
p = nil;
|
||||||
|
}
|
||||||
|
if (nil == p)
|
||||||
{
|
{
|
||||||
NSMapInsert(wProperties, (void*)@"Host", (void*)h);
|
NSMapInsert(wProperties, (void*)@"Host", (void*)h);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1454,14 +1454,25 @@ static NSURLProtocol *placeholder = nil;
|
||||||
}
|
}
|
||||||
if ([this->request valueForHTTPHeaderField: @"Host"] == nil)
|
if ([this->request valueForHTTPHeaderField: @"Host"] == nil)
|
||||||
{
|
{
|
||||||
id p = [u port];
|
NSString *s = [u scheme];
|
||||||
id h = [u host];
|
id p = [u port];
|
||||||
|
id h = [u host];
|
||||||
|
|
||||||
if (h == nil)
|
if (h == nil)
|
||||||
{
|
{
|
||||||
h = @""; // Must send an empty host header
|
h = @""; // Must send an empty host header
|
||||||
}
|
}
|
||||||
if (p == nil)
|
if (([s isEqualToString: @"http"] && [p intValue] == 80)
|
||||||
|
|| ([s isEqualToString: @"https"] && [p intValue] == 443))
|
||||||
|
{
|
||||||
|
/* Some buggy systems object to the port being in
|
||||||
|
* the Host header when it's the default (optional)
|
||||||
|
* value.
|
||||||
|
* To keep them happy let's omit it in those cases.
|
||||||
|
*/
|
||||||
|
p = nil;
|
||||||
|
}
|
||||||
|
if (nil == p)
|
||||||
{
|
{
|
||||||
[m appendFormat: @"Host: %@\r\n", h];
|
[m appendFormat: @"Host: %@\r\n", h];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue