Subject: Canceling a HTTP request

From: "Charumathy Venkatraman" <[email-masked]>
Date: Mon, 20 Oct 2003 12:17:15 +0530

Hi,
I'm new to HTTP and I have a basic question. 
My HTTP client will issue GET and POST requests to a HTTP 1.1 server. There
is a requirement from the caller to be able to cancel both GET and POST. My
understanding is that the only way to cancel the transaction is to close the
socket before the transaction completes. Is that correct? Will the server
automatically discard the data (in case of POST) when this is done?

Thanks,
Charu.

---

From: David Morris <[email-masked]>
Date: Mon, 20 Oct 2003 09:09:54 -0700 (PDT)

Your understanding is correct. There is no way to cancel an HTTP request
once the complete request has been sent. Closing the connection abandons
results which may have been completed. For various reasons including
network latencies and design of the HTTP server, it is likely that the
application running within the HTTP server will never be aware that the
connection was closed.

Any application which depends on the user's ability to cancel a request
once sent probably needs to be redesigned. For example, the user could be
engaged in a 'two phase commit'-like interaction where the action must be
confirmed by a second web transaction. Application design issues are
probably beyond the scope of this list. I'm willing to clarify my comments
off line but actual design assistance is what I do for a living so I won't
be able to volunteer a lot of help.

Dave Morris

---

From: Alex Rousskov <[email-masked]>
Date: Mon, 20 Oct 2003 10:56:46 -0600 (MDT)

I would phrase it differently: there is no general way to cancel
effects of a request once a portion of a request message has left the
client. Certain servers may start acting before receiving the request
body or even before receiving complete request headers. Specifics
would depend on the server and what it is that you actually want to
cancel, of course.

Even if you control the client and the server, it is probably
impossible to know for sure that the client did not cancel! HTTP
intermediaries will prevent you from relying on TCP properties such as
reliable delivery. David's suggestion to redesign the interface is
probably the only option.

Alex.