Browse Source

Fix TFPHTTPConnectionThread.Execute repeat loop

Ondrej Pokorny 4 years ago
parent
commit
410916ab6b
1 changed files with 4 additions and 13 deletions
  1. 4 13
      packages/fcl-web/src/base/fphttpserver.pp

+ 4 - 13
packages/fcl-web/src/base/fphttpserver.pp

@@ -85,14 +85,8 @@ Type
     Property Server : TFPCustomHTTPServer Read FServer;
     Property OnRequestError : TRequestErrorHandler Read FOnError Write FOnError;
     Property LookupHostNames : Boolean Read GetLookupHostNames;
-<<<<<<< HEAD
-    Property EnableKeepAlive: Boolean read FEnableKeepAlive write FEnableKeepAlive;
-    Property KeepAliveEnabled: Boolean read FKeepAliveEnabled write FKeepAliveEnabled;
-=======
-
     // Set to true if you want to support HTTP 1.1 connection: keep-alive - only available for threaded server
     Property EnableKeepAlive: Boolean read FEnableKeepAlive write FEnableKeepAlive;
->>>>>>> Remove the KeepAlive* properties from TFPCustomHttpServer, rename KeepAliveEnabled to EnableKeepAlive
     // time-out for keep-alive: how many ms should the server keep the connection alive after a request has been handled
     Property KeepAliveTimeout: Integer read FKeepAliveTimeout write FKeepAliveTimeout;
     // is the current connection set up for KeepAlive?
@@ -235,13 +229,10 @@ Type
     Property OnGetSocketHandler : TGetSocketHandlerEvent Read FOnGetSocketHandler Write FOnGetSocketHandler;
     // Called after create socket handler was created, with the created socket handler.
     Property AfterSocketHandlerCreate : TSocketHandlerCreatedEvent Read FAfterSocketHandlerCreated Write FAfterSocketHandlerCreated;
-<<<<<<< HEAD
     // Set to true if you want to support HTTP 1.1 connection: keep-alive - only available for threaded server
     Property KeepAliveEnabled: Boolean read FKeepAliveEnabled write FKeepAliveEnabled;
     // time-out for keep-alive: how many ms should the server keep the connection alive after a request has been handled
     Property KeepAliveTimeout: Integer read FKeepAliveTimeout write FKeepAliveTimeout;
-=======
->>>>>>> Remove the KeepAlive* properties from TFPCustomHttpServer, rename KeepAliveEnabled to EnableKeepAlive
   end;
 
   TFPHttpServer = Class(TFPCustomHttpServer)
@@ -581,7 +572,7 @@ begin
   Try
     if FSetupSocket then
       begin
-      SetupSocket;
+    SetupSocket;
       FSetupSocket:=False;
       end;
     // Read headers.
@@ -659,8 +650,8 @@ begin
         if not Terminated and Connection.EnableKeepAlive and Connection.KeepAlive
         and not Connection.Socket.CanRead(Connection.KeepAliveTimeout) then
           break;
-        FConnection.HandleRequest;
-      until not (Terminated and FConnection.EnableKeepAlive and FConnection.KeepAlive and (FConnection.Socket.LastError=0));
+      FConnection.HandleRequest;
+      until not (not Terminated and FConnection.EnableKeepAlive and FConnection.KeepAlive and (FConnection.Socket.LastError=0));
     finally
       FreeAndNil(FConnection);
       if Assigned(FThreadList) then
@@ -988,7 +979,7 @@ begin
     try
       for I:= ThreadList.Count-1 downto 0 do
         try
-          CloseSocket(TFPHTTPConnectionThread(ThreadList[I]).Connection.Socket.Handle);
+        CloseSocket(TFPHTTPConnectionThread(ThreadList[I]).Connection.Socket.Handle);
         except
           // ignore exceptions during CloseSocket
         end