diff options
author | szabolcsit <szabolcsit@hu.ibm.com> | 2018-11-06 17:07:59 +0100 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2018-11-14 18:21:56 -0800 |
commit | f3b49cfa7b3c2887ca8147b3d47ce1834b3923bf (patch) | |
tree | 1c4826bbcd13cdb6e2130a726db7f78dc22da01e /lib | |
parent | bd765d61d7425d82e80bdf2f4f27c0424221837b (diff) | |
download | android-node-v8-f3b49cfa7b3c2887ca8147b3d47ce1834b3923bf.tar.gz android-node-v8-f3b49cfa7b3c2887ca8147b3d47ce1834b3923bf.tar.bz2 android-node-v8-f3b49cfa7b3c2887ca8147b3d47ce1834b3923bf.zip |
http: else case is not reachable
While checking the arguments passed to http.Server, the case where
the options argument was of wrong type was not handled. Now it
throws an ERR_INVALID_ARG_TYPE error if the options argument is
not a function, object, null, or undefined.
PR-URL: https://github.com/nodejs/node/pull/24176
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/_http_server.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/_http_server.js b/lib/_http_server.js index 3b2d7f5041..96f05f5819 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -47,6 +47,7 @@ const { IncomingMessage } = require('_http_incoming'); const { ERR_HTTP_HEADERS_SENT, ERR_HTTP_INVALID_STATUS_CODE, + ERR_INVALID_ARG_TYPE, ERR_INVALID_CHAR } = require('internal/errors').codes; const Buffer = require('buffer').Buffer; @@ -281,6 +282,8 @@ function Server(options, requestListener) { options = {}; } else if (options == null || typeof options === 'object') { options = util._extend({}, options); + } else { + throw new ERR_INVALID_ARG_TYPE('options', 'object', options); } this[kIncomingMessage] = options.IncomingMessage || IncomingMessage; |