Using TIdHTTPServer
(Indy 10.6), how do track how many bytes are sent to the client (user browser) for each request (on close connection)?
procedure onCommandGet(AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo;
begin
AResponseInfo.ContentStream := TFileStream.Create('C:/HugeFile.zip', fmOpenRead or fmShareCompat);
AResponseInfo.ContentLength := AResponseInfo.ContentStream.Size;
AResponseInfo.WriteHeader;
AResponseInfo.WriteContent;
AResponseInfo.ContentStream.Free;
AResponseInfo.ContentStream := nil;
end;
eg, in a log file:
2014-11-06 20:32:00 - IPAddress 84.XXX.XXX.XXX download 1000000 Bytes (100%) 2014-11-05 16:05:00 - IPAddress 72.XXX.XXX.XXX download 500000 Bytes (50%)