Reputation: 84540
I'm working on a web server built on Indy's HTTP server, and I've found that if I click on a request in the browser, and then on another one before the first one is finished processing, it can cause all sorts of problems. But I can't find any way to determine whether I'm in a canceled request or not. Each request takes place inside its own thread, so setting the thread to Terminated would be a good way to check, but that doesn't seem to be happening.
Is there any way I can get Indy to inform me that the request it's currently processing has been canceled by the browser that sent it and that it's now trying to load something different instead?
Upvotes: 3
Views: 164
Reputation: 595827
The only way a web browser can cancel an HTTP request in progress is to close its connection to the server. When that happens, TIdHTTPServer will raise an exception the next time it tries to access the disconnected socket. Just let the exception pass into TIdHTTPServer for default processing so it can terminate the calling thread and clean up the socket. This is normal behavior.
Upvotes: 5