mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
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 <matteo.collina@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
This commit is contained in:
1 parent
7a432c1af3
commit
c247cb02a1
9 files changed
+221
-8
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user