From c8c728eb80169199b8236d1575343d6d9e76859a Mon Sep 17 00:00:00 2001 From: fedor Date: Wed, 10 Mar 2010 14:55:00 +0000 Subject: [PATCH] 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 --- ChangeLog | 5 +++++ Source/NSURLProtocol.m | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index fa09d90c0..5a2372182 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-03-10 Adam Fedor + + * Source/NSURLProtocol.m ([_NSHTTPURLProtocol -stream:stream:event]): + Add default Content-Type to POST methods if none is present. + 2010-03-09 Adam Fedor * Source/NSHTTPCookie.m: Finish off implementation diff --git a/Source/NSURLProtocol.m b/Source/NSURLProtocol.m index 04af85c44..79d578a6e 100644 --- a/Source/NSURLProtocol.m +++ b/Source/NSURLProtocol.m @@ -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];