mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 09:09:30 +02:00
Read out KeepAlive only if enabled
This commit is contained in:
parent
3814df5b4a
commit
c67a44c07a
@ -583,12 +583,15 @@ begin
|
||||
If Req.ContentLength>0 then
|
||||
ReadRequestContent(Req);
|
||||
Req.InitRequestVars;
|
||||
// Read out keep-alive
|
||||
FKeepAlive:=Req.HttpVersion='1.1'; // keep-alive is default on HTTP 1.1
|
||||
if SameText(Req.GetHeader(hhConnection),'close') then
|
||||
FKeepAlive:=False
|
||||
else if SameText(Req.GetHeader(hhConnection),'keep-alive') then
|
||||
FKeepAlive:=True;
|
||||
if KeepAliveSupport then
|
||||
begin
|
||||
// Read out keep-alive
|
||||
FKeepAlive:=Req.HttpVersion='1.1'; // keep-alive is default on HTTP 1.1
|
||||
if SameText(Req.GetHeader(hhConnection),'close') then
|
||||
FKeepAlive:=False
|
||||
else if SameText(Req.GetHeader(hhConnection),'keep-alive') then
|
||||
FKeepAlive:=True;
|
||||
end;
|
||||
// Create Response
|
||||
Resp:= Server.CreateResponse(Req);
|
||||
try
|
||||
@ -600,7 +603,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