| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8b3feee commit f70fd00
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,8 +6,24 @@ if (!common.hasCrypto) | |||
| 6 | 6 | ||
| 7 | 7 | const https = require('https'); | |
| 8 | 8 | ||
| 9 | - const request = https.get('https://example.com'); | ||
| 9 | + if (process.argv[2] === 'localhost') { | ||
| 10 | + const request = https.get('https://localhost:' + process.argv[3]); | ||
| 10 | 11 | ||
| 11 | - request.on('socket', (socket) => { | ||
| 12 | - socket.unref(); | ||
| 13 | - }); | ||
| 12 | + request.on('socket', (socket) => { | ||
| 13 | + socket.unref(); | ||
| 14 | + }); | ||
| 15 | + } else { | ||
| 16 | + const assert = require('assert'); | ||
| 17 | + const net = require('net'); | ||
| 18 | + const server = net.createServer(); | ||
| 19 | + server.listen(0); | ||
| 20 | + server.on('listening', () => { | ||
| 21 | + const port = server.address().port; | ||
| 22 | + const { fork } = require('child_process'); | ||
| 23 | + const child = fork(__filename, ['localhost', port], {}); | ||
| 24 | + child.on('close', (exit_code) => { | ||
| 25 | + server.close(); | ||
| 26 | + assert.strictEqual(exit_code, 0); | ||
| 27 | + }); | ||
| 28 | + }); | ||
| 29 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments