Menu

#2 Adding a KeepAliveTime property in httpsend

Request
open
Geby
5
2008-03-27
2008-03-27
surfer_ix
No

HTTP headers with keep-alive do look sometimes like this :

Keep-Alive: 300
Connection: keep-alive

How about adding a KeepAliveTime in httpsend.pas :

// (1) right after this code :
property KeepAlive: Boolean read FKeepAlive Write FKeepAlive;
// add :
{:if KeepAlive is @true, KeepAliveTime is the duration of the KeepAlive.}
property KeepAliveTime: Cardinal read FKeepAliveTime Write FKeepAliveTime;

// (2) in the constructor THTTPSend.Create;

// right after this code :
FKeepAlive := True;
// add :
FKeepAliveTime := 300;

// change this code :
if not FKeepAlive then
FHeaders.Insert(0, 'Connection: close');
// to this new code :
if FKeepAlive then
begin
FHeaders.Insert(0, 'Keep-Alive: '+IntToStr(KeepAliveTime));
FHeaders.Insert(0, 'Connection: keep-alive');
end
else
FHeaders.Insert(0, 'Connection: close');

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.