-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR-URL: #51900 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
- Loading branch information
1 parent
014cc53
commit 1edbc7d
Showing
2 changed files
with
68 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const http = require('http'); | ||
const net = require('net'); | ||
const tmpdir = require('../common/tmpdir'); | ||
|
||
tmpdir.refresh(); | ||
|
||
let count = 0; | ||
let server1; | ||
let server2; | ||
|
||
function request(options) { | ||
count++; | ||
http.get({ | ||
...options, | ||
createConnection: (...args) => { | ||
return net.connect(...args); | ||
} | ||
}, (res) => { | ||
res.resume(); | ||
res.on('end', () => { | ||
if (--count === 0) { | ||
server1.close(); | ||
server2.close(); | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
server1 = http.createServer((req, res) => { | ||
res.end('ok'); | ||
}).listen(common.PIPE, () => { | ||
server2 = http.createServer((req, res) => { | ||
res.end('ok'); | ||
}).listen(() => { | ||
request({ | ||
path: '/', | ||
socketPath: common.PIPE, | ||
}); | ||
|
||
request({ | ||
socketPath: common.PIPE, | ||
}); | ||
|
||
request({ | ||
path: '/', | ||
port: server2.address().port, | ||
}); | ||
|
||
request({ | ||
port: server2.address().port, | ||
}); | ||
}); | ||
}); |