Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7d55374

Browse files
mithunsasidharangibfahn
authored andcommittedDec 20, 2017
test: refactored test-http-response-splitting to use countdown
PR-URL: #17348 Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
1 parent 89c1959 commit 7d55374

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎test/parallel/test-http-response-splitting.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const http = require('http');
55
const net = require('net');
66
const url = require('url');
77
const assert = require('assert');
8+
const Countdown = require('../common/countdown');
89

910
// Response splitting example, credit: Amit Klein, Safebreach
1011
const str = '/welcome?lang=bar%c4%8d%c4%8aContent­Length:%200%c4%8d%c4%8a%c' +
@@ -18,6 +19,7 @@ const x = 'fooഊSet-Cookie: foo=barഊഊ<script>alert("Hi!")</script>';
1819
const y = 'foo⠊Set-Cookie: foo=bar';
1920

2021
let count = 0;
22+
const countdown = new Countdown(3, () => server.close());
2123

2224
function test(res, code, header) {
2325
assert.throws(() => {
@@ -40,8 +42,7 @@ const server = http.createServer((req, res) => {
4042
default:
4143
assert.fail('should not get to here.');
4244
}
43-
if (count === 3)
44-
server.close();
45+
countdown.dec();
4546
res.end('ok');
4647
});
4748
server.listen(0, () => {

0 commit comments

Comments
 (0)
Please sign in to comment.