mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +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.
|
* 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++;
|
input++;
|
||||||
if (c == '\r' && input < dataEnd && bytes[input] == '\n')
|
if (c == '\r' && input < dataEnd && bytes[input] == '\n')
|
||||||
{
|
{
|
||||||
input++;
|
input++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* See if we have a wrapped line.
|
* 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))
|
&& ((c = bytes[input]) == '\r' || c == '\n' || isspace(c) == 0))
|
||||||
{
|
{
|
||||||
unwrappingComplete = YES;
|
unwrappingComplete = YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unwrappingComplete == YES)
|
||||||
|
{
|
||||||
bytes[lineEnd] = '\0';
|
bytes[lineEnd] = '\0';
|
||||||
/*
|
/*
|
||||||
* If this is a zero-length line, we have reached the end of
|
* 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];
|
d = [dict objectForKey: NSFileHandleNotificationDataItem];
|
||||||
if (debug == YES) debugRead(d);
|
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;
|
GSMimeHeader *info;
|
||||||
NSString *val;
|
NSString *val;
|
||||||
|
@ -344,16 +351,6 @@ static void debugWrite(NSData *data)
|
||||||
[self didLoadBytes: [d subdataWithRange: r]
|
[self didLoadBytes: [d subdataWithRange: r]
|
||||||
loadComplete: YES];
|
loadComplete: YES];
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (debug == YES)
|
|
||||||
{
|
|
||||||
NSLog(@"HTTP parse failure - %@", parser);
|
|
||||||
}
|
|
||||||
[self endLoadInBackground];
|
|
||||||
[self backgroundLoadDidFailWithReason: @"Response parse failed"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue