Add default Content-Type to POST methods if none is present.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29895 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fedor 2010-03-10 14:55:00 +00:00
parent 0ec0645f11
commit c8c728eb80
2 changed files with 11 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2010-03-10 Adam Fedor <fedor@mallory>
* Source/NSURLProtocol.m ([_NSHTTPURLProtocol -stream:stream:event]):
Add default Content-Type to POST methods if none is present.
2010-03-09 Adam Fedor <fedor@gnu.org>
* Source/NSHTTPCookie.m: Finish off implementation

View file

@ -1304,6 +1304,12 @@ static NSURLProtocol *placeholder = nil;
[m appendString: [d objectForKey: s]];
[m appendString: @"\r\n"];
}
if ([[this->request HTTPMethod] isEqual: @"POST"]
&& [d objectForKey: @"Content-Type"] == nil)
{
/* On MacOSX, this is automatically added to POST methods */
[m appendString: @"Content-Type: application/x-www-form-urlencoded\r\n"];
}
if ([this->request valueForHTTPHeaderField: @"Host"] == nil)
{
id p = [u port];