summaryrefslogtreecommitdiff
path: root/lib/https.js
diff options
context:
space:
mode:
authorFedor Indutny <fedor@indutny.com>2016-01-06 17:00:27 -0500
committerFedor Indutny <fedor@indutny.com>2016-01-07 03:39:15 -0500
commit5f76b24e5ee440b7c2d2bdc74a9bb94374df9f2a (patch)
treec71a3fa6e69e57b9a50ad51188e7a2e9a19f53c7 /lib/https.js
parent1ab6b21360d97719b3101153fb164c0c3eddf038 (diff)
downloadandroid-node-v8-5f76b24e5ee440b7c2d2bdc74a9bb94374df9f2a.tar.gz
android-node-v8-5f76b24e5ee440b7c2d2bdc74a9bb94374df9f2a.tar.bz2
android-node-v8-5f76b24e5ee440b7c2d2bdc74a9bb94374df9f2a.zip
http: overridable `clientError`
Make default `clientError` behavior (close socket immediately) overridable. With this APIs it is possible to write a custom error handler, and to send, for example, a 400 HTTP response. http.createServer(...).on('clientError', function(err, socket) { socket.end('HTTP/1.1 400 Bad Request\r\n\r\n'); socket.destroy(); }); Fix: #4543 PR-URL: https://github.com/nodejs/node/pull/4557 Reviewed-By: Brian White <mscdex@mscdex.net>
Diffstat (limited to 'lib/https.js')
-rw-r--r--lib/https.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/https.js b/lib/https.js
index 8e79d295bf..7008a79131 100644
--- a/lib/https.js
+++ b/lib/https.js
@@ -29,8 +29,9 @@ function Server(opts, requestListener) {
this.addListener('request', requestListener);
}
- this.addListener('clientError', function(err, conn) {
- conn.destroy();
+ this.addListener('tlsClientError', function(err, conn) {
+ if (!this.emit('clientError', err, conn))
+ conn.destroy(err);
});
this.timeout = 2 * 60 * 1000;