Questions tagged [request-cancelling]

Stopping or safely ignoring a request, usually an HTTP transaction between a client and a server.

Stopping or safely ignoring a request, usually an HTTP transaction (GET, POST, etc.) between a client and a server.

This is most often applicable in an AJAX context -- especially if synchronous AJAX is used.

Requests can be canceled/ignored by the client and/or the server.

67 questions
32
votes
4 answers

What is the Correct HTTP Status Code for a Cancelled Request

When a TCP connection gets cancelled by the client while making a HTTP request, I'd like to stop doing any work on the server and return an empty response. What HTTP status code should such a response return?
Muhammad Rehan Saeed
  • 28,236
  • 27
  • 169
  • 261
30
votes
3 answers

Handling cancelled request with Express/Node.js and Angular

When a pending HTTP request is cancelled by a client/browser it seems that Node with Express continues to process the request. For intensive requests, the CPU is still being kept busy with unnecessary requests. Is there a way to ask Node.js/Express…
Derek
  • 2,905
  • 3
  • 21
  • 31
28
votes
2 answers

Can a http server detect that a client has cancelled their request?

My web app must process and serve a lot of data to display certain pages. Sometimes, the user closes or refreshes a page while the server is still busy processing it. This means the server will continue to process data for several minutes only to…
Nick Retallack
  • 17,432
  • 17
  • 85
  • 110
16
votes
2 answers

Retrofit 2.0 cancel a Call object

Has anyone played around with Retrofit 2.0, specifically the Call.cancel() method? When is the best time to trigger that? I have tried calling it in onStop() of a Fragment but have run into some issues with a call being cancelled when the screen…
toobsco42
  • 6,131
  • 16
  • 73
  • 85
13
votes
7 answers

How to cancel ajax request that has run (on server side)

I was wondering if there's a simple way to cancel an AJAX request? Beyond just calling an 'abort' on the XMLHTTPRequest on the client side, is there a way to easily stop the server process? The server is using Apache. Thanks
AndreLiem
  • 1,951
  • 5
  • 19
  • 26
9
votes
12 answers

jQuery - Cancel form submit (using "return false"?)?

I'm running into a bit of trouble while trying to cancel the submit of a form. I've been following this tutorial (even though i'm not making a login script), and it seems to be working for him. Here's my form:
Nike
  • 1,189
  • 3
  • 8
  • 8
8
votes
1 answer

How to correctly cancel an outstanding Ajax request that will never complete?

This question is like another, except that one is asked in the context of JQuery, which I don't use. Ajax code on my page issues a POST every ten seconds. Once in a while -- every ~600 requests -- my client code hangs waiting for a response that…
Pete Wilson
  • 8,198
  • 6
  • 33
  • 50
8
votes
3 answers

How can I pause a BackgroundWorker? Or something similar

I was using a BackgroundWorker to download some web sites by calling WebClient.DownloadString inside a loop. I wanted the option for the user to cancel in the middle of downloading stuff, so I called CancelAsync whenever I found that…
Juan
  • 14,232
  • 22
  • 91
  • 175
7
votes
5 answers

how to cancel http request using javascript

i have a page on which there an event handler attached to an onclick event. when the event fires it passes contents of a textbox to a GET request. since the url is not in the same domain so i create a script tag and and attach the url to its source…
lovesh
  • 4,813
  • 7
  • 55
  • 89
6
votes
2 answers

cancelPreviousPerformRequestWithTarget is not canceling my previously delayed thread started with performSelector

I've launched a delayed thread using performSelector but the user still has the ability to hit the back button on the current view causing dealloc to be called. When this happens my thread still seems to be called which causes my app to crash…
jmurphy
  • 1,891
  • 3
  • 22
  • 28
5
votes
2 answers

Are PHP processes called via AJAX cancelled on "ESC"?

If I do an AJAX call, would the AJAX call be canceled if the user pressed "ESC" or leaved that page? If the AJAX call gets canceled, would my PHP script continue to run until it finished what it was doing (provided time limit doesn't get reached or…
Andrei Serdeliuc ॐ
  • 5,590
  • 5
  • 37
  • 64
5
votes
2 answers

How can you tell if the user hit cancel during a download from a Java servlet?

How can you tell if the user hit cancel during a download from a Java servlet? What seem to happen for me with IE, the output stream println() blocks. The used hit cancel, but is there a way to time this out or anything like that?
GC_
  • 1,613
  • 4
  • 22
  • 37
4
votes
6 answers

How to cancel a deeply nested process

I have a class that is a "manager" sort of class. One of it's functions is to signal that the long running process of the class should shut down. It does this by setting a boolean called "IsStopping" in class. public class Foo { bool…
Erik Funkenbusch
  • 90,480
  • 27
  • 178
  • 274
3
votes
2 answers

TCP connections with overlapped I/O

Is it possible to initiate a TCP connection request with overlapped I/O, and cancel it before the connection has been completed in Windows? I need to support at least Windows XP SP2.
Jörgen Sigvardsson
  • 4,626
  • 2
  • 24
  • 50
3
votes
4 answers

Java Threads: Shutdown flag vs Catching Exception

In threads when dealing with cancelation, you often you see code like this while (!shutdown) { .. do something, if a blocking call, then it will throw the interrupted exception try { .. some more ... } catch (InterruptedException e) { …
sksamuel
  • 15,025
  • 8
  • 54
  • 97
1
2 3 4 5