From b258c8f56cf14ddbc4c5958511063fc5be87fde9 Mon Sep 17 00:00:00 2001 From: "andreas.otte%primus-online.de" Date: Sat, 3 Nov 2001 14:55:57 +0000 Subject: [PATCH] fix bug 61269 ['%' will get URL-escaped to "%25" if not followed by 2 hexadecimal digits] We no longer escape an % which is not followed by two hex characters, at least not until forced. This is more compatible with current usage in other browsers. r=dougt@netscape.com, sr=darin@netscape.com git-svn-id: svn://10.0.0.236/trunk@107259 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/io/nsEscape.cpp | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/mozilla/xpcom/io/nsEscape.cpp b/mozilla/xpcom/io/nsEscape.cpp index d3da51f4dc2..d57a505c1e6 100644 --- a/mozilla/xpcom/io/nsEscape.cpp +++ b/mozilla/xpcom/io/nsEscape.cpp @@ -340,7 +340,6 @@ NS_COM nsresult nsStdEscape(const char* str, PRInt16 mask, nsCString &result) int i = 0; char* hexChars = "0123456789ABCDEF"; - static const char CheckHexChars[] = "0123456789ABCDEFabcdef"; int len = PL_strlen(str); PRBool forced = PR_FALSE; @@ -349,30 +348,20 @@ NS_COM nsresult nsStdEscape(const char* str, PRInt16 mask, nsCString &result) register const unsigned char* src = (const unsigned char *) str; - src = (const unsigned char *) str; - char tempBuffer[100]; unsigned int tempBufferPos = 0; - char c1[] = " "; - char c2[] = " "; - char* const pc1 = c1; - char* const pc2 = c2; - for (i = 0; i < len; i++) { - c1[0] = *(src+1); - if (*(src+1) == '\0') - c2[0] = '\0'; - else - c2[0] = *(src+2); unsigned char c = *src++; /* if the char has not to be escaped or whatever follows % is a valid escaped string, just copy the char */ - if (NO_NEED_ESC(c) || (c == HEX_ESCAPE && !(forced) && (pc1) && (pc2) && - PL_strpbrk(pc1, CheckHexChars) != 0 && - PL_strpbrk(pc2, CheckHexChars) != 0)) { + + /* Also the % will not be escaped until forced */ + /* See bugzilla bug 61269 for details why we changed this */ + + if (NO_NEED_ESC(c) || (c == HEX_ESCAPE && !(forced))) { tempBuffer[tempBufferPos++]=c; } else