Using TIdhttp and Digest Authentication

Giganews Newsgroups
Subject: Using TIdhttp and Digest Authentication
Posted by:  Gregoire (gregoi…@gedesoft.de)
Date: Thu, 18 Sep 2008

I like to add digest authentication support to my application using TIdhttp.

I have read the related indy documentation and a lot of information around
the web.

I added
#include <IdAuthenticationDigest.hpp>

and register the method with
RegisterAuthenticationMethod("Digest", __classid(TIdDigestAuthentication));

Afterwards I tried to set the authentication method to digest
authentication, but
this doesn´t work.
IdHTTP1->Request->Authentication = new TIdDigestAuthentication();

The error is:
Cannot create instance of abstract class "TIdDigestAuthentication" because
'_fastcall TIdAuthentication::KeepAlive() = 0'

Wondering why this work:
IdHTTP1->Request->Authentication = TIdBasicAuthentication();

When trying to run the code without the line:
IdHTTP1->Request->Authentication = new TIdDigestAuthentication();

i got an error EIdInvalidAlgorithm... so it seems to work in general, but
Indy only support MD5... but my web server also use MD5 for digest
authentication. So i´m wondering why this exception is thrown at all and if
it is related to the missing assignment of the correct authentication method
or just a misinterpretation? How can i easily check which method is reported
to Indy by the web server?

Is the following line mandatory or does Indy automatically select the right
authentication method?
IdHTTP1->Request->Authentication = new TIdDigestAuthentication();

I´m using indy version 9 shipped with C++Builder 2007.

Any help is much appreciated.
Gregoire

Replies