mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +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
|
@ -1454,14 +1454,25 @@ static NSURLProtocol *placeholder = nil;
|
|||
}
|
||||
if ([this->request valueForHTTPHeaderField: @"Host"] == nil)
|
||||
{
|
||||
id p = [u port];
|
||||
id h = [u host];
|
||||
NSString *s = [u scheme];
|
||||
id p = [u port];
|
||||
id h = [u host];
|
||||
|
||||
if (h == nil)
|
||||
{
|
||||
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];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue