mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-27 18:50:47 +00:00
Minor multipart generation fix.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@16327 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
375795ad52
commit
767fca7914
2 changed files with 38 additions and 15 deletions
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
* Source/Additions/GSXML.m: ([-content]) fix to produce string
|
* Source/Additions/GSXML.m: ([-content]) fix to produce string
|
||||||
content of elements rather than just text nodes.
|
content of elements rather than just text nodes.
|
||||||
|
* Source/GSMime.m: ([-rawMimeData]) ensure that the transfer encoding
|
||||||
|
of a multipart document is 8bit if any of its constituent parts are
|
||||||
|
not 7bit
|
||||||
|
|
||||||
22003-04-01 Richard Frith-Macdonald <rfm@gnu.org>
|
22003-04-01 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
|
|
@ -760,7 +760,7 @@ wordData(NSString *word)
|
||||||
if (dData == nil || [con isKindOfClass: [GSMimeCodingContext class]] == NO)
|
if (dData == nil || [con isKindOfClass: [GSMimeCodingContext class]] == NO)
|
||||||
{
|
{
|
||||||
[NSException raise: NSInvalidArgumentException
|
[NSException raise: NSInvalidArgumentException
|
||||||
format: @"[%@ -%@:] bad destination data for decode",
|
format: @"[%@ -%@] bad destination data for decode",
|
||||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
|
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
|
||||||
}
|
}
|
||||||
GS_RANGE_CHECK(aRange, len);
|
GS_RANGE_CHECK(aRange, len);
|
||||||
|
@ -3283,7 +3283,7 @@ static NSCharacterSet *tokenSet = nil;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[NSException raise: NSInvalidArgumentException
|
[NSException raise: NSInvalidArgumentException
|
||||||
format: @"[%@ -%@:] passed bad content",
|
format: @"[%@ -%@] passed bad content",
|
||||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
|
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3310,7 +3310,7 @@ static NSCharacterSet *tokenSet = nil;
|
||||||
if (name == nil || [name isEqual: @"unknown"] == YES)
|
if (name == nil || [name isEqual: @"unknown"] == YES)
|
||||||
{
|
{
|
||||||
[NSException raise: NSInvalidArgumentException
|
[NSException raise: NSInvalidArgumentException
|
||||||
format: @"[%@ -%@:] header with invalid name",
|
format: @"[%@ -%@] header with invalid name",
|
||||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
|
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
|
||||||
}
|
}
|
||||||
if ([name isEqualToString: @"mime-version"] == YES
|
if ([name isEqualToString: @"mime-version"] == YES
|
||||||
|
@ -3867,6 +3867,22 @@ static NSCharacterSet *tokenSet = nil;
|
||||||
GSMimeDocument *part = [content objectAtIndex: i];
|
GSMimeDocument *part = [content objectAtIndex: i];
|
||||||
|
|
||||||
[partData addObject: [part rawMimeData: NO]];
|
[partData addObject: [part rawMimeData: NO]];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If any part of a multipart document is not 7bit then
|
||||||
|
* the document as a whole must not be 7bit either.
|
||||||
|
*/
|
||||||
|
if (is7bit == YES)
|
||||||
|
{
|
||||||
|
NSString *v;
|
||||||
|
|
||||||
|
enc = [part headerNamed: @"content-transfer-encoding"];
|
||||||
|
v = [enc value];
|
||||||
|
if ([v isEqual: @"7bit"] == NO)
|
||||||
|
{
|
||||||
|
is7bit = NO;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3893,7 +3909,7 @@ static NSCharacterSet *tokenSet = nil;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[NSException raise: NSInternalInconsistencyException
|
[NSException raise: NSInternalInconsistencyException
|
||||||
format: @"[%@ -%@:] with bad content",
|
format: @"[%@ -%@] with bad content",
|
||||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
|
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
|
||||||
}
|
}
|
||||||
type = [self headerNamed: @"content-type"];
|
type = [self headerNamed: @"content-type"];
|
||||||
|
@ -3904,25 +3920,29 @@ static NSCharacterSet *tokenSet = nil;
|
||||||
NSString *v;
|
NSString *v;
|
||||||
|
|
||||||
enc = [self headerNamed: @"content-transfer-encoding"];
|
enc = [self headerNamed: @"content-transfer-encoding"];
|
||||||
|
v = [enc value];
|
||||||
|
if (is7bit == NO && [v isEqual: @"7bit"] == YES)
|
||||||
|
{
|
||||||
|
enc = nil; // Force a reset from 7bit to 8bit
|
||||||
|
}
|
||||||
if (enc == nil)
|
if (enc == nil)
|
||||||
{
|
{
|
||||||
enc = [GSMimeHeader alloc];
|
enc = [GSMimeHeader alloc];
|
||||||
enc = [enc initWithName: @"content-transfer-encoding"
|
enc = [enc initWithName: @"content-transfer-encoding"
|
||||||
value: @"7bit"
|
value: ((is7bit == YES) ? @"7bit" : @"8bit")
|
||||||
parameters: nil];
|
parameters: nil];
|
||||||
[self addHeader: enc];
|
[self setHeader: enc];
|
||||||
RELEASE(enc);
|
RELEASE(enc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
v = [enc value];
|
if ([v isEqual: @"7bit"] == NO
|
||||||
if ((is7bit = [v isEqual: @"7bit"]) == NO
|
&& [v isEqual: @"8bit"] == NO
|
||||||
&& [v isEqual: @"8bit"] == NO && [v isEqual: @"binary"] == NO)
|
&& [v isEqual: @"binary"] == NO)
|
||||||
{
|
{
|
||||||
[NSException raise: NSInternalInconsistencyException
|
[NSException raise: NSInternalInconsistencyException
|
||||||
format: @"[%@ -%@:] %@ illegal for multipart",
|
format: @"[%@ -%@] %@ illegal for multipart",
|
||||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd),
|
NSStringFromClass([self class]), NSStringFromSelector(_cmd), v];
|
||||||
v];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
v = [type parameterForKey: @"boundary"];
|
v = [type parameterForKey: @"boundary"];
|
||||||
|
@ -4040,7 +4060,7 @@ static NSCharacterSet *tokenSet = nil;
|
||||||
if (v != nil && ([v isEqual: @"8bit"] || [v isEqual: @"binary"]))
|
if (v != nil && ([v isEqual: @"8bit"] || [v isEqual: @"binary"]))
|
||||||
{
|
{
|
||||||
[NSException raise: NSInternalInconsistencyException
|
[NSException raise: NSInternalInconsistencyException
|
||||||
format: @"[%@ -%@:] bad part encoding for 7bit container",
|
format: @"[%@ -%@] bad part encoding for 7bit container",
|
||||||
NSStringFromClass([self class]),
|
NSStringFromClass([self class]),
|
||||||
NSStringFromSelector(_cmd)];
|
NSStringFromSelector(_cmd)];
|
||||||
}
|
}
|
||||||
|
@ -4122,7 +4142,7 @@ static NSCharacterSet *tokenSet = nil;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[NSException raise: NSInvalidArgumentException
|
[NSException raise: NSInvalidArgumentException
|
||||||
format: @"[%@ -%@:] passed bad content",
|
format: @"[%@ -%@] passed bad content",
|
||||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
|
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4231,7 +4251,7 @@ static NSCharacterSet *tokenSet = nil;
|
||||||
&& [content isKindOfClass: [NSArray class]] == YES)
|
&& [content isKindOfClass: [NSArray class]] == YES)
|
||||||
{
|
{
|
||||||
[NSException raise: NSInvalidArgumentException
|
[NSException raise: NSInvalidArgumentException
|
||||||
format: @"[%@ -%@:] content doesn't match content-type",
|
format: @"[%@ -%@] content doesn't match content-type",
|
||||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
|
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue