mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 08:41:03 +00:00
tweak header parsing
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28687 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
75638580ff
commit
6455c3e533
2 changed files with 21 additions and 2 deletions
|
@ -203,6 +203,7 @@ extern "C" {
|
||||||
unsigned int buggyQuotes:1;
|
unsigned int buggyQuotes:1;
|
||||||
unsigned int wantEndOfLine:1;
|
unsigned int wantEndOfLine:1;
|
||||||
unsigned int excessData:1;
|
unsigned int excessData:1;
|
||||||
|
unsigned int headersOnly:1;
|
||||||
} flags;
|
} flags;
|
||||||
NSData *boundary; // Also overloaded to hold excess
|
NSData *boundary; // Also overloaded to hold excess
|
||||||
GSMimeDocument *document;
|
GSMimeDocument *document;
|
||||||
|
@ -237,6 +238,7 @@ extern "C" {
|
||||||
- (NSString*) scanToken: (NSScanner*)scanner;
|
- (NSString*) scanToken: (NSScanner*)scanner;
|
||||||
- (void) setBuggyQuotes: (BOOL)flag;
|
- (void) setBuggyQuotes: (BOOL)flag;
|
||||||
- (void) setDefaultCharset: (NSString*)aName;
|
- (void) setDefaultCharset: (NSString*)aName;
|
||||||
|
- (void) setHeadersOnly;
|
||||||
- (void) setIsHttp;
|
- (void) setIsHttp;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -1416,12 +1416,21 @@ wordData(NSString *word)
|
||||||
* If there is a zero content length, all parsing is complete,
|
* If there is a zero content length, all parsing is complete,
|
||||||
* not just header parsing.
|
* not just header parsing.
|
||||||
*/
|
*/
|
||||||
hdr = [document headerNamed: @"content-length"];
|
if (flags.headersOnly == 1
|
||||||
if (hdr != nil && [[hdr value] intValue] == 0)
|
|| ((hdr = [document headerNamed: @"content-length"]) != nil
|
||||||
|
&& [[hdr value] intValue] == 0))
|
||||||
{
|
{
|
||||||
[document setContent: @""];
|
[document setContent: @""];
|
||||||
flags.inBody = 0;
|
flags.inBody = 0;
|
||||||
flags.complete = 1;
|
flags.complete = 1;
|
||||||
|
/* If we have more data after the headers ... it's excess and
|
||||||
|
* should become available as excess data.
|
||||||
|
*/
|
||||||
|
if ([d length] > 0)
|
||||||
|
{
|
||||||
|
ASSIGNCOPY(boundary, d);
|
||||||
|
flags.excessData = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NO; // No more data needed
|
return NO; // No more data needed
|
||||||
|
@ -2093,6 +2102,14 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to inform the parser that only the headers should be parsed
|
||||||
|
* and any remaining data be treated as excess
|
||||||
|
*/
|
||||||
|
- (void) setHeadersOnly
|
||||||
|
{
|
||||||
|
flags.headersOnly = 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to inform the parser that the data it is parsing is an HTTP
|
* Method to inform the parser that the data it is parsing is an HTTP
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue