fix bug 193477 [URL: colon ":" in URI is escaped in request (not scheme or port delimiter)] no longer escape the colon when it is part of the filename in urls, but force it's escape in links when building dir/index listings, r=bbaetz@acm.org, sr=darin@netscape.com

This commit is contained in:
andreas.otte%debitel.net 2003-02-27 13:15:19 +00:00
Родитель 97a27562cb
Коммит 7bea6bdccb
3 изменённых файлов: 11 добавлений и 6 удалений

Просмотреть файл

@ -497,7 +497,7 @@ nsIndexedToHTML::OnIndexAvailable(nsIRequest *aRequest,
NS_ConvertUCS2toUTF8 utf8UnEscapeSpec(unEscapeSpec);
NS_EscapeURL(utf8UnEscapeSpec.get(), utf8UnEscapeSpec.Length(),
esc_Forced|esc_FileBaseName|esc_OnlyASCII|esc_AlwaysCopy,
esc_Colon|esc_Forced|esc_FileBaseName|esc_OnlyASCII|esc_AlwaysCopy,
escapeBuf);
pushBuffer.Append(NS_ConvertUTF8toUCS2(escapeBuf));

Просмотреть файл

@ -310,7 +310,7 @@ const int EscapeChars[256] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1x */
0,1023, 0, 512,1023, 0,1023,1023,1023,1023,1023,1023,1023,1023, 959, 784, /* 2x !"#$%&'()*+,-./ */
1023,1023,1023,1023,1023,1023,1023,1023,1023,1023, 912, 912, 0,1008, 0, 768, /* 3x 0123456789:;<=>? */
1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1008, 912, 0,1008, 0, 768, /* 3x 0123456789:;<=>? */
1008,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023, /* 4x @ABCDEFGHIJKLMNO */
1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023, 896, 896, 896, 896,1023, /* 5x PQRSTUVWXYZ[\]^_ */
0,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023, /* 6x `abcdefghijklmno */
@ -384,6 +384,7 @@ NS_COM PRBool NS_EscapeURL(const char *part,
PRBool ignoreNonAscii = (mask & esc_OnlyASCII);
PRBool ignoreAscii = (mask & esc_OnlyNonASCII);
PRBool writing = (mask & esc_AlwaysCopy);
PRBool colon = (mask & esc_Colon);
register const unsigned char* src = (const unsigned char *) part;
@ -401,10 +402,13 @@ NS_COM PRBool NS_EscapeURL(const char *part,
// See bugzilla bug 61269 for details why we changed this
//
// And, we will not escape non-ascii characters if requested.
// On special request we will also escape the colon even when
// not covered by the matrix
if (NO_NEED_ESC(c) || (c == HEX_ESCAPE && !forced)
|| (c > 0x7f && ignoreNonAscii)
|| (c < 0x80 && ignoreAscii))
if ((NO_NEED_ESC(c) || (c == HEX_ESCAPE && !forced)
|| (c > 0x7f && ignoreNonAscii)
|| (c < 0x80 && ignoreAscii))
&& !(c == ':' && colon))
{
if (writing)
tempBuffer[tempBufferPos++] = c;

Просмотреть файл

@ -117,7 +117,8 @@ enum EscapeMask {
esc_Forced = PR_BIT(10), /* forces escaping of existing escape sequences */
esc_OnlyASCII = PR_BIT(11), /* causes non-ascii octets to be skipped */
esc_OnlyNonASCII = PR_BIT(12), /* causes ascii octets to be skipped */
esc_AlwaysCopy = PR_BIT(13) /* copy input to result buf even if escaping is unnecessary */
esc_AlwaysCopy = PR_BIT(13), /* copy input to result buf even if escaping is unnecessary */
esc_Colon = PR_BIT(14) /* force escape of colon */
};
/**