found it, required this line in the OnGet event

  if Flags = hg401 then
    Exit;


rgn> hi, i am trying to write a wrapper class for httpserv.
rgn> unfortunately i have problems implementing the digest auth.

rgn> function THttpConnection.AuthDigestGetParams always returns false here:

rgn>     t1 := EncodeTime(1, 0, 0, 0);
rgn>     t2 := Now;
rgn>     try
rgn>         LastTime :=
rgn> RFC822ToDateTime(Trim(Base64Decode(FAuthDigestNonce)));
rgn>     except
rgn>         Exit;
rgn>     end;

rgn>     if (LastTime + t1) > t2 then
rgn>         Result := TRUE;    // THAT IS NOT THE CASE IN MY CODE

rgn> what is happening here ? the overbyte example always returns true even
rgn> i dont find the difference.

rgn> my code:
rgn> constructor TmyWebServer.Create;
rgn> begin
rgn>   FSrv := THttpServer.Create(nil);
rgn>   FAuthPages := TAuthPages.Create;
rgn>   with FSrv do begin
rgn>     Port := inttostr(ListenPort);
rgn>     OnGetDocument := HttpServerOnGetDocument;
rgn>     OnPostDocument := HttpServerOnPostDocument;
rgn>     OnPostedData := HttpServerOnPostedData;
rgn>     OnAuthGetType := HttpServerOnAuthGetType;
rgn>     OnAuthGetPassword := HttpServerOnAuthGetPassword;
rgn>     ClientClass := TMyHttpConnection;
rgn>     Start;
rgn>   end;
rgn> end;

rgn> procedure TMyWebServer.HttpServerOnAuthGetType( Sender, Client: TObject);
rgn> var
rgn>   i : integer;
rgn> begin
rgn>   if (assigned(FAuthPages)) and (FAuthPages.Count > 0) then
rgn>     with TMyHttpConnection(Client) do
rgn>       for i := 0 to FAuthPages.Count - 1 do     // this checks if te
rgn> //      pageurl is saved in a list
rgn>         with FAuthPages.AsRecord(i) do
rgn>           if (CompareText (sPageUrl,Path) = 0) then
rgn>           begin
rgn>              AuthType := atDigest;
rgn>              AuthRealm := extractfilename(sPageUrl);
rgn>           end;
rgn> end;

rgn> procedure TmyWebServer.HttpServerOnAuthGetPassword(Sender:
rgn> TObject; Client: TObject; var Password: String);
rgn> var
rgn>   i: integer;
rgn> begin
rgn>   // this proc is never cALLED
rgn>   if (assigned(FAuthPages)) and (FAuthPages.Count > 0) then
rgn>     with TMyHttpConnection(Client) do
rgn>       for i := 0 to FAuthPages.Count - 1 do
rgn>         with FAuthPages.AsRecord(i) do
rgn>           if (CompareText (sPageUrl,Path) = 0) then
rgn>             if (CompareText (sUser,AuthUserName) = 0) then
rgn>             begin
rgn>                password := sPassword;
rgn>                exit;
rgn>             end;
rgn> end;






-- 
Mit freundlichen Grüßen
[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to