mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
improve fault tolerance
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23304 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
66506c7c2d
commit
d877bd187a
2 changed files with 32 additions and 1 deletions
|
@ -12,6 +12,8 @@
|
||||||
* NSCharacterSets/decomposableCharSet.dat: Update for chinese etc.
|
* NSCharacterSets/decomposableCharSet.dat: Update for chinese etc.
|
||||||
* Source/NSCharacterSetData.h: Update with ranges in UnicodeData.txt
|
* Source/NSCharacterSetData.h: Update with ranges in UnicodeData.txt
|
||||||
* Source/GSStream.m: Add partial implemenmtation of socks5
|
* Source/GSStream.m: Add partial implemenmtation of socks5
|
||||||
|
* Source/Additions/GSMime.m: improve fault tolerance when parsing
|
||||||
|
headers.
|
||||||
|
|
||||||
2006-08-15 Richard Frith-Macdonald <rfm@gnu.org>
|
2006-08-15 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
|
|
@ -2185,6 +2185,11 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
||||||
* headers it is parsing.
|
* headers it is parsing.
|
||||||
* RFC2047 word encoding in the header is handled by creating a
|
* RFC2047 word encoding in the header is handled by creating a
|
||||||
* string containing the decoded words.
|
* string containing the decoded words.
|
||||||
|
* Strictly speaking, the header should be plain ASCII data with escapes
|
||||||
|
* for non-ascii characters, but for the sake of fault tolerance, we also
|
||||||
|
* attempt to use the default encoding currently set for the document,
|
||||||
|
* and if that fails we try UTF8. Only if none of these works do we
|
||||||
|
* assume that the header is corrupt/unparsable.
|
||||||
*/
|
*/
|
||||||
- (NSString*) _decodeHeader
|
- (NSString*) _decodeHeader
|
||||||
{
|
{
|
||||||
|
@ -2224,6 +2229,18 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
||||||
s = [s initWithBytes: beg
|
s = [s initWithBytes: beg
|
||||||
length: dst - beg
|
length: dst - beg
|
||||||
encoding: NSASCIIStringEncoding];
|
encoding: NSASCIIStringEncoding];
|
||||||
|
if (s == nil && _defaultEncoding != NSASCIIStringEncoding)
|
||||||
|
{
|
||||||
|
s = [s initWithBytes: beg
|
||||||
|
length: dst - beg
|
||||||
|
encoding: _defaultEncoding];
|
||||||
|
if (s == nil && _defaultEncoding != NSUTF8StringEncoding)
|
||||||
|
{
|
||||||
|
s = [s initWithBytes: beg
|
||||||
|
length: dst - beg
|
||||||
|
encoding: NSUTF8StringEncoding];
|
||||||
|
}
|
||||||
|
}
|
||||||
[hdr appendString: s];
|
[hdr appendString: s];
|
||||||
RELEASE(s);
|
RELEASE(s);
|
||||||
dst = beg;
|
dst = beg;
|
||||||
|
@ -2249,7 +2266,7 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
||||||
*src = '\0';
|
*src = '\0';
|
||||||
|
|
||||||
s = [NSStringClass allocWithZone: NSDefaultMallocZone()];
|
s = [NSStringClass allocWithZone: NSDefaultMallocZone()];
|
||||||
s = [s initWithCString: (const char *)tmp];
|
s = [s initWithUTF8String: (const char *)tmp];
|
||||||
enc = [documentClass encodingFromCharset: s];
|
enc = [documentClass encodingFromCharset: s];
|
||||||
RELEASE(s);
|
RELEASE(s);
|
||||||
|
|
||||||
|
@ -2322,6 +2339,18 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
||||||
s = [s initWithBytes: beg
|
s = [s initWithBytes: beg
|
||||||
length: dst - beg
|
length: dst - beg
|
||||||
encoding: NSASCIIStringEncoding];
|
encoding: NSASCIIStringEncoding];
|
||||||
|
if (s == nil && _defaultEncoding != NSASCIIStringEncoding)
|
||||||
|
{
|
||||||
|
s = [s initWithBytes: beg
|
||||||
|
length: dst - beg
|
||||||
|
encoding: _defaultEncoding];
|
||||||
|
if (s == nil && _defaultEncoding != NSUTF8StringEncoding)
|
||||||
|
{
|
||||||
|
s = [s initWithBytes: beg
|
||||||
|
length: dst - beg
|
||||||
|
encoding: NSUTF8StringEncoding];
|
||||||
|
}
|
||||||
|
}
|
||||||
[hdr appendString: s];
|
[hdr appendString: s];
|
||||||
RELEASE(s);
|
RELEASE(s);
|
||||||
dst = beg;
|
dst = beg;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue