Browse Source

* Clear request/response variables in case of an error

git-svn-id: trunk@25179 -
michael 12 years ago
parent
commit
db0585f388
1 changed files with 7 additions and 4 deletions
  1. 7 4
      packages/fcl-web/src/base/custhttpapp.pp

+ 7 - 4
packages/fcl-web/src/base/custhttpapp.pp

@@ -219,10 +219,13 @@ procedure TFPHTTPServerHandler.HTTPHandleRequest(Sender: TObject;
   var AResponse: TFPHTTPConnectionResponse);
   var AResponse: TFPHTTPConnectionResponse);
 begin
 begin
   // Exceptions are handled by (Do)HandleRequest. It also frees the response/request
   // Exceptions are handled by (Do)HandleRequest. It also frees the response/request
-  DoHandleRequest(ARequest,AResponse);
-  ARequest:=Nil;
-  AResponse:=Nil;
-  If Terminated then
+  try
+    DoHandleRequest(ARequest,AResponse);
+  finally  
+    ARequest:=Nil;
+    AResponse:=Nil;
+  end;    
+  If Terminated And Assigned(FServer) then
     FServer.Active:=False;
     FServer.Active:=False;
   if Assigned(OnIdle) then
   if Assigned(OnIdle) then
     OnIdle(Self);
     OnIdle(Self);