fix(lib): enable multiple consecutive slash support (#1155)
* fix(lib): enable multiple consecutive slash support Closes #754 Closes #808 Closes #815 Apparently more applications use multiple slashes in a row than I thought. There is no easy way around this other than to do this hacky fix to avoid net/http#ServeMux's URL cleaning. * test(double_slash): add sourceware case Signed-off-by: Xe Iaso <me@xeiaso.net> * test(lib): fix tests for double slash fix Signed-off-by: Xe Iaso <me@xeiaso.net> --------- Signed-off-by: Xe Iaso <xe.iaso@techaro.lol> Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
parent
75ea1b60d5
commit
714c85dbc4
11 changed files with 307 additions and 6 deletions
45
test/double_slash/test.mjs
Normal file
45
test/double_slash/test.mjs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
import { createReadStream } from "fs";
|
||||
import { createInterface } from "readline";
|
||||
|
||||
async function getPage(path) {
|
||||
return fetch(`http://localhost:8923${path}`)
|
||||
.then(resp => {
|
||||
if (resp.status !== 200) {
|
||||
throw new Error(`wanted status 200, got status: ${resp.status}`);
|
||||
}
|
||||
return resp;
|
||||
})
|
||||
.then(resp => resp.text());
|
||||
}
|
||||
|
||||
(async () => {
|
||||
const fin = createReadStream("input.txt");
|
||||
const rl = createInterface({
|
||||
input: fin,
|
||||
crlfDelay: Infinity,
|
||||
});
|
||||
|
||||
const resultSheet = {};
|
||||
|
||||
let failed = false;
|
||||
|
||||
for await (const line of rl) {
|
||||
console.log(line);
|
||||
|
||||
const resp = await getPage(line);
|
||||
resultSheet[line] = {
|
||||
match: resp.includes(`GET ${line}`),
|
||||
line: resp.split("\n")[0],
|
||||
};
|
||||
}
|
||||
|
||||
for (let [k, v] of Object.entries(resultSheet)) {
|
||||
if (!v.match) {
|
||||
failed = true;
|
||||
}
|
||||
|
||||
console.debug({ path: k, results: v });
|
||||
}
|
||||
|
||||
process.exit(failed ? 1 : 0);
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue