Closed
Description
- Version: v7.4.0
- Platform: Linux
- Subsystem: http
When using a Unix Domain Socket, request.abort()
does not destroy the socket if abort()
is called before a socket is assigned to the request.
Here is a test case:
'use strict';
const http = require('http');
const socketPath = `/tmp/test_socket_${Date.now()}`;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World');
});
server.listen(socketPath, () => {
const req = http.get({ socketPath });
req.on('error', () => {});
req.abort();
setTimeout(() => server.close(), 100);
});
The process should exit after the timeout, but it doesn't. If abort()
is called when the socket is assigned to the request, everything work as expected.
From a quick look it seems that the free
event is emitted on the socket, but nothing happens after that.