Reputation: 36244
I am writing an hybrid (web/desktop) software and it happens to be loaded of synchronizations between the two modules.
I am trying to use as much HTTP Codes as possible in the communication between them.
In the server side I have Rails 3 and Ruby 1.9 (if that matters for this question). In the desktop side I am using Delphi 7 and Indy 9.0.50.
When I try to get updated data and there is nothing new in the server side, my server API returns code 304 (not modified) wich I understand as being the most apropriate code in this case. But the indy component (TidHTTPClient) raises a Timeout Exception (specificaly EIdReadTimeout). And it actually "waits" for a few seconds, causing a delay I am not comfortable with.
Is this behaviour ok? Am I using an unapropriate HTTP code? Is there a way to avoid the component from waiting for data once it will never come for sure?
Upvotes: 2
Views: 743
Reputation: 596226
TIdHTTP
in Indy 9 does not support conditional GET
requests. TIdHTTP
in Indy 10 does, and some of the overloaded versions of Get()
have a new AIgnoreReplies
parameter that you can pass 304
to if EIdHTTPProtocolException
exceptions are being raised.
Upvotes: 6