{ $HDR$} {**********************************************************************} { Unit archived using Team Coherence } { Team Coherence is Copyright 2002 by Quality Software Components } { } { For further information / comments, visit our WEB site at } { http://www.TeamCoherence.com } {**********************************************************************} {} { $Log: 11261: HTTPServer.pas { Rev 1.3 6/18/2003 11:58:34 PM BGooijen uses ResponseInfo.ServeFile now } { Rev 1.2 6/18/2003 7:37:20 PM BGooijen Works now } { Rev 1.1 4/4/2003 7:43:46 PM BGooijen compile again } { { Rev 1.0 11/12/2002 09:18:44 PM JPMugaas { Initial check in. Import from FTP VC. } unit HTTPServer; interface uses IndyBox, Classes, IdGlobal, IdCustomHTTPServer, IdHTTPServer,IdContext, IdTCPServer; type THTTPServer = class(TIndyBox) protected FMIMEType : TIdMIMETable; FUseAuthenticaiton : Boolean; FManageSessions : Boolean; function GetMIMEType(sFile: String): String; public constructor Create(AOwner : TComponent); override; destructor Destroy; override; procedure HTTPServerCommandGet(AContext:TIdContext; RequestInfo: TIdHTTPRequestInfo; ResponseInfo: TIdHTTPResponseInfo); procedure Test; override; end; implementation uses IdHTTP, IdCoreGlobal, SysUtils{$IFDEF VER130},FileCtrl{$ENDIF}; const sauthenticationrealm = 'Indy http server demo'; { THTTPServer } constructor THTTPServer.Create(AOwner: TComponent); begin inherited Create(AOwner); FMIMEType := TIdMIMETable.Create(True); end; destructor THTTPServer.Destroy; begin FMIMEType.Free; inherited Destroy; end; function THTTPServer.GetMIMEType(sFile: String): String; begin Result := FMIMEType.GetFileMIMEType(sFile) end; procedure THTTPServer.HTTPServerCommandGet(AContext:TIdContext; RequestInfo: TIdHTTPRequestInfo; ResponseInfo: TIdHTTPResponseInfo); procedure AuthFailed; begin ResponseInfo.ContentText := '