set content length header if not already set

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35825 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2012-11-27 11:32:32 +00:00
parent 86e6ebe7e7
commit eba1a7be03
3 changed files with 17 additions and 6 deletions

View file

@ -404,11 +404,16 @@ debugWrite(GSHTTPURLHandle *handle, NSData *data)
}
}
if ([wData length] > 0)
/* Ensure we set the correct content length (may be zero)
*/
if ((id)NSMapGet(wProperties, (void*)@"Content-Length") == nil)
{
NSMapInsert(wProperties, (void*)@"Content-Length",
(void*)[NSString stringWithFormat: @"%d", [wData length]]);
(void*)[NSString stringWithFormat: @"%d", [wData length]]);
}
if ([wData length] > 0)
{
/*
* Assume content type if not specified.
*/
@ -418,6 +423,7 @@ debugWrite(GSHTTPURLHandle *handle, NSData *data)
(void*)@"application/x-www-form-urlencoded");
}
}
if ((id)NSMapGet(wProperties, (void*)@"Authorization") == nil)
{
NSURLProtectionSpace *space;