Re: Http Client - Exception yes or no?

Giganews Newsgroups
Subject: Re: Http Client - Exception yes or no?
Posted by:  Remy Lebeau \(Indy Team\) (re…
Date: Wed, 26 Oct 2011

"Christian Kaufmann" <christian.kaufma…> wrote in message

> I use the Indy Http Client and just noticed, that if the server
> sends a 401 response, I don't get it as exception, but if the
> server sends a 404 response, I get an exception.

401 means the server is asking for authentication.  TIdHTTP handles it
internally.  It will not raise an exception until the max number of
authentication attempts is reached (see the TIdHTTP.MaxAuthRetries

404 is an actual error, so TIdHTTP passes it along to your code as an
exeption, as the request actually failed with an error (in this case, a
"file not found" error).

Not every non-200 response reply is an error.

> I don't understand excactly, when the Http client raises an Exception
> and when it doesn't. Is there any documentation about that?


Remy Lebeau (Indy Team)



In response to

Http Client - Exception yes or no? posted by Christian Kaufmann on Wed, 26 Oct 2011