mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 00:11:26 +00:00
Log excess data.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28686 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9f774be2d7
commit
75638580ff
3 changed files with 25 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
|||
2009-09-15 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Headers/Additions/GNUstepBase/GSMime.h:
|
||||
* Source/Additions/GSMime.m:
|
||||
Add new -excess method to return any excess data left over from parsing.
|
||||
Previously the code just used to NSLog() this data as a warning.
|
||||
|
||||
2009-09-14 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSCalendarDate.m: Workaround for bug in some linux SMP systems
|
||||
|
|
|
@ -202,8 +202,9 @@ extern "C" {
|
|||
unsigned int hadErrors:1;
|
||||
unsigned int buggyQuotes:1;
|
||||
unsigned int wantEndOfLine:1;
|
||||
unsigned int excessData:1;
|
||||
} flags;
|
||||
NSData *boundary;
|
||||
NSData *boundary; // Also overloaded to hold excess
|
||||
GSMimeDocument *document;
|
||||
GSMimeParser *child;
|
||||
GSMimeCodingContext *context;
|
||||
|
@ -219,6 +220,7 @@ extern "C" {
|
|||
fromRange: (NSRange)aRange
|
||||
intoData: (NSMutableData*)dData
|
||||
withContext: (GSMimeCodingContext*)con;
|
||||
- (NSData*) excess;
|
||||
- (void) expectNoHeaders;
|
||||
- (BOOL) isComplete;
|
||||
- (BOOL) isHttp;
|
||||
|
|
|
@ -1107,6 +1107,19 @@ wordData(NSString *word)
|
|||
return document;
|
||||
}
|
||||
|
||||
/** If there was more data passed to the parser than actually needed to
|
||||
* form the document, this method returns that excess data, othrwise it
|
||||
* returns nil.
|
||||
*/
|
||||
- (NSData*) excess
|
||||
{
|
||||
if (flags.excessData == 1)
|
||||
{
|
||||
return boundary;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method may be called to tell the parser that it should not expect
|
||||
* to parse any headers, and that the data it will receive is body data.<br />
|
||||
|
@ -2401,7 +2414,8 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
|||
rawBodyLength = expect;
|
||||
excess = [d subdataWithRange:
|
||||
NSMakeRange(dLength, [d length] - dLength)];
|
||||
NSLog(@"Excess data ignored: %@", excess);
|
||||
ASSIGN(boundary, excess);
|
||||
flags.excessData = 1;
|
||||
}
|
||||
[self decodeData: d
|
||||
fromRange: NSMakeRange(0, dLength)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue