Reputation: 43
First of all I'm very excited that Embarcadero/Idera finally decided to include a build-in component for HTTP/S communication!
And I know that this sounds like a silly question (and maybe it is) ... but I'm having problems finding the property (or something) to set a custom TimeOut (response, receive, ...).
Can somebody point me to the right direction?
Upvotes: 2
Views: 3254
Reputation: 81
I too had a similar problem, though I only needed to be able to set a custom value for the connection timeout. I had to copy and modify two RTL files to accomplish this. First my modifications to the System.Net.Http.Client.pas file:
THTTPClient = class(TURLClient)
...
private
FConnectTimeout: Integer; // <---- add this line
...
public
property ConnectTimeout: Integer read FConnectTimeout write FConnectTimeout; // <---- add this line
Here are my modifications to the System.Net.HttpClient.Win.pas file:
procedure TWinHTTPRequest.DoPrepare;
var // <---- add this line
LConnectTimeout: integer; // <---- add this line
begin
inherited;
SetWinProxySettings;
LConnectTimeout := THTTPClient(FClient).ConnectTimeout; // <---- add this line
WinHttpSetOption(FWRequest, WINHTTP_OPTION_CONNECT_TIMEOUT, @LConnectTimeout, sizeof(LConnectTimeout)); // <---- add this line
end;
These modifications are for the Delphi 10 Seattle RTL files. Hope this helps!
Upvotes: 3