http: fix error message when specifying headerTimeout for createServer

This change fixes the message on the error received when calling
http.createServer(...) with a header timeout greater than the request
timeout is incorrect.

The validation requires that the header timeout is lower than the
request timeout, but the error message asks for the opposite.

PR-URL: https://github.com/nodejs/node/pull/44163
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Erick Wendel <erick.workspace@gmail.com>
Reviewed-By: Ricky Zhou <0x19951125@gmail.com>
This commit is contained in:
Nick Sia 2022-08-09 17:27:18 +08:00 committed by GitHub
parent 8b0e5b19bd
commit b4279240f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -420,7 +420,7 @@ function storeHTTPOptions(options) {
}
if (this.requestTimeout > 0 && this.headersTimeout > 0 && this.headersTimeout >= this.requestTimeout) {
throw new codes.ERR_OUT_OF_RANGE('headersTimeout', '>= requestTimeout', headersTimeout);
throw new codes.ERR_OUT_OF_RANGE('headersTimeout', '< requestTimeout', headersTimeout);
}
const keepAliveTimeout = options.keepAliveTimeout;