mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
fix 272988 handle dovecot imap server sending size after message headers when downloading headers, sr=mscott
This commit is contained in:
parent
cb9e3e9daa
commit
42f9795244
@ -96,6 +96,7 @@ nsImapServerResponseParser::nsImapServerResponseParser(nsImapProtocol &imapProto
|
||||
fStatusRecentMessages = 0;
|
||||
fStatusNextUID = nsMsgKey_None;
|
||||
fStatusExistingMessages = 0;
|
||||
fReceivedHeaderOrSizeForUID = nsMsgKey_None;
|
||||
}
|
||||
|
||||
nsImapServerResponseParser::~nsImapServerResponseParser()
|
||||
@ -183,6 +184,7 @@ void nsImapServerResponseParser::InitializeState()
|
||||
fProcessingTaggedResponse = PR_FALSE;
|
||||
fCurrentCommandFailed = PR_FALSE;
|
||||
fNumberOfRecentMessages = 0;
|
||||
fReceivedHeaderOrSizeForUID = nsMsgKey_None;
|
||||
}
|
||||
|
||||
void nsImapServerResponseParser::ParseIMAPServerResponse(const char *currentCommand, PRBool aIgnoreBadAndNOResponses)
|
||||
@ -1202,8 +1204,16 @@ void nsImapServerResponseParser::msg_fetch()
|
||||
AdvanceToNextToken();
|
||||
if (ContinueParse())
|
||||
{
|
||||
PRBool sendEndMsgDownload = (GetDownloadingHeaders()
|
||||
&& fReceivedHeaderOrSizeForUID == CurrentResponseUID());
|
||||
fSizeOfMostRecentMessage = atoi(fNextToken);
|
||||
|
||||
fReceivedHeaderOrSizeForUID = CurrentResponseUID();
|
||||
if (sendEndMsgDownload)
|
||||
{
|
||||
fServerConnection.NormalMessageEndDownload();
|
||||
fReceivedHeaderOrSizeForUID = nsMsgKey_None;
|
||||
}
|
||||
|
||||
// if we are in the process of fetching everything RFC822 then we should
|
||||
// turn around and force the total download size to be set to this value.
|
||||
// this helps if the server gaves us a bogus size for the message in response to the
|
||||
@ -2050,7 +2060,15 @@ void nsImapServerResponseParser::msg_fetch_content(PRBool chunk, PRInt32 origin,
|
||||
{
|
||||
// complete the message download
|
||||
if (ContinueParse())
|
||||
fServerConnection.NormalMessageEndDownload();
|
||||
{
|
||||
if (fReceivedHeaderOrSizeForUID == CurrentResponseUID())
|
||||
{
|
||||
fServerConnection.NormalMessageEndDownload();
|
||||
fReceivedHeaderOrSizeForUID = nsMsgKey_None;
|
||||
}
|
||||
else
|
||||
fReceivedHeaderOrSizeForUID = CurrentResponseUID();
|
||||
}
|
||||
else
|
||||
fServerConnection.AbortMessageDownLoad();
|
||||
}
|
||||
|
@ -238,6 +238,8 @@ private:
|
||||
PRInt32 fNumberOfRecentMessages;
|
||||
PRUint32 fCurrentResponseUID;
|
||||
PRUint32 fHighestRecordedUID;
|
||||
// used to handle server that sends msg size after headers
|
||||
PRUint32 fReceivedHeaderOrSizeForUID;
|
||||
PRInt32 fSizeOfMostRecentMessage;
|
||||
PRInt32 fTotalDownloadSize;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user