Automattic/engine.io — pull request #297 by lpinca (2014-12-16 08:30:38+00:00)
Title: polling: don't abort the ongoing data request when closing transport

A data request is "aborted" if the transport gets closed when the request is still in progress, but the abort procedure will only removes the listeners without actually closing the request.

This results in a pending request that is never responded.

As proof consider the following example:
```js
var Client = require('engine.io-client')
, Engine = require('engine.io')
, http = require('http');

var server = http.createServer()
, engine = new Engine();

engine.on('connection', function connection(socket) {
var onDataRequest = socket.transport.onDataRequest;

socket.transport.onDataRequest = function (req, res) {
onDataRequest.call(socket.transport, req, res);
socket.close();
};

socket.on('message', function (data) {
console.log(data);
});
});

server.on('request', function request(req, res) {
engine.handleRequest(req, res);
});

server.listen(function () {
var client = new Client('http://localhost:' + server.address().port, {
transports: [ 'polling' ]
});

client.on('open', function open() {
client.send('bar');
});

client.on('close', function close() {
server.close();
});
});
```

This patch ensures that every data request gets closed correctly.