Fix for bug 128888. Do not emit a MIME header for a message/rfc822 part. Also fix bogus partNum string extraction. R=bienvenu, SR=mscott, A=asa

This commit is contained in:
ducarroz%netscape.com 2002-03-19 21:56:22 +00:00
parent 2863ac5493
commit 8b21a292e9
2 changed files with 6 additions and 4 deletions

View File

@ -289,8 +289,7 @@ PRInt32 nsIMAPBodyShell::Generate(char *partNum)
if (!GetPseudoInterrupted() && !DeathSignalReceived())
{
nsresult rv =
m_protocolConnection->BeginMessageDownLoad(contentLength,
MESSAGE_RFC822);
m_protocolConnection->BeginMessageDownLoad(contentLength, MESSAGE_RFC822);
if (NS_FAILED(rv))
{
m_generatingPart = nsnull;
@ -1040,6 +1039,8 @@ PRInt32 nsIMAPBodypartMessage::Generate(PRBool stream, PRBool prefetch)
if (!m_topLevelMessage && !m_shell->GetPseudoInterrupted()) // not the top-level message - we need the MIME header as well as the message header
{
// but we don't need the MIME header of a message/rfc822 part!
if (PL_strcasecmp(m_bodyType, "message") || PL_strcasecmp(m_bodySubType, "rfc822"))
m_contentLength += GenerateMIMEHeader(stream, prefetch);
}

View File

@ -1090,10 +1090,11 @@ void nsImapServerResponseParser::msg_fetch()
char *startPartNum = fNextToken + 5;
if (whereHeader > startPartNum)
{
char *partNum = (char *)PR_CALLOC((whereHeader - startPartNum) * sizeof (char));
PRInt32 partLength = whereHeader - startPartNum - 1; //-1 for the dot!
char *partNum = (char *)PR_CALLOC((partLength + 1) * sizeof (char));
if (partNum)
{
PL_strncpy(partNum, startPartNum, (whereHeader - startPartNum));
PL_strncpy(partNum, startPartNum, partLength);
if (ContinueParse())
{
if (PL_strstr(fNextToken, "FIELDS"))