mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-20 22:29:12 +02:00
Rename KeepAliveSupport->KeepAliveEnabled
This commit is contained in:
parent
c67a44c07a
commit
676c9a7bf6
@ -65,7 +65,7 @@ Type
|
|||||||
FSocket: TSocketStream;
|
FSocket: TSocketStream;
|
||||||
FSetupSocket : Boolean;
|
FSetupSocket : Boolean;
|
||||||
FBuffer : Ansistring;
|
FBuffer : Ansistring;
|
||||||
FKeepAliveSupport : Boolean;
|
FKeepAliveEnabled : Boolean;
|
||||||
FKeepAlive : Boolean;
|
FKeepAlive : Boolean;
|
||||||
FKeepAliveTimeout : Integer;
|
FKeepAliveTimeout : Integer;
|
||||||
procedure InterPretHeader(ARequest: TFPHTTPConnectionRequest; const AHeader: String);
|
procedure InterPretHeader(ARequest: TFPHTTPConnectionRequest; const AHeader: String);
|
||||||
@ -85,7 +85,7 @@ 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;
|
||||||
Property KeepAliveSupport: Boolean read FKeepAliveSupport write FKeepAliveSupport;
|
Property KeepAliveEnabled: Boolean read FKeepAliveEnabled write FKeepAliveEnabled;
|
||||||
Property KeepAliveTimeout: Integer read FKeepAliveTimeout write FKeepAliveTimeout;
|
Property KeepAliveTimeout: Integer read FKeepAliveTimeout write FKeepAliveTimeout;
|
||||||
Property KeepAlive: Boolean read FKeepAlive;
|
Property KeepAlive: Boolean read FKeepAlive;
|
||||||
end;
|
end;
|
||||||
@ -133,7 +133,7 @@ Type
|
|||||||
FConnectionThreadList: TThreadList;
|
FConnectionThreadList: TThreadList;
|
||||||
FConnectionCount : Integer;
|
FConnectionCount : Integer;
|
||||||
FUseSSL: Boolean;
|
FUseSSL: Boolean;
|
||||||
FKeepAliveSupport: Boolean;
|
FKeepAliveEnabled: Boolean;
|
||||||
FKeepAliveTimeout: Integer;
|
FKeepAliveTimeout: Integer;
|
||||||
procedure DoCreateClientHandler(Sender: TObject; out AHandler: TSocketHandler);
|
procedure DoCreateClientHandler(Sender: TObject; out AHandler: TSocketHandler);
|
||||||
function GetActive: Boolean;
|
function GetActive: Boolean;
|
||||||
@ -229,7 +229,7 @@ Type
|
|||||||
Property AfterSocketHandlerCreate : TSocketHandlerCreatedEvent Read FAfterSocketHandlerCreated Write FAfterSocketHandlerCreated;
|
Property AfterSocketHandlerCreate : TSocketHandlerCreatedEvent Read FAfterSocketHandlerCreated Write FAfterSocketHandlerCreated;
|
||||||
|
|
||||||
// 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 KeepAliveSupport: Boolean read FKeepAliveSupport write FKeepAliveSupport;
|
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;
|
||||||
end;
|
end;
|
||||||
@ -583,7 +583,7 @@ begin
|
|||||||
If Req.ContentLength>0 then
|
If Req.ContentLength>0 then
|
||||||
ReadRequestContent(Req);
|
ReadRequestContent(Req);
|
||||||
Req.InitRequestVars;
|
Req.InitRequestVars;
|
||||||
if KeepAliveSupport then
|
if KeepAliveEnabled then
|
||||||
begin
|
begin
|
||||||
// Read out keep-alive
|
// Read out keep-alive
|
||||||
FKeepAlive:=Req.HttpVersion='1.1'; // keep-alive is default on HTTP 1.1
|
FKeepAlive:=Req.HttpVersion='1.1'; // keep-alive is default on HTTP 1.1
|
||||||
@ -603,7 +603,7 @@ begin
|
|||||||
if Assigned(Resp) and (not Resp.ContentSent) then
|
if Assigned(Resp) and (not Resp.ContentSent) then
|
||||||
begin
|
begin
|
||||||
// Add connection header for HTTP 1.0 keep-alive
|
// Add connection header for HTTP 1.0 keep-alive
|
||||||
if KeepAliveSupport and FKeepAlive and (Req.HttpVersion='1.0') and not Resp.HeaderIsSet(hhConnection) then
|
if FKeepAlive and (Req.HttpVersion='1.0') and not Resp.HeaderIsSet(hhConnection) then
|
||||||
Resp.SetHeader(hhConnection,'keep-alive');
|
Resp.SetHeader(hhConnection,'keep-alive');
|
||||||
Resp.SendContent;
|
Resp.SendContent;
|
||||||
end;
|
end;
|
||||||
@ -642,12 +642,12 @@ begin
|
|||||||
try
|
try
|
||||||
try
|
try
|
||||||
repeat
|
repeat
|
||||||
if Connection.KeepAliveSupport and Connection.KeepAlive
|
if Connection.KeepAliveEnabled 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 (FConnection.KeepAliveSupport and FConnection.KeepAlive and (FConnection.Socket.LastError=0));
|
until not (FConnection.KeepAliveEnabled and FConnection.KeepAlive and (FConnection.Socket.LastError=0));
|
||||||
finally
|
finally
|
||||||
FreeAndNil(FConnection);
|
FreeAndNil(FConnection);
|
||||||
if Assigned(FThreadList) then
|
if Assigned(FThreadList) then
|
||||||
@ -831,7 +831,7 @@ begin
|
|||||||
Con.OnRequestError:=@HandleRequestError;
|
Con.OnRequestError:=@HandleRequestError;
|
||||||
if Threaded then
|
if Threaded then
|
||||||
begin
|
begin
|
||||||
Con.KeepAliveSupport:=KeepAliveSupport;
|
Con.KeepAliveEnabled:=KeepAliveEnabled;
|
||||||
Con.KeepAliveTimeout:=KeepAliveTimeout;
|
Con.KeepAliveTimeout:=KeepAliveTimeout;
|
||||||
CreateConnectionThread(Con);
|
CreateConnectionThread(Con);
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user