summaryrefslogtreecommitdiffhomepage
path: root/src/nodejs
diff options
context:
space:
mode:
Diffstat (limited to 'src/nodejs')
-rw-r--r--src/nodejs/unit-http/http.js4
-rw-r--r--src/nodejs/unit-http/http_server.js10
2 files changed, 11 insertions, 3 deletions
diff --git a/src/nodejs/unit-http/http.js b/src/nodejs/unit-http/http.js
index d298a35f..60b8004f 100644
--- a/src/nodejs/unit-http/http.js
+++ b/src/nodejs/unit-http/http.js
@@ -11,8 +11,8 @@ const {
ServerResponse,
} = require('./http_server');
-function createServer (requestHandler) {
- return new Server(requestHandler);
+function createServer (options, requestHandler) {
+ return new Server(options, requestHandler);
}
const http = require("http")
diff --git a/src/nodejs/unit-http/http_server.js b/src/nodejs/unit-http/http_server.js
index 8eb13d7f..b78f309a 100644
--- a/src/nodejs/unit-http/http_server.js
+++ b/src/nodejs/unit-http/http_server.js
@@ -5,6 +5,7 @@
'use strict';
+const { stderr } = require('process');
const EventEmitter = require('events');
const http = require('http');
const util = require('util');
@@ -413,7 +414,14 @@ ServerRequest.prototype._read = function _read(n) {
};
-function Server(requestListener) {
+function Server(options, requestListener) {
+ if (typeof options === 'function') {
+ requestListener = options;
+ options = {};
+ } else {
+ stderr.write("http.Server constructor was called with unsupported options, using default settings\n");
+ }
+
EventEmitter.call(this);
this.unit = new unit_lib.Unit();