Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Basic Authentication problem with Apache DSO

4 views
Skip to first unread message

Fabrizio Vita

unread,
Oct 30, 2001, 2:30:44 PM10/30/01
to
Hi everybody,
I have ported my Isapi applications to Apache DSO technology and I'm quite
happy of it: performance seems better and I can debug with Apache easily,
while debugging with IIS it's a nightmare.

I have encountered only one problem: it seems that the property
TWebRequest.Authorization does not work with Apache (always it gives empty
string), so I cannot use basic authentication, while with Isapi it works.
Any idea ?


I use Delphi 6 (no update pack) + Apache 1.3.19; this is my code:


...
Authorized := FALSE;

DecodeUserNameAndPassword(Request.Authorization, Userid, Password);
if (Userid = '') and (Password = '') then exit;

Authorized := TRUE;
...


{ Added by Shiv }
procedure DecodeUserNameAndPassword(EncodedString : string;
var UserName, Password : string);
var
DecodedString : string;
begin
{ EnocodedString will look like this:Basic c2hpdjptYXRsdXM= }
{ Remove the word Basic }
EncodedString := Copy(EncodedString, 7, Length(EncodedString));
{ Use only the text upto the "=" sign }
EncodedString := Copy(EncodedString,1, Pos('=',EncodedString) -1);
{ Decode the text }
DecodedString := MimeDecodeString(EncodedString);
{ Extract the UserName and Password }
UserName := Copy(DecodedString,1,Pos(':', DecodedString) -1);
Delete(DecodedString,1,Pos(':', DecodedString));
Password := DecodedString;
end;

Fabrizio Vita


John Howard

unread,
Nov 2, 2001, 4:25:46 PM11/2/01
to
Hi Fabrizio -
I actually have a question for YOU since it looks like you know Apache
better than I do!

When I try to call my dll via my browser, I get a message telling me I am
downloading the file, and asking if I want to open or save to disk. Of
course, I don't want to download. I want to execute!

When I change the settings, then I get a page of garbled characters that
says at the top "This program must run under windows".

QUESTION -- Please send me a snip from your httpd.conf file that permits you
to run dlls
under Apache.

I am a complete beginner with Apache.

Thanks!
- John Howard
Santa Rosa, CA

"Fabrizio Vita" <fabriz...@logontec.it> wrote in message
news:3bdf0025_2@dnews...

Andrew McIntyre

unread,
Nov 5, 2001, 8:43:17 AM11/5/01
to
On Tue, 30 Oct 2001 20:30:44 +0100, "Fabrizio Vita"
<fabriz...@logontec.it> wrote:

>Hi everybody,
>I have ported my Isapi applications to Apache DSO technology and I'm quite
>happy of it: performance seems better and I can debug with Apache easily,
>while debugging with IIS it's a nightmare.
>
>I have encountered only one problem: it seems that the property
>TWebRequest.Authorization does not work with Apache (always it gives empty
>string), so I cannot use basic authentication, while with Isapi it works.
>Any idea ?
>
>

This may help - the Authentication code does not seem to be
implemented in the apache unit but this code will get the string you
are after

This is a code sample that retrieves the Authorization string


Result := false;
//now see if exists
s := Request.GetFieldByName('Authorization'); <--- this is it
//if exists, parse it
if Length(s) > 0 then
begin
if AnsiCompareText(LeftOf(' ',s) , 'Basic') = 0 then
---> now decode from base 64 etc


Andrew McIntyre

John Howard

unread,
Nov 6, 2001, 6:25:24 PM11/6/01
to
I solved this myself. No need to reply.

Thanks,
- John


"John Howard" <joho...@home.com> wrote in message news:3be30f59_2@dnews...

0 new messages