if (Length(hs) > 200) And (isComp) then begin //hs Sendedaten als String
i:= Pos('gzip', request.AcceptEncoding); //Prefer gzip
ms:= TMemoryStream.create;
if ( i < 0) then begin
//Use Deflate
zcs:=
zLib.TZCompressionStream.Create(ms);
AResponseInfo.ContentEncoding := 'deflate';
end else begin
//Use gZip
i:= 15 + 16;
zcs:=
zLib.TZCompressionStream.Create(ms, zcDefault, i);
AResponseInfo.ContentEncoding := 'gzip';
end;
aBl:= ToBytes(hs, IdGlobal.IndyTextEncoding_UTF8);
zcs.WriteData(abl, Length(abl));
zcs.free;
AResponseInfo.ContentStream:= ms;
end else begin
AResponseInfo.ContentText := hs;
end;
AResponseInfo.WriteContent;