File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -431,8 +431,6 @@ constructor TRALServer.Create(AOwner: TComponent);
431431 FShowServerStatus := True;
432432 FCookieLife := 30 ;
433433 FSSL := CreateRALSSL;
434-
435- ResponsePages.CreateDefaultPages;
436434end ;
437435
438436function TRALServer.CreateRALSSL : TRALSSL;
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ TRALSynopseServer = class(TRALServer)
4646 procedure SetSSL (const AValue: TRALSynopseSSL);
4747 function OnCommandProcess (AContext: THttpServerRequestAbstract): Cardinal;
4848 function OnSendFile (AContext: THttpServerRequestAbstract; const LocalFileName: TFileName): boolean;
49+ procedure OnHttpTerminate (ASender : TObject);
4950 public
5051 constructor Create(AOwner: TComponent); override;
5152 destructor Destroy; override;
@@ -96,6 +97,7 @@ procedure TRALSynopseServer.SetActive(const AValue: boolean);
9697 FHttp.HttpQueueLength := FQueueSize;
9798 FHttp.OnSendFile := { $IFDEF FPC} @{ $ENDIF} OnSendFile;
9899 FHttp.ServerName := ' RAL_Mormot2' ;
100+ FHttp.OnTerminate := { $IFDEF FPC} @{ $ENDIF} OnHttpTerminate;
99101 // FHttp.RegisterCompressGzStatic := True;
100102 FHttp.OnRequest := { $IFDEF FPC} @{ $ENDIF} OnCommandProcess;
101103 if SSL.Enabled then
@@ -312,6 +314,11 @@ function TRALSynopseServer.OnSendFile(AContext: THttpServerRequestAbstract;
312314 Result := True;
313315end ;
314316
317+ procedure TRALSynopseServer.OnHttpTerminate (ASender: TObject);
318+ begin
319+ Active := False;
320+ end ;
321+
315322constructor TRALSynopseServer.Create(AOwner: TComponent);
316323begin
317324 inherited ;
Original file line number Diff line number Diff line change @@ -48,17 +48,23 @@ function TRALResponsePages.GetHTMLPage(AStatusCode: IntegerRAL): StringRAL;
4848var
4949 vInt: IntegerRAL;
5050 vPage: TRALResponsePage;
51+ vFind: boolean;
5152begin
5253 Result := ' ' ;
54+ vFind := False;
5355 for vInt := 0 to Pred(Count) do
5456 begin
5557 vPage := TRALResponsePage(Items[vInt]);
5658 if vPage.StatusCode = AStatusCode then
5759 begin
5860 Result := vPage.Page.Text;
59- Exit;
61+ vFind := True;
62+ Break;
6063 end ;
6164 end ;
65+
66+ if not vFind then
67+ Result := GetHTTPResponsePage(AStatusCode);
6268end ;
6369
6470constructor TRALResponsePages.Create(AOwner: TPersistent);
You can’t perform that action at this time.
0 commit comments