summaryrefslogtreecommitdiffhomepage
path: root/src/nodejs
diff options
context:
space:
mode:
authorAlexander Borisov <alexander.borisov@nginx.com>2018-12-19 15:56:06 +0300
committerAlexander Borisov <alexander.borisov@nginx.com>2018-12-19 15:56:06 +0300
commitdc16885b60f1d31d09114ea6140384531cad78e0 (patch)
treed162044af4dcf3a64c55ef8fb959731a0191cb36 /src/nodejs
parentf47a5db506911f1cf117bdc15474d40508bb7601 (diff)
downloadunit-dc16885b60f1d31d09114ea6140384531cad78e0.tar.gz
unit-dc16885b60f1d31d09114ea6140384531cad78e0.tar.bz2
Node.js: changed the unit-http socket constructor.
Third-party file descriptors are not supported. Socket "readable" and "writable" options are set true by default.
Diffstat (limited to 'src/nodejs')
-rwxr-xr-xsrc/nodejs/unit-http/socket.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/nodejs/unit-http/socket.js b/src/nodejs/unit-http/socket.js
index aef065bf..6e836949 100755
--- a/src/nodejs/unit-http/socket.js
+++ b/src/nodejs/unit-http/socket.js
@@ -18,10 +18,16 @@ function Socket(options) {
throw new TypeError('Options must be object');
}
- this.readable = (typeof options.readable === 'boolean' ? options.readable
- : false);
- this.writable = (typeof options.writable === 'boolean' ? options.writable
- : false);
+ if ("fd" in options) {
+ throw new TypeError('Working with file descriptors not supported');
+ }
+
+ /*
+ * For HTTP TCP socket 'readable' and 'writable' are always true.
+ * These options are required by Express and Koa frameworks.
+ */
+ this.readable = true;
+ this.writable = true;
}
util.inherits(Socket, EventEmitter);
@@ -43,7 +49,6 @@ Socket.prototype.connect = function connect(options, connectListener) {
this.once('connect', connectListener);
this.connecting = true;
- this.writable = true;
return this;
};