mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 20:09:25 +02:00
Fix TFPHTTPConnectionThread.Execute repeat loop
This commit is contained in:
parent
8fc1bc276f
commit
410916ab6b
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user