mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Fix error in handling header unfolding
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@16727 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
eedf8ca265
commit
eae4993fed
2 changed files with 62 additions and 50 deletions
|
@ -2419,11 +2419,22 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
|||
/*
|
||||
* Eat a newline that is part of a cr-lf sequence.
|
||||
*/
|
||||
if (input < dataEnd)
|
||||
{
|
||||
/*
|
||||
* If we had an end-of-line with nothing else, we must have
|
||||
* finished unwrapping at the final boundary.
|
||||
*/
|
||||
if (input == lineStart)
|
||||
{
|
||||
unwrappingComplete = YES;
|
||||
}
|
||||
input++;
|
||||
if (c == '\r' && input < dataEnd && bytes[input] == '\n')
|
||||
{
|
||||
input++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* See if we have a wrapped line.
|
||||
|
@ -2432,6 +2443,10 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
|||
&& ((c = bytes[input]) == '\r' || c == '\n' || isspace(c) == 0))
|
||||
{
|
||||
unwrappingComplete = YES;
|
||||
}
|
||||
|
||||
if (unwrappingComplete == YES)
|
||||
{
|
||||
bytes[lineEnd] = '\0';
|
||||
/*
|
||||
* If this is a zero-length line, we have reached the end of
|
||||
|
|
|
@ -301,9 +301,16 @@ static void debugWrite(NSData *data)
|
|||
d = [dict objectForKey: NSFileHandleNotificationDataItem];
|
||||
if (debug == YES) debugRead(d);
|
||||
|
||||
if ([parser parse: d] == NO || [parser isComplete] == YES)
|
||||
if ([parser parse: d] == NO)
|
||||
{
|
||||
if ([parser isComplete] == YES)
|
||||
if (debug == YES)
|
||||
{
|
||||
NSLog(@"HTTP parse failure - %@", parser);
|
||||
}
|
||||
[self endLoadInBackground];
|
||||
[self backgroundLoadDidFailWithReason: @"Response parse failed"];
|
||||
}
|
||||
else if ([parser isComplete] == YES)
|
||||
{
|
||||
GSMimeHeader *info;
|
||||
NSString *val;
|
||||
|
@ -344,16 +351,6 @@ static void debugWrite(NSData *data)
|
|||
[self didLoadBytes: [d subdataWithRange: r]
|
||||
loadComplete: YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (debug == YES)
|
||||
{
|
||||
NSLog(@"HTTP parse failure - %@", parser);
|
||||
}
|
||||
[self endLoadInBackground];
|
||||
[self backgroundLoadDidFailWithReason: @"Response parse failed"];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue