Make clientError overridable by indutny · Pull Request #4557 · nodejs/node (original) (raw)

indutny added a commit that referenced this pull request

Jan 7, 2016

@indutny

`` [http: overridable clientError](/nodejs/node/commit/5f76b24e5ee440b7c2d2bdc74a9bb94374df9f2a "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") ``

[5f76b24](/nodejs/node/commit/5f76b24e5ee440b7c2d2bdc74a9bb94374df9f2a)

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: #4557 Reviewed-By: Brian White mscdex@mscdex.net