mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Support x-uuencode content transfer encoding
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@18627 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9143d25ab2
commit
60183f8649
2 changed files with 39 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
2004-02-19 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/Additions/GSMime.m: added a couple of uuencoding methods.
|
||||
Integrated (crudely) uuencoding/uudecoding support based on x-uuencode
|
||||
|
||||
2004-02-18 David Ayers <d.ayers@inode.at>
|
||||
|
||||
|
|
|
@ -574,6 +574,27 @@ wordData(NSString *word)
|
|||
}
|
||||
@end
|
||||
|
||||
/**
|
||||
* Inefficient ... copies data into output object and only performs
|
||||
* the actual decoding at the end.
|
||||
*/
|
||||
@interface GSMimeUUCodingContext : GSMimeCodingContext
|
||||
@end
|
||||
|
||||
@implementation GSMimeUUCodingContext
|
||||
- (BOOL) decodeData: (const void*)sData
|
||||
length: (unsigned)length
|
||||
intoData: (NSMutableData*)dData
|
||||
{
|
||||
[super decodeData: sData length: length intoData: dData];
|
||||
|
||||
if ([self atEnd] == YES)
|
||||
{
|
||||
[dData setData: [GSMimeDocument decode: dData UUName: 0]];
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@interface GSMimeParser (Private)
|
||||
|
@ -649,6 +670,7 @@ wordData(NSString *word)
|
|||
* <item>7bit (no coding actually performed)</item>
|
||||
* <item>8bit (no coding actually performed)</item>
|
||||
* <item>chunked (for HTTP/1.1)</item>
|
||||
* <item>x-uuencode</item>
|
||||
* </list>
|
||||
* To add new coding schemes to the parser, you need to ovrride
|
||||
* this method to return a new coding context for your scheme
|
||||
|
@ -698,6 +720,10 @@ wordData(NSString *word)
|
|||
{
|
||||
return AUTORELEASE([GSMimeChunkedDecoderContext new]);
|
||||
}
|
||||
else if ([value isEqualToString: @"x-uuencode"] == YES)
|
||||
{
|
||||
return AUTORELEASE([GSMimeUUCodingContext new]);
|
||||
}
|
||||
}
|
||||
|
||||
NSLog(@"contextFor: - unknown header (%@) ... assumed binary encoding", name);
|
||||
|
@ -4601,6 +4627,18 @@ static NSCharacterSet *tokenSet = nil;
|
|||
}
|
||||
[md appendBytes: &ptr[pos] length: len-pos];
|
||||
}
|
||||
else if ([[enc value] isEqualToString: @"x-uuencode"] == YES)
|
||||
{
|
||||
NSString *name;
|
||||
|
||||
name = [[self headerNamed: @"content-type"] parameterForKey: @"name"];
|
||||
if (name == nil)
|
||||
{
|
||||
name = @"data";
|
||||
}
|
||||
d = [GSMimeDocument encode: d UUName: name];
|
||||
[md appendData: d];
|
||||
}
|
||||
else
|
||||
{
|
||||
[md appendData: d];
|
||||
|
|
Loading…
Reference in a new issue