-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
http, http2: flag for overriding server timeout
Make it possible to override the default http server timeout. Ideally there should be no server timeout - as done on the master branch. This is a non-breaking way to enable platform providers to override the value. Backport-PR-URL: #27939 PR-URL: #27704 Refs: #27558 Refs: #27556 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
- Loading branch information
1 parent
08a32fb
commit 8516da1
Showing
10 changed files
with
90 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
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
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
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
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,41 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
|
||
if (!common.hasCrypto) | ||
common.skip('missing crypto'); | ||
|
||
const fixtures = require('../common/fixtures'); | ||
const http = require('http'); | ||
const https = require('https'); | ||
const http2 = require('http2'); | ||
const assert = require('assert'); | ||
const { spawnSync } = require('child_process'); | ||
|
||
// Make sure the defaults are correct. | ||
const servers = [ | ||
http.createServer(), | ||
https.createServer({ | ||
key: fixtures.readKey('agent1-key.pem'), | ||
cert: fixtures.readKey('agent1-cert.pem') | ||
}), | ||
http2.createServer() | ||
]; | ||
|
||
for (const server of servers) { | ||
assert.strictEqual(server.timeout, 120000); | ||
server.close(); | ||
} | ||
|
||
// Ensure that command line flag overrides the default timeout. | ||
const child1 = spawnSync(process.execPath, ['--http-server-default-timeout=10', | ||
'-p', 'http.createServer().timeout' | ||
]); | ||
assert.strictEqual(+child1.stdout.toString().trim(), 10); | ||
|
||
// Ensure that the flag is whitelisted for NODE_OPTIONS. | ||
const env = Object.assign({}, process.env, { | ||
NODE_OPTIONS: '--http-server-default-timeout=10' | ||
}); | ||
const child2 = spawnSync(process.execPath, | ||
[ '-p', 'http.createServer().timeout'], { env }); | ||
assert.strictEqual(+child2.stdout.toString().trim(), 10); |