Board index » delphi » Deflate HTTP response

Deflate HTTP response


2005-07-27 05:40:47 AM
delphi174
I am trying to use HTTP compression in Indy10.
I'm simply using a TIdCompressorZLibEx.CompressHTTPDeflate() on the
contentstream (after checking Accept-Encoding) and set ContentEncoding to
"deflate".
The strange thing is that IE shows an empty page, but Opera works very well.
Am I missing something here??
Thanks,
Gabriel
 
 

Re:Deflate HTTP response

I use in my HTTP-Server the ZLibEx.pas. It runs with all Browser:
procedure TContentCompressor.CompressContent(StatusCode: integer;
ContentType, AcceptEncoding, FileExt: string; var ContentText,
ContentEncoding: string; var ContentLength: integer; var SendBytes: Int64);
begin
if (StatusCode = 200) and (Length(ContentText)>0) then
begin
if ((SmartPos('text/', ContentType, False) = 1) or
(UpperCase(FileExt) = '.JS')) and ((SmartPos('deflate', AcceptEncoding,
False)>0) or (SmartPos('*', AcceptEncoding)>0)) and (ContentEncoding =
'') then
begin
ZSendToBrowser(ContentText);
ContentEncoding := 'deflate';
ContentLength := Length(ContentText);
SendBytes := ContentLength;
end; // if (SmartPos('text/', ContentType, False) = 1) and
((SmartPos('deflate', AcceptEncoding, False)>0) or (SmartPos('*',
AcceptEncoding)>0)) and (ContentEncoding = '')
end; // if (StatusCode = 200) and (Length(ContentText)>0)
end;
---------------------------------------------
Thomas Wegner
CabrioMeter - The Weather Plugin for Trillian
www.wegner24.de/cabriometer
"Gabriel Corneanu" <XXXX@XXXXX.COM>schrieb im Newsbeitrag
Quote
I am trying to use HTTP compression in Indy10.
I'm simply using a TIdCompressorZLibEx.CompressHTTPDeflate() on the
contentstream (after checking Accept-Encoding) and set ContentEncoding to
"deflate".
The strange thing is that IE shows an empty page, but Opera works very
well.
Am I missing something here??

Thanks,
Gabriel

 

Re:Deflate HTTP response

Thomas Wegner writes:
Quote
I use in my HTTP-Server the ZLibEx.pas. It runs with all Browser:
Well, you may assume all /newer/ browsers.
A coupe of years ago, i had to implement both deflate and gzip since:
My Konqueror only supported gzip.
My IE only supported deflate.
I had the impression, that deflate was yet another M$ speciality.
But my advice will be to implement both.
--
Best regards
Stig Johansen