fix bug 84409 [Incorrect request for page components if main page URL contains ";" character] Implementing param support according to RFC 2396, r=dougt, sr=rpotts

git-svn-id: svn://10.0.0.236/trunk@101539 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
andreas.otte%primus-online.de 2001-08-21 20:35:01 +00:00
parent f2d747d729
commit a655de9c6e
5 changed files with 52 additions and 12 deletions

View File

@ -424,8 +424,22 @@ nsAuthURLParser::ParseAtDirectory(const char* i_Path, char* *o_Directory,
int len = PL_strlen(i_Path);
/* Factor out the optionpart with ;?# */
static const char delimiters[] = ";?#"; // for param, query and ref
static const char delimiters[] = "?#"; // for query and ref
char* brk = PL_strpbrk(i_Path, delimiters);
char* pointer;
if (!brk)
pointer = (char*)i_Path + len;
else
pointer = brk;
/* Now look for a param ; right of a / from pointer backward */
while ((pointer-i_Path) >= 0) {
pointer--;
if (*pointer == ';') {
brk = pointer;
}
if (*pointer == '/')
break;
}
if (!brk) // Everything is just path and filename
{

View File

@ -231,8 +231,22 @@ nsNoAuthURLParser::ParseAtDirectory(const char* i_Path, char* *o_Directory,
int len = PL_strlen(i_Path);
/* Factor out the optionpart with ;?# */
static const char delimiters[] = ";?#"; // for param, query and ref
static const char delimiters[] = "?#"; // for query and ref
char* brk = PL_strpbrk(i_Path, delimiters);
char* pointer;
if (!brk)
pointer = (char*)i_Path + len;
else
pointer = brk;
/* Now look for a param ; right of a / from pointer backward */
while ((pointer-i_Path) >= 0) {
pointer--;
if (*pointer == ';') {
brk = pointer;
}
if (*pointer == '/')
break;
}
if (!brk) // Everything is just path and filename
{

View File

@ -426,8 +426,22 @@ nsStdURLParser::ParseAtDirectory(const char* i_Path, char* *o_Directory,
int len = PL_strlen(i_Path);
/* Factor out the optionpart with ;?# */
static const char delimiters[] = ";?#"; // for param, query and ref
static const char delimiters[] = "?#"; // for query and ref
char* brk = PL_strpbrk(i_Path, delimiters);
char* pointer;
if (!brk)
pointer = (char*)i_Path + len;
else
pointer = brk;
/* Now look for a param ; right of a / from pointer backward */
while ((pointer-i_Path) >= 0) {
pointer--;
if (*pointer == ';') {
brk = pointer;
}
if (*pointer == '/')
break;
}
if (!brk) // Everything is just path and filename
{

View File

@ -36,8 +36,8 @@ 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, 0,1023,1023,1023,1023,1023,1023, 959, 912, /* 2x !"#$%&'()*+,-./ */
1023,1023,1023,1023,1023,1023,1023,1023,1023,1023, 912, 896, 0,1008, 0, 768, /* 3x 0123456789:;<=>? */
0,1023, 0, 512,1023, 0,1023, 0,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:;<=>? */
992,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 */
@ -249,7 +249,7 @@ DupString(char* *o_Dest, const char* i_Src)
// Replace all /./ with a /
// Also changes all \ to /
// But only till #?;
// But only till #?
NS_NET void
CoaleseDirs(char* io_Path)
{
@ -263,7 +263,6 @@ CoaleseDirs(char* io_Path)
char *urlPtr = io_Path;
for(; (*fwdPtr != '\0') &&
(*fwdPtr != ';') &&
(*fwdPtr != '?') &&
(*fwdPtr != '#'); ++fwdPtr)
{
@ -290,9 +289,8 @@ CoaleseDirs(char* io_Path)
}
else if(*fwdPtr == '/' && *(fwdPtr+1) == '.' && *(fwdPtr+2) == '.' &&
(*(fwdPtr+3) == '/' ||
*(fwdPtr+3) == '\0' ||
*(fwdPtr+3) == ';' || // This will take care of likes of
*(fwdPtr+3) == '?' || // foo/bar/..#sometag
*(fwdPtr+3) == '\0' || // This will take care of
*(fwdPtr+3) == '?' || // something like foo/bar/..#sometag
*(fwdPtr+3) == '#' ||
*(fwdPtr+3) == '\\'))
{

View File

@ -278,8 +278,8 @@ 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, 0,1023,1023,1023,1023,1023,1023, 959, 912, /* 2x !"#$%&'()*+,-./ */
1023,1023,1023,1023,1023,1023,1023,1023,1023,1023, 912, 896, 0,1008, 0, 768, /* 3x 0123456789:;<=>? */
0,1023, 0, 512,1023, 0,1023, 0,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:;<=>? */
992,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 */