| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ee1c95f commit 1866b05
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,6 +5,7 @@ const http = require('http'); | |||
| 5 | 5 | const net = require('net'); | |
| 6 | 6 | const url = require('url'); | |
| 7 | 7 | const assert = require('assert'); | |
| 8 | + const Countdown = require('../common/countdown'); | ||
| 8 | 9 | ||
| 9 | 10 | // Response splitting example, credit: Amit Klein, Safebreach | |
| 10 | 11 | const str = '/welcome?lang=bar%c4%8d%c4%8aContentLength:%200%c4%8d%c4%8a%c' + | |
@@ -18,6 +19,7 @@ const x = 'fooഊSet-Cookie: foo=barഊഊ<script>alert("Hi!")</script>'; | |||
| 18 | 19 | const y = 'foo⠊Set-Cookie: foo=bar'; | |
| 19 | 20 | ||
| 20 | 21 | let count = 0; | |
| 22 | + const countdown = new Countdown(3, () => server.close()); | ||
| 21 | 23 | ||
| 22 | 24 | function test(res, code, key, value) { | |
| 23 | 25 | const header = { [key]: value }; | |
@@ -46,8 +48,7 @@ const server = http.createServer((req, res) => { | |||
| 46 | 48 | default: | |
| 47 | 49 | assert.fail('should not get to here.'); | |
| 48 | 50 | } | |
| 49 | - if (count === 3) | ||
| 50 | - server.close(); | ||
| 51 | + countdown.dec(); | ||
| 51 | 52 | res.end('ok'); | |
| 52 | 53 | }); | |
| 53 | 54 | server.listen(0, () => { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments