Destroying socket when we get a clientError (#16700)
This commit is contained in:
parent
9a24dd3fcd
commit
db83c8cd9b
|
@ -36,7 +36,7 @@ export default function (kbnServer, server, config) {
|
|||
return;
|
||||
}
|
||||
|
||||
server.connection({
|
||||
const connection = server.connection({
|
||||
...connectionOptions,
|
||||
tls: {
|
||||
key: readFileSync(config.get('server.ssl.key')),
|
||||
|
@ -50,4 +50,14 @@ export default function (kbnServer, server, config) {
|
|||
secureOptions: secureOptions(config.get('server.ssl.supportedProtocols'))
|
||||
}
|
||||
});
|
||||
|
||||
const badRequestResponse = new Buffer('HTTP/1.1 400 Bad Request\r\n\r\n', 'ascii');
|
||||
connection.listener.on('clientError', (err, socket) => {
|
||||
if (socket.writable) {
|
||||
socket.end(badRequestResponse);
|
||||
}
|
||||
else {
|
||||
socket.destroy(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue