- Timestamp:
- Apr 30, 2011, 10:54:24 PM (14 years ago)
- Location:
- Network/CoolWeb
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
Network/CoolWeb/CoolWeb.lpk
r222 r237 20 20 <License Value="GNU/GPL"/> 21 21 <Version Minor="1"/> 22 <Files Count="1 6">22 <Files Count="17"> 23 23 <Item1> 24 24 <Filename Value="WebServer/UHTTPServer.pas"/> … … 27 27 <Item2> 28 28 <Filename Value="WebServer/UHTTPServerCGI.pas"/> 29 <HasRegisterProc Value="True"/> 29 30 <UnitName Value="UHTTPServerCGI"/> 30 31 </Item2> 31 32 <Item3> 32 33 <Filename Value="WebServer/UHTTPServerTCP.pas"/> 34 <HasRegisterProc Value="True"/> 33 35 <UnitName Value="UHTTPServerTCP"/> 34 36 </Item3> 35 37 <Item4> 36 38 <Filename Value="WebServer/UHTTPSessionFile.pas"/> 39 <HasRegisterProc Value="True"/> 37 40 <UnitName Value="UHTTPSessionFile"/> 38 41 </Item4> 39 42 <Item5> 40 43 <Filename Value="WebServer/UHTTPSessionMySQL.pas"/> 44 <HasRegisterProc Value="True"/> 41 45 <UnitName Value="UHTTPSessionMySQL"/> 42 46 </Item5> … … 85 89 <UnitName Value="UXmlClasses"/> 86 90 </Item16> 91 <Item17> 92 <Filename Value="WebServer/UWebPage.pas"/> 93 <UnitName Value="UWebPage"/> 94 </Item17> 87 95 </Files> 88 96 <Type Value="RunAndDesignTime"/> -
Network/CoolWeb/CoolWeb.pas
r95 r237 8 8 9 9 uses 10 UHTTPServer, UHTTPServerCGI, UHTTPServerTCP, UHTTPSessionFile, 10 UHTTPServer, UHTTPServerCGI, UHTTPServerTCP, UHTTPSessionFile, 11 11 UHTTPSessionMySQL, USqlDatabase, UTCPServer, UPageList, UUser, UCommon, 12 12 UHtmlClasses, UMemoryStreamEx, UMIMEType, UPool, UResetableThread, 13 UXmlClasses, LazarusPackageIntf;13 UXmlClasses, UWebPage, LazarusPackageIntf; 14 14 15 15 implementation … … 17 17 procedure Register; 18 18 begin 19 RegisterUnit('UHTTPServerCGI', @UHTTPServerCGI.Register); 20 RegisterUnit('UHTTPServerTCP', @UHTTPServerTCP.Register); 21 RegisterUnit('UHTTPSessionFile', @UHTTPSessionFile.Register); 22 RegisterUnit('UHTTPSessionMySQL', @UHTTPSessionMySQL.Register); 19 23 end; 20 24 -
Network/CoolWeb/WebServer/UHTTPServer.pas
r104 r237 77 77 { THTTPSessionStorage } 78 78 79 THTTPSessionStorage = class 79 THTTPSessionStorage = class(TComponent) 80 80 procedure Load(HandlerData: THTTPHandlerData); virtual; 81 81 procedure Save(HandlerData: THTTPHandlerData); virtual; 82 constructor Create ; virtual;82 constructor Create(AOwner: TComponent); override; 83 83 destructor Destroy; override; 84 84 end; … … 86 86 { THTTPServer } 87 87 88 THTTPServer = class 88 THTTPServer = class(TComponent) 89 89 private 90 FDocumentRoot: string; 90 91 FOnRequest: TRequestEvent; 92 FSessionStorage: THTTPSessionStorage; 91 93 FShowExceptions: Boolean; 92 94 procedure SetShowExceptions(const AValue: Boolean); 93 95 public 94 Name: string;95 DocumentRoot: string;96 SessionStorage: THTTPSessionStorage;97 ShowExceptions: Boolean;98 96 procedure Run; virtual; 99 97 procedure ErrorResponse(HandlerData: THTTPHandlerData); 100 98 procedure FileResponse(HandlerData: THTTPHandlerData); 101 99 procedure ServerInfo(HandlerData: THTTPHandlerData); virtual; 102 constructor Create ;100 constructor Create(AOwner: TComponent); override; 103 101 destructor Destroy; override; 102 published 103 property ShowExceptions: Boolean read FShowExceptions write SetShowExceptions; 104 property DocumentRoot: string read FDocumentRoot write FDocumentRoot; 105 property SessionStorage: THTTPSessionStorage read FSessionStorage 106 write FSessionStorage; 104 107 property OnRequest: TRequestEvent read FOnRequest write FOnRequest; 105 property ShowExceptions: Boolean read FShowExceptions write SetShowExceptions;106 108 end; 107 109 … … 200 202 end; 201 203 202 constructor THTTPServer.Create; 203 begin 204 constructor THTTPServer.Create(AOwner: TComponent); 205 begin 206 inherited; 204 207 ShowExceptions := False; 205 208 DocumentRoot := './'; 206 Name := 'THTTPServer';207 209 end; 208 210 209 211 destructor THTTPServer.Destroy; 210 212 begin 211 SessionStorage.Free;212 213 inherited Destroy; 213 214 end; … … 351 352 constructor THTTPSessionStorage.Create; 352 353 begin 353 354 inherited; 354 355 end; 355 356 -
Network/CoolWeb/WebServer/UHTTPServerCGI.pas
r104 r237 16 16 EnvVars: TStringList; 17 17 procedure Run; override; 18 constructor Create ;18 constructor Create(AOwner: TComponent); override; 19 19 destructor Destroy; override; 20 20 procedure ServerInfo(HandlerData: THTTPHandlerData); override; 21 21 end; 22 23 24 procedure Register; 22 25 23 26 implementation … … 26 29 SEnvironmentVariables = 'Environment variables:'; 27 30 31 procedure Register; 32 begin 33 RegisterComponents('CoolWeb', [THTTPServerCGI]); 34 end; 35 36 28 37 { THTTPServerCGI } 29 38 30 constructor THTTPServerCGI.Create ;39 constructor THTTPServerCGI.Create(AOwner: TComponent); 31 40 begin 32 41 inherited; -
Network/CoolWeb/WebServer/UHTTPServerTCP.pas
r94 r237 14 14 THTTPServerTCP = class(THTTPServer) 15 15 private 16 FMaxConnection: Integer; 16 17 procedure HandleClient(Sender: TObject); 17 18 public 18 19 Socket: TTCPServer; 19 MaxConnection: Integer;20 20 RequestHandlerList: TRequestHandlerList; 21 constructor Create ;21 constructor Create(AOwner: TComponent); override; 22 22 destructor Destroy; override; 23 published 24 property MaxConnection: Integer read FMaxConnection write FMaxConnection; 23 25 end; 26 27 procedure Register; 24 28 25 29 implementation 26 30 31 procedure Register; 32 begin 33 RegisterComponents('CoolWeb', [THTTPServerTCP]); 34 end; 35 27 36 procedure THTTPServerTCP.HandleClient(Sender: TObject); 28 37 var 29 RequestHandler: TRequestHandler;30 38 Line: string; 31 39 LineIndex: Integer; … … 119 127 { THTTPServerTCP } 120 128 121 constructor THTTPServerTCP.Create ;129 constructor THTTPServerTCP.Create(AOwner: TComponent); 122 130 begin 123 131 inherited; -
Network/CoolWeb/WebServer/UHTTPSessionFile.pas
r94 r237 14 14 THTTPSessionStorageFile = class(THTTPSessionStorage) 15 15 private 16 FDirectory: string; 17 FSessionIdCookieName: string; 18 FTimeout: Integer; 16 19 Lock: TCriticalSection; 17 20 function GetNewSessionId: string; 18 21 procedure GetSessionId(HandlerData: THTTPHandlerData); 19 22 public 20 Timeout: Integer; // in seconds21 Directory: string;22 SessionIdCookieName: string;23 23 Sessions: TStringList; 24 24 procedure Load(HandlerData: THTTPHandlerData); override; 25 25 procedure Save(HandlerData: THTTPHandlerData); override; 26 constructor Create ; override;26 constructor Create(AOwner: TComponent); override; 27 27 destructor Destroy; override; 28 published 29 property Timeout: Integer read FTimeout write FTimeout; // in seconds 30 property Directory: string read FDirectory write FDirectory; 31 property SessionIdCookieName: string read FSessionIdCookieName 32 write FSessionIdCookieName; 28 33 end; 29 34 35 procedure Register; 36 30 37 implementation 38 39 procedure Register; 40 begin 41 RegisterComponents('CoolWeb', [THTTPSessionStorageFile]); 42 end; 43 31 44 32 45 { THTTPSession } … … 88 101 end; 89 102 90 constructor THTTPSessionStorageFile.Create ;103 constructor THTTPSessionStorageFile.Create(AOwner: TComponent); 91 104 begin 92 inherited Create;105 inherited; 93 106 Lock := TCriticalSection.Create; 94 107 Sessions := TStringList.Create; -
Network/CoolWeb/WebServer/UHTTPSessionMySQL.pas
r94 r237 12 12 { TFileHTTPSessionStorage } 13 13 14 { THTTPSessionStorageMySQL } 15 14 16 THTTPSessionStorageMySQL = class(THTTPSessionStorage) 15 17 private 18 FSessionIdCookieName: string; 19 FTimeout: Integer; 16 20 Lock: TCriticalSection; 17 21 function GetNewSessionId: string; 18 22 procedure GetSessionId(HandlerData: THTTPHandlerData); 19 23 public 20 Timeout: Integer; // in seconds21 24 SqlDatabase: TSqlDatabase; 22 SessionIdCookieName: string;23 25 Sessions: TStringList; 24 26 procedure Load(HandlerData: THTTPHandlerData); override; 25 27 procedure Save(HandlerData: THTTPHandlerData); override; 26 constructor Create ; override;28 constructor Create(AOwner: TComponent); override; 27 29 destructor Destroy; override; 30 published 31 property Timeout: Integer read FTimeout write FTimeout; // in seconds 32 property SessionIdCookieName: string read FSessionIdCookieName 33 write FSessionIdCookieName; 28 34 end; 29 35 36 procedure Register; 37 30 38 implementation 39 40 procedure Register; 41 begin 42 RegisterComponents('CoolWeb', [THTTPSessionStorageMySQL]); 43 end; 44 31 45 32 46 { THTTPSession } … … 110 124 end; 111 125 112 constructor THTTPSessionStorageMySQL.Create ;126 constructor THTTPSessionStorageMySQL.Create(AOwner: TComponent); 113 127 begin 114 inherited Create;128 inherited; 115 129 Lock := TCriticalSection.Create; 116 130 Sessions := TStringList.Create;
Note:
See TracChangeset
for help on using the changeset viewer.