Re: Http Client - Exception yes or no?

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

"Christian Kaufmann" <christian.kaufma…@gmx.net> wrote in message
news:1r6ga7lbi4kmjs7kqjv48q2g6o31nhse…@4ax.com...

> 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
property).

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?

No.

--
Remy Lebeau (Indy Team)

Replies

None

In response to

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