mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1042347 - %2e entered in URL bar not normalized leading to denormalized request r=mcmanus
This commit is contained in:
parent
967c5babae
commit
73f17fbac5
@ -248,7 +248,7 @@ net_CoalesceDirs(netCoalesceFlags flags, char* path)
|
||||
*/
|
||||
char *fwdPtr = path;
|
||||
char *urlPtr = path;
|
||||
char *lastslash = path;
|
||||
char *endPath = path;
|
||||
uint32_t traversal = 0;
|
||||
uint32_t special_ftp_len = 0;
|
||||
|
||||
@ -265,34 +265,18 @@ net_CoalesceDirs(netCoalesceFlags flags, char* path)
|
||||
special_ftp_len = 2;
|
||||
}
|
||||
|
||||
/* find the last slash before # or ? */
|
||||
for(; (*fwdPtr != '\0') &&
|
||||
(*fwdPtr != '?') &&
|
||||
/* find the end of the path - places the cursor on \0, ? or # */
|
||||
for(; (*fwdPtr != '\0') &&
|
||||
(*fwdPtr != '?') &&
|
||||
(*fwdPtr != '#'); ++fwdPtr)
|
||||
{
|
||||
}
|
||||
|
||||
/* found nothing, but go back one only */
|
||||
/* if there is something to go back to */
|
||||
if (fwdPtr != path && *fwdPtr == '\0')
|
||||
{
|
||||
--fwdPtr;
|
||||
}
|
||||
|
||||
/* search the slash */
|
||||
for(; (fwdPtr != path) &&
|
||||
(*fwdPtr != '/'); --fwdPtr)
|
||||
{
|
||||
}
|
||||
lastslash = fwdPtr;
|
||||
endPath = fwdPtr;
|
||||
fwdPtr = path;
|
||||
|
||||
/* replace all %2E or %2e with . in the path */
|
||||
/* but stop at lastchar if non null */
|
||||
for(; (*fwdPtr != '\0') &&
|
||||
(*fwdPtr != '?') &&
|
||||
(*fwdPtr != '#') &&
|
||||
(*lastslash == '\0' || fwdPtr != lastslash); ++fwdPtr)
|
||||
for(; fwdPtr != endPath; ++fwdPtr)
|
||||
{
|
||||
if (*fwdPtr == '%' && *(fwdPtr+1) == '2' &&
|
||||
(*(fwdPtr+2) == 'E' || *(fwdPtr+2) == 'e'))
|
||||
|
@ -301,6 +301,32 @@ add_test(function test_hugeStringThrows()
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
add_test(function test_pathPercentEncodedDot()
|
||||
{
|
||||
var url = stringToURL("http://example.com/%2eX/X%2e/%2eX");
|
||||
do_check_eq(url.spec, "http://example.com/.X/X./.X");
|
||||
|
||||
url = stringToURL("http://example.com/hello/%2e%2E/%2e");
|
||||
do_check_eq(url.spec, "http://example.com/");
|
||||
|
||||
url = stringToURL("http://example.com/hello/%2e%2E/%");
|
||||
do_check_eq(url.spec, "http://example.com/%");
|
||||
|
||||
url = stringToURL("http://example.com/hello/%2e%2E/%2");
|
||||
do_check_eq(url.spec, "http://example.com/%2");
|
||||
|
||||
url = stringToURL("http://example.com/hello/%2e%2E/%#");
|
||||
do_check_eq(url.spec, "http://example.com/%#");
|
||||
|
||||
url = stringToURL("http://example.com/hello/%2e%2E/%2?");
|
||||
do_check_eq(url.spec, "http://example.com/%2?");
|
||||
|
||||
url = stringToURL("http://example.com/hello/%2e/");
|
||||
do_check_eq(url.spec, "http://example.com/hello/");
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
add_test(function test_filterWhitespace()
|
||||
{
|
||||
var url = stringToURL(" \r\n\th\nt\rt\tp://ex\r\n\tample.com/path\r\n\t/\r\n\tto the/fil\r\n\te.e\r\n\txt?que\r\n\try#ha\r\n\tsh \r\n\t ");
|
||||
|
@ -147,9 +147,6 @@
|
||||
[Parsing: <file://localhost/test> against <file:///tmp/mock/path>]
|
||||
expected: FAIL
|
||||
|
||||
[Parsing: <http://example.com/foo/%2e> against <about:blank>]
|
||||
expected: FAIL
|
||||
|
||||
[Parsing: <http://example.com\\\\foo\\\\bar> against <about:blank>]
|
||||
expected: FAIL
|
||||
|
||||
@ -500,10 +497,3 @@
|
||||
|
||||
[Parsing: <file:a> against <http://www.example.com/test>]
|
||||
expected: FAIL
|
||||
|
||||
[Parsing: <http://example.com/foo/%2e%2> against <about:blank>]
|
||||
expected: FAIL
|
||||
|
||||
[Parsing: <http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar> against <about:blank>]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -96,9 +96,6 @@
|
||||
[Parsing: <file://localhost/test> against <file:///tmp/mock/path>]
|
||||
expected: FAIL
|
||||
|
||||
[Parsing: <http://example.com/foo/%2e> against <about:blank>]
|
||||
expected: FAIL
|
||||
|
||||
[Parsing: <http://example.com\\\\foo\\\\bar> against <about:blank>]
|
||||
expected: FAIL
|
||||
|
||||
@ -341,10 +338,3 @@
|
||||
|
||||
[Parsing: <file:a> against <http://www.example.com/test>]
|
||||
expected: FAIL
|
||||
|
||||
[Parsing: <http://example.com/foo/%2e%2> against <about:blank>]
|
||||
expected: FAIL
|
||||
|
||||
[Parsing: <http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar> against <about:blank>]
|
||||
expected: FAIL
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user