Rename KeepAliveSupport->KeepAliveEnabled

This commit is contained in:
Ondrej Pokorny 2021-08-14 04:46:12 +02:00 committed by Michaël Van Canneyt
parent eaffd1deca
commit 722a37ab2f

View File

@ -65,7 +65,7 @@ Type
FSocket: TSocketStream;
FSetupSocket : Boolean;
FBuffer : Ansistring;
FEnableKeepAlive : Boolean;
FKeepAliveEnabled : Boolean;
FKeepAlive : Boolean;
FKeepAliveTimeout : Integer;
procedure InterPretHeader(ARequest: TFPHTTPConnectionRequest; const AHeader: String);
@ -85,8 +85,8 @@ Type
Property Server : TFPCustomHTTPServer Read FServer;
Property OnRequestError : TRequestErrorHandler Read FOnError Write FOnError;
Property LookupHostNames : Boolean Read GetLookupHostNames;
// 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 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;
// is the current connection set up for KeepAlive?
@ -136,7 +136,7 @@ Type
FConnectionThreadList: TThreadList;
FConnectionCount : Integer;
FUseSSL: Boolean;
FKeepAliveSupport: Boolean;
FKeepAliveEnabled: Boolean;
FKeepAliveTimeout: Integer;
procedure DoCreateClientHandler(Sender: TObject; out AHandler: TSocketHandler);
function GetActive: Boolean;
@ -232,7 +232,7 @@ Type
// Called after create socket handler was created, with the created socket handler.
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
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
Property KeepAliveTimeout: Integer read FKeepAliveTimeout write FKeepAliveTimeout;
end;
@ -586,7 +586,7 @@ begin
If Req.ContentLength>0 then
ReadRequestContent(Req);
Req.InitRequestVars;
if EnableKeepAlive then
if KeepAliveEnabled then
begin
// Read out keep-alive
FKeepAlive:=Req.HttpVersion='1.1'; // keep-alive is default on HTTP 1.1
@ -606,7 +606,7 @@ begin
if Assigned(Resp) and (not Resp.ContentSent) then
begin
// 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.SendContent;
end;
@ -842,7 +842,7 @@ begin
Con.OnRequestError:=@HandleRequestError;
if Threaded then
begin
Con.KeepAliveSupport:=KeepAliveSupport;
Con.KeepAliveEnabled:=KeepAliveEnabled;
Con.KeepAliveTimeout:=KeepAliveTimeout;
CreateConnectionThread(Con);
end