| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 066cefb commit 8273824
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,16 +4,18 @@ const http = require('http'); | |||
| 4 | 4 | ||
| 5 | 5 | const server = http.createServer((req, res) => { | |
| 6 | 6 | res.end(); | |
| 7 | - }).listen(common.PORT, common.mustCall(() => { | ||
| 7 | + }).listen(0, common.mustCall(() => { | ||
| 8 | 8 | const agent = new http.Agent({ | |
| 9 | 9 | maxSockets: 1, | |
| 10 | 10 | keepAlive: true | |
| 11 | 11 | }); | |
| 12 | 12 | ||
| 13 | + const port = server.address().port; | ||
| 14 | + | ||
| 13 | 15 | const post = http.request({ | |
| 14 | - agent: agent, | ||
| 16 | + agent, | ||
| 15 | 17 | method: 'POST', | |
| 16 | - port: common.PORT, | ||
| 18 | + port, | ||
| 17 | 19 | }, common.mustCall((res) => { | |
| 18 | 20 | res.resume(); | |
| 19 | 21 | })); | |
@@ -28,9 +30,9 @@ const server = http.createServer((req, res) => { | |||
| 28 | 30 | }, 100); | |
| 29 | 31 | ||
| 30 | 32 | http.request({ | |
| 31 | - agent: agent, | ||
| 33 | + agent, | ||
| 32 | 34 | method: 'GET', | |
| 33 | - port: common.PORT, | ||
| 35 | + port, | ||
| 34 | 36 | }, common.mustCall((res) => { | |
| 35 | 37 | server.close(); | |
| 36 | 38 | res.connection.end(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,16 +15,18 @@ const server = http.createServer((req, res) => { | |||
| 15 | 15 | res.end(); | |
| 16 | 16 | onPause(); | |
| 17 | 17 | }); | |
| 18 | - }).listen(common.PORT, common.mustCall(() => { | ||
| 18 | + }).listen(0, common.mustCall(() => { | ||
| 19 | 19 | const agent = new http.Agent({ | |
| 20 | 20 | maxSockets: 1, | |
| 21 | 21 | keepAlive: true | |
| 22 | 22 | }); | |
| 23 | 23 | ||
| 24 | + const port = server.address().port; | ||
| 25 | + | ||
| 24 | 26 | const post = http.request({ | |
| 25 | - agent: agent, | ||
| 27 | + agent, | ||
| 26 | 28 | method: 'POST', | |
| 27 | - port: common.PORT, | ||
| 29 | + port, | ||
| 28 | 30 | }, common.mustCall((res) => { | |
| 29 | 31 | res.resume(); | |
| 30 | 32 | ||
@@ -41,9 +43,9 @@ const server = http.createServer((req, res) => { | |||
| 41 | 43 | post.write('initial'); | |
| 42 | 44 | ||
| 43 | 45 | http.request({ | |
| 44 | - agent: agent, | ||
| 46 | + agent, | ||
| 45 | 47 | method: 'GET', | |
| 46 | - port: common.PORT, | ||
| 48 | + port, | ||
| 47 | 49 | }, common.mustCall((res) => { | |
| 48 | 50 | server.close(); | |
| 49 | 51 | res.connection.end(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments