minor safety tweak

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29896 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2010-03-10 16:10:13 +00:00
parent c8c728eb80
commit 5af99e8da5

View file

@ -1304,11 +1304,18 @@ static NSURLProtocol *placeholder = nil;
[m appendString: [d objectForKey: s]];
[m appendString: @"\r\n"];
}
/* Use valueForHTTPHeaderField: to check for content-type
* header as that does a case insensitive comparison and
* we therefore won't end up adding a second header by
* accident because the two header names differ in case.
*/
if ([[this->request HTTPMethod] isEqual: @"POST"]
&& [d objectForKey: @"Content-Type"] == nil)
&& [this->request valueForHTTPHeaderField:
@"Content-Type"] == nil)
{
/* On MacOSX, this is automatically added to POST methods */
[m appendString: @"Content-Type: application/x-www-form-urlencoded\r\n"];
[m appendString:
@"Content-Type: application/x-www-form-urlencoded\r\n"];
}
if ([this->request valueForHTTPHeaderField: @"Host"] == nil)
{