mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 12:49:33 +02:00
Read out KeepAlive only if enabled
This commit is contained in:
parent
1d18f2fdbf
commit
eaffd1deca
@ -65,11 +65,7 @@ Type
|
||||
FSocket: TSocketStream;
|
||||
FSetupSocket : Boolean;
|
||||
FBuffer : Ansistring;
|
||||
<<<<<<< HEAD
|
||||
FEnableKeepAlive : Boolean;
|
||||
=======
|
||||
FKeepAliveSupport : Boolean;
|
||||
>>>>>>> TFPCustomHttpServer KeepAlive* properties
|
||||
FKeepAlive : Boolean;
|
||||
FKeepAliveTimeout : Integer;
|
||||
procedure InterPretHeader(ARequest: TFPHTTPConnectionRequest; const AHeader: String);
|
||||
@ -89,16 +85,11 @@ Type
|
||||
Property Server : TFPCustomHTTPServer Read FServer;
|
||||
Property OnRequestError : TRequestErrorHandler Read FOnError Write FOnError;
|
||||
Property LookupHostNames : Boolean Read GetLookupHostNames;
|
||||
<<<<<<< HEAD
|
||||
// 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;
|
||||
// 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?
|
||||
=======
|
||||
Property KeepAliveSupport: Boolean read FKeepAliveSupport write FKeepAliveSupport;
|
||||
Property KeepAliveTimeout: Integer read FKeepAliveTimeout write FKeepAliveTimeout;
|
||||
>>>>>>> TFPCustomHttpServer KeepAlive* properties
|
||||
Property KeepAlive: Boolean read FKeepAlive;
|
||||
end;
|
||||
|
||||
@ -240,14 +231,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 KeepAliveSupport: Boolean read FKeepAliveSupport write FKeepAliveSupport;
|
||||
// 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;
|
||||
>>>>>>> TFPCustomHttpServer KeepAlive* properties
|
||||
end;
|
||||
|
||||
TFPHttpServer = Class(TFPCustomHttpServer)
|
||||
@ -619,7 +606,7 @@ begin
|
||||
if Assigned(Resp) and (not Resp.ContentSent) then
|
||||
begin
|
||||
// Add connection header for HTTP 1.0 keep-alive
|
||||
if FKeepAlive and (Req.HttpVersion='1.0') and not Resp.HeaderIsSet(hhConnection) then
|
||||
if KeepAliveSupport and FKeepAlive and (Req.HttpVersion='1.0') and not Resp.HeaderIsSet(hhConnection) then
|
||||
Resp.SetHeader(hhConnection,'keep-alive');
|
||||
Resp.SendContent;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user