1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-30 16:40:57 -05:00

try connection: close header for preventing op leak

This commit is contained in:
Yoshiya Hinosawa 2024-11-18 14:09:59 +09:00
parent 93ee193c66
commit 236e5b12a2
No known key found for this signature in database
GPG key ID: 9017DB4559488785

View file

@ -483,6 +483,7 @@ Deno.test("[node/http] send request with non-chunked body", async () => {
headers: { headers: {
"Content-Type": "text/plain; charset=utf-8", "Content-Type": "text/plain; charset=utf-8",
"Content-Length": "11", "Content-Length": "11",
"Connection": "close",
}, },
}; };
const req = http.request(opts, (res) => { const req = http.request(opts, (res) => {
@ -540,6 +541,7 @@ Deno.test("[node/http] send request with chunked body", async () => {
headers: { headers: {
"Content-Type": "text/plain; charset=utf-8", "Content-Type": "text/plain; charset=utf-8",
"Content-Length": "11", "Content-Length": "11",
"Connection": "close",
"Transfer-Encoding": "chunked", "Transfer-Encoding": "chunked",
}, },
}; };
@ -586,6 +588,7 @@ Deno.test("[node/http] send request with chunked body as default", async () => {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "text/plain; charset=utf-8", "Content-Type": "text/plain; charset=utf-8",
"Connection": "close",
}, },
}; };
const req = http.request(opts, (res) => { const req = http.request(opts, (res) => {
@ -1021,8 +1024,11 @@ Deno.test(
}); });
request.on("close", () => resolve()); request.on("close", () => resolve());
await promise; await promise;
// TODO(kt3k): This is necessary for preventing op leak
await new Promise((resolve) => setTimeout(resolve, 2000)); if (Deno.build.os === "windows") {
// TODO(kt3k): This is necessary for preventing op leak
await new Promise((resolve) => setTimeout(resolve, 4000));
}
}, },
); );
@ -1049,8 +1055,11 @@ Deno.test(
await requestClosed.promise; await requestClosed.promise;
assertEquals(receivedRequest, false); assertEquals(receivedRequest, false);
await server.finished; await server.finished;
// TODO(kt3k): This is necessary for preventing op leak
await new Promise((resolve) => setTimeout(resolve, 2000)); if (Deno.build.os === "windows") {
// TODO(kt3k): This is necessary for preventing op leak
await new Promise((resolve) => setTimeout(resolve, 4000));
}
}, },
); );