The question is about HTTP get implemented in a thread using IdHTTP. I want to terminate the thread gracefully if needed. For this purpose I check the Terminated property periodically within the HTTPWork event of IdHTTP. If the the terminate property is set then IdHTTP.disconnect method is called and the thread terminates.
This works fine, however consider the following problematic scenario:
For some reason the network goes down when the thread is started. After a timeout there is a socket error exception which is also OK, however during the timeout interval there are no events fired from IdHTTP, and therefore there is no way to check for the terminated property. So the question is how to gracefully terminate a thread which uses IdHTTP during a connection timeout?