Re: IidHTTP basic and digest authentication (indy 9)

Giganews Newsgroups
Subject: Re: IidHTTP basic and digest authentication (indy 9)
Posted by:  m (ma…@edwards.org)
Date: Fri, 20 Jan 2006

Chris Hofstede wrote:
> Hi,
>
> I'm trying to put files on a webserver with protected folders using the
> TidHTTP component. These protected folders either use basic or digest
> authentication (depends on the webserver). Does anyone have an example or
> idea how to set this up in C++ with TidHTTP (indy 9)? I've searched the
> online documentation and the Internet but they don't really give a clue what
> to do without diving into the source code first.

You have to translate my code below to C++, but it should give an idea
of how to do basic authentication. This code assumes TidHTTP is "http"
and that "sitepassword" and "sitelogin" are strings:

if sitepassword <> '' then
  begin
    http.request.BasicAuthentication:=true;
    http.request.username:=sitelogin;
    http.request.password:=sitepassword;
  end;

[ then do http.put or http.post or http.get etc. ]

That works for basic authentication, I don't know how to digest but you
can look at the TidDigestAuthentication unit for details. Also, you
might switch to Indy 10 because, unless I'm mistaken, it has better
support for authentication in the TidHTTP component using a property, of
AuthenticationManager and related object.

Replies

None

In response to

IidHTTP basic and digest authentication (indy 9) posted by Chris Hofstede on Wed, 18 Jan 2006