mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Improve code deciding when to expect body after headers.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@18577 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5aad007dac
commit
47ec878faf
2 changed files with 88 additions and 50 deletions
|
@ -1,3 +1,10 @@
|
|||
2004-02-11 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSHTTPURLHandle.m: Expect to read content data after headers
|
||||
if content-length is non-zero
|
||||
or if content-transfer-encoding is chunked
|
||||
or if server http version is less than 1
|
||||
|
||||
2004-02-09 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* configure.ac: Add ffcall dir to INCLUDE_FLAGS.
|
||||
|
|
|
@ -310,9 +310,39 @@ static void debugWrite(NSData *data)
|
|||
[self endLoadInBackground];
|
||||
[self backgroundLoadDidFailWithReason: @"Response parse failed"];
|
||||
}
|
||||
else if ([parser isComplete] == YES
|
||||
|| ([parser isInHeaders] == NO &&
|
||||
[[[document headerNamed: @"content-length"] value] intValue] > 0))
|
||||
else
|
||||
{
|
||||
BOOL complete = [parser isComplete];
|
||||
|
||||
if (complete == NO && [parser isInHeaders] == NO)
|
||||
{
|
||||
NSString *enc;
|
||||
NSString *len;
|
||||
int ver;
|
||||
|
||||
ver = [[[document headerNamed: @"http"]
|
||||
objectForKey: NSHTTPPropertyServerHTTPVersionKey] intValue];
|
||||
len = [[document headerNamed: @"content-length"] value];
|
||||
enc = [[document headerNamed: @"content-transfer-encoding"] value];
|
||||
if (enc == nil)
|
||||
{
|
||||
enc = [[document headerNamed: @"transfer-encoding"] value];
|
||||
}
|
||||
|
||||
if ([enc isEqualToString: @"chunked"] == YES)
|
||||
{
|
||||
complete = NO; // Read chunked body data
|
||||
}
|
||||
else if (ver >= 1 && [len intValue] == 0)
|
||||
{
|
||||
complete = YES; // No content
|
||||
}
|
||||
else
|
||||
{
|
||||
complete = NO; // No
|
||||
}
|
||||
}
|
||||
if (complete == YES)
|
||||
{
|
||||
GSMimeHeader *info;
|
||||
NSString *val;
|
||||
|
@ -369,6 +399,7 @@ static void debugWrite(NSData *data)
|
|||
[sock readInBackgroundAndNotify];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) bgdTunnelRead: (NSNotification*) not
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue