From a899576c977aef32d85074ac09d511e4590e28d7 Mon Sep 17 00:00:00 2001 From: Peter Marton Date: Thu, 19 Oct 2017 20:16:02 +0200 Subject: http: add options to http.createServer() This adds the optional options argument to `http.createServer()`. It contains two options: the `IncomingMessage` and `ServerReponse` option. PR-URL: https://github.com/nodejs/node/pull/15752 Reviewed-By: Matteo Collina Reviewed-By: Anatoli Papirovski Reviewed-By: James M Snell Reviewed-By: Evan Lucas --- lib/https.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/https.js') diff --git a/lib/https.js b/lib/https.js index 5013791fe2..741ce84d2f 100644 --- a/lib/https.js +++ b/lib/https.js @@ -36,6 +36,9 @@ const { inherits } = util; const debug = util.debuglog('https'); const { urlToOptions, searchParamsSymbol } = require('internal/url'); const errors = require('internal/errors'); +const { IncomingMessage, ServerResponse } = require('http'); +const { kIncomingMessage } = require('_http_common'); +const { kServerResponse } = require('_http_server'); function Server(opts, requestListener) { if (!(this instanceof Server)) return new Server(opts, requestListener); @@ -57,6 +60,9 @@ function Server(opts, requestListener) { opts.ALPNProtocols = ['http/1.1']; } + this[kIncomingMessage] = opts.IncomingMessage || IncomingMessage; + this[kServerResponse] = opts.ServerResponse || ServerResponse; + tls.Server.call(this, opts, _connectionListener); this.httpAllowHalfOpen = false; -- cgit v1.2.3