🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #317

Re: C++ Builder 2007 & Indy10 + Digest auth...

#317
From: Jyrki Saario
Date: Mon, 14 Apr 2008 17:39
55 lines
2746 bytes
Remy Lebeau (TeamB) kirjoitti:
>> I try to connect to server what uses Digest authentication to
>> download page under URL: http://192.168.0.10/rmt/index.shtml
>>
>> When I run my program, I will get exception HTTP/1.0 401 Unauthorized 
>> access
> 
> What do you have the AuthRetries and MaxAuthRetries properties set to?

AuthRetries can not be set, but when I read value it's 0. MaxAuthRetries 
is set to 3.

>>    HTTP->Get("http://192.168.0.10/rmt/index.shtml", stream);
>>    stream->Position = 0;
>>    stream->SaveToFile(DirPathEdit->Text + "\Test.html");
> 
> If you use a TFileStream instead, you can avoid saving the file to memory 
> first:
> 
>     TFileStreamStream *stream = new TFileStream(DirPathEdit->Text + 
> "\Test.html", fmCreate);
>     HTTP->Get("http://192.168.0.10/rmt/index.shtml", stream);

You are absolutely right. I will change it...

>>    stream->Free();
> 
> Use the 'delete' operator instead of calling Free() directly:
> 
>     delete stream;
OK.

>> in HTTPSelectAuthorization event, I can find this information
>> from AuthInfo->Text:
> <snip>
> 
> Are you getting an OnAuthorization event triggered at all?

Yes. It's triggered. This information is taken from event trigger:
AuthInfo->Text:
Digest realm="WebPage Configuration", 
nonce="MDAwMDAwMDA2MDo1MzQ6MTkyLjE2OC4yMzAuMjUz", algorithm=MD5, 
domain="Agent: Mozilla/3.0 (compatible; Indy Library)", qop="auth"

And AuthenticationClass->ClassName() shows:
TIdDigestAuthentication

> Did you verify with a packet sniffer that TIdHTTP is even attempting to 
> login with the Digest credentials at all?

Wireshark is now downloaded, I will take a deeper look...



J.S
Technical Details
Message-ID: <480396b8$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <48035008@newsgroups.borland.com> <480388e6$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,d2c1cbe3fa01c
X-Google-Attributes: gid11508e,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Mon, 14 Apr 2008 20:39:04 +0300
From: Jyrki Saario <no_mail@invalid.inv>
User-Agent: Thunderbird 2.0.0.12 (Windows/20080213)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: Re: C++ Builder 2007 & Indy10 + Digest auth...
References: <48035008@newsgroups.borland.com> <480388e6$1@newsgroups.borland.com>
In-Reply-To: <480388e6$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 88.113.54.88
Message-ID: <480396b8$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1208194744 88.113.54.88 (14 Apr 2008 10:39:04 -0700)
Lines: 55
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail