mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 22:39:36 +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 Server : TFPCustomHTTPServer Read FServer;
|
||||||
Property OnRequestError : TRequestErrorHandler Read FOnError Write FOnError;
|
Property OnRequestError : TRequestErrorHandler Read FOnError Write FOnError;
|
||||||
Property LookupHostNames : Boolean Read GetLookupHostNames;
|
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
|
// 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;
|
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
|
// 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;
|
Property KeepAliveTimeout: Integer read FKeepAliveTimeout write FKeepAliveTimeout;
|
||||||
// is the current connection set up for KeepAlive?
|
// is the current connection set up for KeepAlive?
|
||||||
@ -235,13 +229,10 @@ Type
|
|||||||
Property OnGetSocketHandler : TGetSocketHandlerEvent Read FOnGetSocketHandler Write FOnGetSocketHandler;
|
Property OnGetSocketHandler : TGetSocketHandlerEvent Read FOnGetSocketHandler Write FOnGetSocketHandler;
|
||||||
// Called after create socket handler was created, with the created socket handler.
|
// Called after create socket handler was created, with the created socket handler.
|
||||||
Property AfterSocketHandlerCreate : TSocketHandlerCreatedEvent Read FAfterSocketHandlerCreated Write FAfterSocketHandlerCreated;
|
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
|
// 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;
|
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
|
// 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;
|
Property KeepAliveTimeout: Integer read FKeepAliveTimeout write FKeepAliveTimeout;
|
||||||
=======
|
|
||||||
>>>>>>> Remove the KeepAlive* properties from TFPCustomHttpServer, rename KeepAliveEnabled to EnableKeepAlive
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TFPHttpServer = Class(TFPCustomHttpServer)
|
TFPHttpServer = Class(TFPCustomHttpServer)
|
||||||
@ -581,7 +572,7 @@ begin
|
|||||||
Try
|
Try
|
||||||
if FSetupSocket then
|
if FSetupSocket then
|
||||||
begin
|
begin
|
||||||
SetupSocket;
|
SetupSocket;
|
||||||
FSetupSocket:=False;
|
FSetupSocket:=False;
|
||||||
end;
|
end;
|
||||||
// Read headers.
|
// Read headers.
|
||||||
@ -659,8 +650,8 @@ begin
|
|||||||
if not Terminated and Connection.EnableKeepAlive and Connection.KeepAlive
|
if not Terminated and Connection.EnableKeepAlive and Connection.KeepAlive
|
||||||
and not Connection.Socket.CanRead(Connection.KeepAliveTimeout) then
|
and not Connection.Socket.CanRead(Connection.KeepAliveTimeout) then
|
||||||
break;
|
break;
|
||||||
FConnection.HandleRequest;
|
FConnection.HandleRequest;
|
||||||
until not (Terminated and FConnection.EnableKeepAlive and FConnection.KeepAlive and (FConnection.Socket.LastError=0));
|
until not (not Terminated and FConnection.EnableKeepAlive and FConnection.KeepAlive and (FConnection.Socket.LastError=0));
|
||||||
finally
|
finally
|
||||||
FreeAndNil(FConnection);
|
FreeAndNil(FConnection);
|
||||||
if Assigned(FThreadList) then
|
if Assigned(FThreadList) then
|
||||||
@ -988,7 +979,7 @@ begin
|
|||||||
try
|
try
|
||||||
for I:= ThreadList.Count-1 downto 0 do
|
for I:= ThreadList.Count-1 downto 0 do
|
||||||
try
|
try
|
||||||
CloseSocket(TFPHTTPConnectionThread(ThreadList[I]).Connection.Socket.Handle);
|
CloseSocket(TFPHTTPConnectionThread(ThreadList[I]).Connection.Socket.Handle);
|
||||||
except
|
except
|
||||||
// ignore exceptions during CloseSocket
|
// ignore exceptions during CloseSocket
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user