Working with a synchronous sockets, all the timeouts are set but occasionally somtimes the thread hangs forever [at the request stage that is idHTTP.Get]. Only restart helps.
Who solves this problem?
There is no way to diagnose this without more information. What URL are you accessing? Is the freeze happening when sending the request, or when reading the response? What does the actual HTTP traffic look like? Do you have a reproducible case you can share to verify this?
I want to emphasize that the temporary freezing of the thread is not a problem - it is a secondary thread, the problem is that the timeout seems to be infinite.
Indy does use infinite timeouts by default, but you are overwriting them, so they should be working.
I will say that in some VERY RARE cases, I have seen Winsock's select() function freeze indefinitely even though data was available and a timeout was used, but that was an OS issue, not a Indy issue. Doubtful that is what you are encountering, but I'm just throwing that out here.
More nuances: I work with HTTPS via HTTPS proxy. Otherwise works well, if not for the occasional hang.
Are you getting the hang while connected to the proxy? At what stage during the proxy operations does the hang happen?
Some peace of code:
So, it is not even your code that is freezing, it is someone else's code?
FIDSSL.ConnectTimeout:=10000;
FIDSSL.ReadTimeout:=16000;
...
FHTTPClient.Socket.ReadTimeout:=20000;
FHTTPClient.Socket.ConnectTimeout:=10000;
All of those assignments are redundant and should be removed. The Socket property points at the SSL object, so the same properties are being set twice. And the inherited Connect() method will overwrite them anyway with values from the client object.