Commit Graph

2 Commits

Author SHA1 Message Date
Yann Hamon
c957b05177
http: send connection: close when closing conn
HTTP/1.1 mandates connections which do not support keep-alive and
close the connection send the connection: close header, see
https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.10

This page also provides more information:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection

I understand that HTTP/1.1 defaults to keep-alive - and that the
Connection: close header is required when closing a connection.

This adds the Connection: close header in the 400 and 414
responses sent on client errors.

PR-URL: https://github.com/nodejs/node/pull/26467
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-03-09 00:23:48 +01:00
Luigi Pinca
ff7d053ae6 http: destroy the socket on parse error
Destroy the socket if the `'clientError'` event is emitted and there is
no listener for it.

Fixes: https://github.com/nodejs/node/issues/24586

PR-URL: https://github.com/nodejs/node/pull/24757
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-12-03 18:02:40 -08:00