nsMIMEHeaderParamImpl.cpp
Interaktion und PortierbarkeitC
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set sw=2 ts=8 et tw=80 : */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
static nsresult ConvertStringToUTF8(const nsACString& aString, const nsACString& aCharset, bool aSkipCheck, bool aAllowSubstitution,
nsACString& aUTF8String) { // return if ASCII only or valid UTF-8 providing that the ASCII/UTF-8 // check is requested. It may not be asked for if a caller suspects // that the input is in non-ASCII 7bit charset (ISO-2022-xx, HZ) or // it's in a charset other than UTF-8 that can be mistaken for UTF-8. if (!aSkipCheck && (IsAscii(aString) || IsUtf8(aString))) {
aUTF8String = aString; return NS_OK;
}
// additional protection for cases where check is skipped and the input // is actually in UTF-8 as opposed to aCharset. (i.e. caller's hunch // was wrong.) We don't check ASCIIness assuming there's no charset // incompatible with ASCII (we don't support EBCDIC). if (aSkipCheck && NS_FAILED(rv) && IsUtf8(aString)) {
aUTF8String = aString; return NS_OK;
}
return rv;
}
// XXX The chance of UTF-7 being used in the message header is really // low, but in theory it's possible. #define IS_7BIT_NON_ASCII_CHARSET(cset) \
(!nsCRT::strncasecmp((cset), "ISO-2022", 8) || \
!nsCRT::strncasecmp((cset), "HZ-GB", 5) || \
!nsCRT::strncasecmp((cset), "UTF-7", 5))
if (FindCharInReadable(L'\0', first, end)) { while (first != end) { if (*first != '\0') { // contains trailing characters past the null character returntrue;
}
++first;
}
} returnfalse;
}
// get parameter (decode RFC 2231/5987 when applicable, as specified by // aDecoding (5987 being a subset of 2231) and return charset.)
nsCString med;
nsCString charset;
rv = DoParameterInternal(aHeaderVal, aParamName, aDecoding,
getter_Copies(charset), aLang, getter_Copies(med)); if (NS_FAILED(rv)) return rv;
// convert to UTF-8 after charset conversion and RFC 2047 decoding // if necessary.
// combine segments into a single string, returning the allocated string // (or nullptr) while emptying the list char* combineContinuations(nsTArray<Continuation>& aArray) { // Sanity check if (aArray.Length() == 0) return nullptr;
// Get an upper bound for the length
uint32_t length = 0; for (uint32_t i = 0; i < aArray.Length(); i++) {
length += aArray[i].length;
}
// Allocate char* result = (char*)moz_xmalloc(length + 1);
// Concatenate
*result = '\0';
for (uint32_t i = 0; i < aArray.Length(); i++) {
Continuation cont = aArray[i]; if (!cont.value) break;
char* c = result + strlen(result);
strncat(result, cont.value, cont.length); if (cont.needsPercentDecoding) {
nsUnescape(c);
} if (cont.wasQuotedString) {
RemoveQuotedStringEscapes(c);
}
}
// return null if empty value if (*result == '\0') {
free(result);
result = nullptr;
}
return result;
}
// add a continuation, return false on error if segment already has been seen bool addContinuation(nsTArray<Continuation>& aArray, uint32_t aIndex, constchar* aValue, uint32_t aLength, bool aNeedsPercentDecoding, bool aWasQuotedString) { if (aIndex < aArray.Length() && aArray[aIndex].value) {
NS_WARNING("duplicate RC2231 continuation segment #\n"); returnfalse;
}
if (aNeedsPercentDecoding && aWasQuotedString) {
NS_WARNING( "RC2231 continuation segment can't use percent encoding and quoted " "string form at the same time\n"); returnfalse;
}
// validate a given octet sequence for compliance with the specified // encoding bool IsValidOctetSequenceForCharset(const nsACString& aCharset, constchar* aOctets) {
nsAutoCString tmpRaw;
tmpRaw.Assign(aOctets);
nsAutoCString tmpDecoded;
if (rv != NS_OK) { // we can't decode; charset may be unsupported, or the octet sequence // is broken (illegal or incomplete octet sequence contained)
NS_WARNING( "RFC2231/5987 parameter value does not decode according to specified " "charset\n"); returnfalse;
}
returntrue;
}
// moved almost verbatim from mimehdrs.cpp // char * // MimeHeaders_get_parameter (const char *header_value, const char *parm_name, // char **charset, char **language) // // The format of these header lines is // <token> [ ';' <token> '=' <token-or-quoted-string> ]*
NS_IMETHODIMP
nsMIMEHeaderParamImpl::GetParameterInternal(const nsACString& aHeaderValue, constchar* aParamName, char** aCharset, char** aLang, char** aResult) { return DoParameterInternal(aHeaderValue, aParamName, MIME_FIELD_ENCODING,
aCharset, aLang, aResult);
}
if (aCharset) *aCharset = nullptr; if (aLang) *aLang = nullptr;
nsAutoCString charset;
// change to (aDecoding != HTTP_FIELD_ENCODING) when we want to disable // them for HTTP header fields later on, see bug 776324 bool acceptContinuations = true;
// skip leading white space. for (; *str && nsCRT::IsAsciiSpace(*str); ++str) {
;
} constchar* start = str;
// aParamName is empty. return the first (possibly) _unnamed_ 'parameter' // For instance, return 'inline' in the following case: // Content-Disposition: inline; filename=..... if (!aParamName || !*aParamName) { for (; *str && *str != ';' && !nsCRT::IsAsciiSpace(*str); ++str) {
;
} if (str == start) return NS_ERROR_FIRST_HEADER_FIELD_COMPONENT_EMPTY;
/* Skip forward to first ';' */ for (; *str && *str != ';' && *str != ','; ++str) {
;
} if (*str) str++; /* Skip over following whitespace */ for (; *str && nsCRT::IsAsciiSpace(*str); ++str) {
;
}
// Some broken http servers just specify parameters // like 'filename' without specifying disposition // method. Rewind to the first non-white-space // character.
if (!*str) str = start;
// RFC2231 - The legitimate parm format can be: // A. title=ThisIsTitle // B. title*=us-ascii'en-us'This%20is%20wierd. // C. title*0*=us-ascii'en'This%20is%20wierd.%20We // title*1*=have%20to%20support%20this. // title*2="Else..." // D. title*0="Hey, what you think you are doing?" // title*1="There is no charset and lang info." // RFC5987: only A and B
// collect results for the different algorithms (plain filename, // RFC5987/2231-encoded filename, + continuations) separately and decide // which to use at the end char* caseAResult = nullptr; char* caseBResult = nullptr; char* caseCDResult = nullptr;
NS_ASSERTION(!nsCRT::IsAsciiSpace(*str), "should be after whitespace.");
// Skip forward to the end of this token. for (; *str && !nsCRT::IsAsciiSpace(*str) && *str != '=' && *str != ';';
str++) {
;
}
nameEnd = str;
int32_t nameLen = nameEnd - nameStart;
// Skip over whitespace, '=', and whitespace while (nsCRT::IsAsciiSpace(*str)) ++str; if (!*str) { break;
} if (*str != '=') { // don't accept parameters without "=" goto increment_str;
} // Skip over '=' only if it was actually there
str++; while (nsCRT::IsAsciiSpace(*str)) ++str;
if (*str != '"') { // The value is a token, not a quoted string.
valueStart = str; for (valueEnd = str; *valueEnd && *valueEnd != ';'; valueEnd++) {
;
} // ignore trailing whitespace: while (valueEnd > valueStart && nsCRT::IsAsciiSpace(*(valueEnd - 1))) {
valueEnd--;
}
str = valueEnd;
} else {
isQuotedString = true;
++str;
valueStart = str; for (valueEnd = str; *valueEnd; ++valueEnd) { if (*valueEnd == '\\' && *(valueEnd + 1)) {
++valueEnd;
} elseif (*valueEnd == '"') { break;
}
}
str = valueEnd; // *valueEnd != null means that *valueEnd is quote character. if (*valueEnd) str++;
}
// See if this is the simplest case (case A above), // a 'single' line value with no charset and lang. // If so, copy it and return. if (nameLen == paramLen &&
!nsCRT::strncasecmp(nameStart, aParamName, paramLen)) { if (caseAResult) { // we already have one caseA result, ignore subsequent ones goto increment_str;
}
// if the parameter spans across multiple lines we have to strip out the // line continuation -- jht 4/29/98
nsAutoCString tempStr(valueStart, valueEnd - valueStart);
tempStr.StripCRLF(); char* res = ToNewCString(tempStr, mozilla::fallible);
NS_ENSURE_TRUE(res, NS_ERROR_OUT_OF_MEMORY);
if (isQuotedString) RemoveQuotedStringEscapes(res);
caseAResult = res; // keep going, we may find a RFC 2231/5987 encoded alternative
} // case B, C, and D elseif (nameLen > paramLen &&
!nsCRT::strncasecmp(nameStart, aParamName, paramLen) &&
*(nameStart + paramLen) == '*') { // 1st char past '*' constchar* cp = nameStart + paramLen + 1;
// if param name ends in "*" we need do to RFC5987 "ext-value" decoding bool needExtDecoding = *(nameEnd - 1) == '*';
// CaseB and start of CaseC: requires charset and optional language // in quotes (quotes required even if lang is blank) if (caseB || (caseCStart && acceptContinuations)) { // look for single quotation mark(') constchar* sQuote1 = strchr(valueStart, 0x27); constchar* sQuote2 = sQuote1 ? strchr(sQuote1 + 1, 0x27) : nullptr;
// Two single quotation marks must be present even in // absence of charset and lang. if (!sQuote1 || !sQuote2) {
NS_WARNING( "Mandatory two single quotes are missing in header parameter\n");
}
if (langLength != 0) {
lang.Assign(langStart, langLength);
}
// keep the charset for later if (caseB) {
charsetB.Assign(charsetStart, charsetLength);
} else { // if caseCorD
charsetCD.Assign(charsetStart, charsetLength);
}
// non-empty value part if (rawValLength > 0) { if (!caseBResult && caseB) { if (!IsValidPercentEscaped(rawValStart, rawValLength)) { goto increment_str;
}
// allocate buffer for the raw value char* tmpResult = (char*)moz_xmemdup(rawValStart, rawValLength + 1);
*(tmpResult + rawValLength) = 0;
if (!added) { // continuation not added, stop processing them
acceptContinuations = false;
}
}
}
} // end of if-block : title*0*= or title*= // caseD: a line of multiline param with no need for unescaping : // title*[0-9]= or 2nd or later lines of a caseC param : title*[1-9]*= elseif (acceptContinuations && segmentNumber != -1) {
uint32_t valueLength = valueEnd - valueStart;
if (!added) { // continuation not added, stop processing them
acceptContinuations = false;
}
} // end of if-block : title*[0-9]= or title*[1-9]*=
}
// str now points after the end of the value. // skip over whitespace, ';', whitespace.
increment_str: while (nsCRT::IsAsciiSpace(*str)) ++str; if (*str == ';') {
++str;
} else { // stop processing the header field; either we are done or the // separator was missing break;
} while (nsCRT::IsAsciiSpace(*str)) ++str;
}
caseCDResult = combineContinuations(segments);
if (caseBResult && !charsetB.IsEmpty()) { // check that the 2231/5987 result decodes properly given the // specified character set if (!IsValidOctetSequenceForCharset(charsetB, caseBResult)) {
free(caseBResult);
caseBResult = nullptr;
}
}
if (caseCDResult && !charsetCD.IsEmpty()) { // check that the 2231/5987 result decodes properly given the // specified character set if (!IsValidOctetSequenceForCharset(charsetCD, caseCDResult)) {
free(caseCDResult);
caseCDResult = nullptr;
}
}
if (caseBResult) { // prefer simple 5987 format over 2231 with continuations
*aResult = caseBResult;
caseBResult = nullptr;
charset.Assign(charsetB);
} elseif (caseCDResult) { // prefer 2231/5987 with or without continuations over plain format
*aResult = caseCDResult;
caseCDResult = nullptr;
charset.Assign(charsetCD);
} elseif (caseAResult) {
*aResult = caseAResult;
caseAResult = nullptr;
}
// if we have a result if (*aResult) { // then return charset and lang as well if (aLang && !lang.IsEmpty()) {
uint32_t len = lang.Length();
*aLang = (char*)moz_xmemdup(lang.BeginReading(), len + 1);
*(*aLang + len) = 0;
} if (aCharset && !charset.IsEmpty()) {
uint32_t len = charset.Length();
*aCharset = (char*)moz_xmemdup(charset.BeginReading(), len + 1);
*(*aCharset + len) = 0;
}
}
// true if the character is allowed in a RFC 5987 value // see RFC 5987, Section 3.2.1, "attr-char" bool IsRFC5987AttrChar(char aChar) { char c = aChar;
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
(c >= '0' && c <= '9') ||
(c == '!' || c == '#' || c == '$' || c == '&' || c == '+' ||
c == '-' || c == '.' || c == '^' || c == '_' || c == '`' ||
c == '|' || c == '~');
}
// percent-decode a value // returns false on failure bool PercentDecode(nsACString& aValue) { char* c = (char*)moz_xmalloc(aValue.Length() + 1);
if (tc == '\'') { // single quote
delimiters++;
} elseif (((unsignedchar)tc) >= 128) { // fail early, not ASCII
NS_WARNING("non-US-ASCII character in RFC5987-encoded param"); return NS_ERROR_INVALID_ARG;
} else { if (delimiters == 0) { // valid characters are checked later implicitly
charset.Append(tc);
} elseif (delimiters == 1) { // no value checking for now
language.Append(tc);
} elseif (delimiters == 2) { if (IsRFC5987AttrChar(tc)) {
value.Append(tc);
} elseif (tc == '%') { if (!IsHexDigit(c[0]) || !IsHexDigit(c[1])) { // we expect two more characters
NS_WARNING("broken %-escape in RFC5987-encoded param"); return NS_ERROR_INVALID_ARG;
}
value.Append(tc); // we consume two more
value.Append(*c++);
value.Append(*c++);
} else { // character not allowed here
NS_WARNING("invalid character in RFC5987-encoded param"); return NS_ERROR_INVALID_ARG;
}
}
}
}
if (delimiters != 2) {
NS_WARNING("missing delimiters in RFC5987-encoded param"); return NS_ERROR_INVALID_ARG;
}
// abort early for unsupported encodings if (!charset.LowerCaseEqualsLiteral("utf-8")) {
NS_WARNING("unsupported charset in RFC5987-encoded param"); return NS_ERROR_INVALID_ARG;
}
// percent-decode if (!PercentDecode(value)) { return NS_ERROR_OUT_OF_MEMORY;
}
// return the encoding
aLang.Assign(language);
// finally convert octet sequence to UTF-8 and be done
nsAutoCString utf8;
nsresult rv = ConvertStringToUTF8(value, charset, true, false, utf8);
NS_ENSURE_SUCCESS(rv, rv);
CopyUTF8toUTF16(utf8, aResult); return NS_OK;
}
nsresult internalDecodeParameter(const nsACString& aParamValue, const nsACString& aCharset, const nsACString& aDefaultCharset, bool aOverrideCharset, bool aDecode2047,
nsACString& aResult) {
aResult.Truncate(); // If aCharset is given, aParamValue was obtained from RFC2231/5987 // encoding and we're pretty sure that it's in aCharset. if (!aCharset.IsEmpty()) { return ConvertStringToUTF8(aParamValue, aCharset, true, true, aResult);
}
// strip '\' when used to quote CR, LF, '"' and '\' for (; s != e; ++s) { if ((*s == '\\')) { if (++s == e) {
--s; // '\' is at the end. move back and append '\'.
} elseif (*s != nsCRT::CR && *s != nsCRT::LF && *s != '"' &&
*s != '\\') {
--s; // '\' is not foll. by CR,LF,'"','\'. move back and append '\'
} // else : skip '\' and append the quoted character.
}
unQuoted.Append(*s);
}
out = dest = (char*)calloc(length + 1, sizeof(char)); if (dest == nullptr) return nullptr; while (length > 0) { unsigned c = 0; switch (*in) { case'=': // check if |in| in the form of '=hh' where h is [0-9a-fA-F]. if (length < 3 || !ISHEXCHAR(in[1]) || !ISHEXCHAR(in[2])) { goto badsyntax;
}
PR_sscanf(in + 1, "%2X", &c);
*out++ = (char)c;
in += 3;
length -= 3; break;
for (out = dest; *out; ++out) { if (*out == '\t') *out = ' ';
}
return dest;
badsyntax:
free(dest); return nullptr;
}
// check if input is HZ (a 7bit encoding for simplified Chinese : RFC 1842)) // or has ESC which may be an indication that it's in one of many ISO // 2022 7bit encodings (e.g. ISO-2022-JP(-2)/CN : see RFC 1468, 1922, 1554). // static bool Is7bitNonAsciiString(constchar* input, uint32_t len) {
int32_t c;
enum {
hz_initial, // No HZ seen yet
hz_escaped, // Inside an HZ ~{ escape sequence
hz_seen, // Have seen at least one complete HZ sequence
hz_notpresent // Have seen something that is not legal HZ
} hz_state;
hz_state = hz_initial; while (len) {
c = uint8_t(*input++);
len--; if (c & 0x80) returnfalse; if (c == 0x1B) returntrue; if (c == '~') { switch (hz_state) { case hz_initial: case hz_seen: if (*input == '{') {
hz_state = hz_escaped;
} elseif (*input == '~') { // ~~ is the HZ encoding of ~. Skip over second ~ as well
hz_state = hz_seen;
input++;
len--;
} else {
hz_state = hz_notpresent;
} break;
case hz_escaped: if (*input == '}') hz_state = hz_seen; break; default: break;
}
}
} return hz_state == hz_seen;
}
#define REPLACEMENT_CHAR "\357\277\275"// EF BF BD (UTF-8 encoding of U+FFFD)
// copy 'raw' sequences of octets in aInput to aOutput. // If aDefaultCharset is specified, the input is assumed to be in the // charset and converted to UTF-8. Otherwise, a blind copy is made. // If aDefaultCharset is specified, but the conversion to UTF-8 // is not successful, each octet is replaced by Unicode replacement // chars. *aOutput is advanced by the number of output octets. // static void CopyRawHeader(constchar* aInput, uint32_t aLen, const nsACString& aDefaultCharset, nsACString& aOutput) {
int32_t c;
// If aDefaultCharset is not specified, make a blind copy. if (aDefaultCharset.IsEmpty()) {
aOutput.Append(aInput, aLen); return;
}
// Copy as long as it's US-ASCII. An ESC may indicate ISO 2022 // A ~ may indicate it is HZ while (aLen && (c = uint8_t(*aInput++)) != 0x1B && c != '~' && !(c & 0x80)) {
aOutput.Append(char(c));
aLen--;
} if (!aLen) { return;
}
aInput--;
// skip ASCIIness/UTF8ness test if aInput is supected to be a 7bit non-ascii // string and aDefaultCharset is a 7bit non-ascii charset. bool skipCheck =
(c == 0x1B || c == '~') &&
IS_7BIT_NON_ASCII_CHARSET(PromiseFlatCString(aDefaultCharset).get());
// If not UTF-8, treat as default charset
nsAutoCString utf8Text; if (NS_SUCCEEDED(ConvertStringToUTF8(Substring(aInput, aInput + aLen),
PromiseFlatCString(aDefaultCharset),
skipCheck, true, utf8Text))) {
aOutput.Append(utf8Text);
} else { // replace each octet with Unicode replacement char in UTF-8. for (uint32_t i = 0; i < aLen; i++) {
c = uint8_t(*aInput++); if (c & 0x80) {
aOutput.Append(REPLACEMENT_CHAR);
} else {
aOutput.Append(char(c));
}
}
}
}
// |decode_mime_part2_str| taken from comi18n.c // Decode RFC2047-encoded words in the input and convert the result to UTF-8. // If aOverrideCharset is true, charset in RFC2047-encoded words is // ignored and aDefaultCharset is assumed, instead. aDefaultCharset // is also used to convert raw octets (without RFC 2047 encoding) to UTF-8. // static
nsresult DecodeRFC2047Str(constchar* aHeader, const nsACString& aDefaultCharset, bool aOverrideCharset, nsACString& aResult) { constchar *p, *q = nullptr, *r; constchar* begin; // tracking pointer for where we are in the input buffer
int32_t isLastEncodedWord = 0; constchar *charsetStart, *charsetEnd;
nsAutoCString prevCharset, curCharset;
nsAutoCString encodedText; char prevEncoding = '\0', curEncoding;
nsresult rv;
begin = aHeader;
// To avoid buffer realloc, if possible, set capacity in advance. No // matter what, more than 3x expansion can never happen for all charsets // supported by Mozilla. SCSU/BCSU with the sliding window set to a // non-BMP block may be exceptions, but Mozilla does not support them. // Neither any known mail/news program use them. Even if there's, we're // safe because we don't use a raw *char any more.
aResult.SetCapacity(3 * strlen(aHeader));
while ((p = strstr(begin, "=?")) != nullptr) { if (isLastEncodedWord) { // See if it's all whitespace. for (q = begin; q < p; ++q) { if (!strchr(" \t\r\n", *q)) { break;
}
}
}
if (!isLastEncodedWord || q < p) { if (!encodedText.IsEmpty()) {
rv = DecodeQOrBase64Str(encodedText.get(), encodedText.Length(),
prevEncoding, prevCharset, aResult); if (NS_FAILED(rv)) {
aResult.Append(encodedText);
}
encodedText.Truncate();
prevCharset.Truncate();
prevEncoding = '\0';
} // copy the part before the encoded-word
CopyRawHeader(begin, p - begin, aDefaultCharset, aResult);
begin = p;
}
p += 2;
// Get charset info
charsetStart = p;
charsetEnd = nullptr; for (q = p; *q != '?'; q++) { if (*q <= ' ' || strchr(especials, *q)) { goto badsyntax;
}
// loop-wise, keep going until we hit "?=". the inner check handles the // nul terminator should the string terminate before we hit the right // marker. (And the r[1] will never reach beyond the end of the string // because *r != '?' is true if r is the nul character.) for (r = q + 2; *r != '?' || r[1] != '='; r++) { if (*r < ' ') goto badsyntax;
} if (r == q + 2) { // it's empty, skip
begin = r + 2;
isLastEncodedWord = 1; continue;
}
curCharset.Assign(charsetStart, charsetEnd - charsetStart); // Override charset if requested. Never override labeled UTF-8. // Use default charset instead of UNKNOWN-8BIT if ((aOverrideCharset &&
0 != nsCRT::strcasecmp(curCharset.get(), "UTF-8")) ||
(!aDefaultCharset.IsEmpty() &&
0 == nsCRT::strcasecmp(curCharset.get(), "UNKNOWN-8BIT"))) {
curCharset = aDefaultCharset;
}
constchar* R;
R = r; if (curEncoding == 'B') { // bug 227290. ignore an extraneous '=' at the end. // (# of characters in B-encoded part has to be a multiple of 4)
int32_t n = r - (q + 2);
R -= (n % 4 == 1 && !strncmp(r - 3, "===", 3)) ? 1 : 0;
} // Bug 493544. Don't decode the encoded text until it ends if (R[-1] != '=' &&
(prevCharset.IsEmpty() ||
(curCharset == prevCharset && curEncoding == prevEncoding))) {
encodedText.Append(q + 2, R - (q + 2));
prevCharset = curCharset;
prevEncoding = curEncoding;
begin = r + 2;
isLastEncodedWord = 1; continue;
}
bool bDecoded; // If the current line has been decoded.
bDecoded = false; if (!encodedText.IsEmpty()) { if (curCharset == prevCharset && curEncoding == prevEncoding) {
encodedText.Append(q + 2, R - (q + 2));
bDecoded = true;
}
rv = DecodeQOrBase64Str(encodedText.get(), encodedText.Length(),
prevEncoding, prevCharset, aResult); if (NS_FAILED(rv)) {
aResult.Append(encodedText);
}
encodedText.Truncate();
prevCharset.Truncate();
prevEncoding = '\0';
} if (!bDecoded) {
rv = DecodeQOrBase64Str(q + 2, R - (q + 2), curEncoding, curCharset,
aResult); if (NS_FAILED(rv)) {
aResult.Append(encodedText);
}
}
begin = r + 2;
isLastEncodedWord = 1; continue;
badsyntax: if (!encodedText.IsEmpty()) {
rv = DecodeQOrBase64Str(encodedText.get(), encodedText.Length(),
prevEncoding, prevCharset, aResult); if (NS_FAILED(rv)) {
aResult.Append(encodedText);
}
encodedText.Truncate();
prevCharset.Truncate();
} // copy the part before the encoded-word
aResult.Append(begin, p - begin);
begin = p;
isLastEncodedWord = 0;
}
if (!encodedText.IsEmpty()) {
rv = DecodeQOrBase64Str(encodedText.get(), encodedText.Length(),
prevEncoding, prevCharset, aResult); if (NS_FAILED(rv)) {
aResult.Append(encodedText);
}
}
// put the tail back
CopyRawHeader(begin, strlen(begin), aDefaultCharset, aResult);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.