Board index » delphi » Deflate HTTP response
Gabriel Corneanu
![]() Delphi Developer |
Gabriel Corneanu
![]() Delphi Developer |
Deflate HTTP response2005-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 |
Thomas Wegner
![]() Delphi Developer |
2005-07-27 06:37:51 AM
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 QuoteI am trying to use HTTP compression in Indy10. |
Stig Johansen
![]() Delphi Developer |
2005-07-27 02:47:09 PM
Re:Deflate HTTP response
Thomas Wegner writes:
QuoteI use in my HTTP-Server the ZLibEx.pas. It runs with all Browser: 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 |