141152 r=ducarroz sr=bienvenu fix the partial msg display code in mime to use escaped uidl and then unescape

this uidl in pop3 code. fixes truncated pop3 msg download problems with uidl having quotes(")
This commit is contained in:
naving%netscape.com 2002-05-03 01:00:21 +00:00
parent 6304148769
commit 066c35c03c
2 changed files with 33 additions and 29 deletions

View File

@ -55,6 +55,7 @@
#include "nsIMsgWindow.h"
#include "nsIMsgFolder.h" // TO include biffState enum. Change to bool later...
#include "nsIDocShell.h"
#include "nsEscape.h"
#define EXTRA_SAFETY_SPACE 3096
@ -732,7 +733,8 @@ nsresult nsPop3Protocol::LoadUrl(nsIURI* aURL, nsISupports * /* aConsumer */)
if (uidl)
{
uidl += 5;
m_pop3ConData->only_uidl = PL_strdup(uidl);
char *only_uidl = PL_strdup(uidl);
m_pop3ConData->only_uidl = nsUnescape(only_uidl);
mSuppressListenerNotifications = PR_TRUE; // suppress on start and on stop because this url won't have any content to display
}

View File

@ -774,38 +774,40 @@ static char *
MimeMessage_partial_message_html(const char *data, void *closure,
MimeHeaders *headers)
{
nsCAutoString orig_url(data);
char *partialMsgHtml = nsnull;
char *uidl = MimeHeaders_get(headers, HEADER_X_UIDL, PR_FALSE, PR_FALSE);
char *msgId = MimeHeaders_get(headers, HEADER_MESSAGE_ID, PR_FALSE,
nsCAutoString orig_url(data);
char *partialMsgHtml = nsnull;
char *uidl = MimeHeaders_get(headers, HEADER_X_UIDL, PR_FALSE, PR_FALSE);
char *msgId = MimeHeaders_get(headers, HEADER_MESSAGE_ID, PR_FALSE,
PR_FALSE);
char *msgIdPtr = PL_strstr(msgId, "<");
char *msgIdPtr = PL_strstr(msgId, "<");
orig_url.ReplaceSubstring("mailbox-message", "mailbox");
orig_url.ReplaceSubstring("#", "?number=");
orig_url.ReplaceSubstring("mailbox-message", "mailbox");
orig_url.ReplaceSubstring("#", "?number=");
if (msgIdPtr)
msgIdPtr++;
else
msgIdPtr = msgId;
char *gtPtr = PL_strstr(msgIdPtr, ">");
if (gtPtr)
*gtPtr = 0;
if (msgIdPtr)
msgIdPtr++;
else
msgIdPtr = msgId;
char *gtPtr = PL_strstr(msgIdPtr, ">");
if (gtPtr)
*gtPtr = 0;
char *escapedMsgId = msgIdPtr ? nsEscape(msgIdPtr, url_Path) : nsnull;
char *fmt1 = MimeGetStringByID(1037);
char *fmt2 = MimeGetStringByID(1038);
char *fmt3 = MimeGetStringByID(1039);
char *msgUrl = PR_smprintf("%s&messageid=%s&uidl=%s",
orig_url.get(), escapedMsgId, uidl);
partialMsgHtml = PR_smprintf("%s%s%s%s", fmt1,fmt2, msgUrl, fmt3);
PR_FREEIF(uidl);
PR_FREEIF(msgId);
PR_FREEIF(escapedMsgId);
PR_FREEIF(msgUrl);
PR_FREEIF(fmt1);
PR_FREEIF(fmt2);
PR_FREEIF(fmt3);
char *escapedUidl = uidl ? nsEscape(uidl, url_XAlphas) : nsnull;
char *escapedMsgId = msgIdPtr ? nsEscape(msgIdPtr, url_Path) : nsnull;
char *fmt1 = MimeGetStringByID(1037);
char *fmt2 = MimeGetStringByID(1038);
char *fmt3 = MimeGetStringByID(1039);
char *msgUrl = PR_smprintf("%s&messageid=%s&uidl=%s",
orig_url.get(), escapedMsgId, escapedUidl);
partialMsgHtml = PR_smprintf("%s%s%s%s", fmt1,fmt2, msgUrl, fmt3);
PR_Free(uidl);
PR_Free(escapedUidl);
PR_Free(msgId);
PR_Free(escapedMsgId);
PR_Free(msgUrl);
PR_Free(fmt1);
PR_Free(fmt2);
PR_Free(fmt3);
return partialMsgHtml;
}