When dealing with asynchronous XMLHttpRequests that take a long time to retrieve data from the server, I am searching for a way to abort them. Setting a timeout before sending the XHR is not feasible due to the length of these requests.
Although calling XMLHttpRequest.abort() stops the ready state change handlers from being called, it does not seem to actually close the connection to the server. This results in the server continuing its processes until data is received. Both Firefox and Chrome exhibit this behavior.
According to the specification, the timeout attribute on XHR can be adjusted even after the fetching has begun. However, setting this attribute around the time of calling abort() for an XHR awaiting data does not appear to have any effect in either Firefox 26 or Chrome 31. The connection remains open until the server completes its tasks and sends response headers.
Does this functionality exist in any browser? Or could there be a misunderstanding on my part? My testing involves Javascript on the client side and a Java servlet on the server side, with no other frameworks complicating matters.