<div dir="ltr"><div>Hello,</div><div><br></div><div>I'm using gzip from Apache to compress my static files (like HTML, CSS, JS etc.), and it worked fine (<a href="http://imagebin.org/303024" target="_blank">http://imagebin.org/303024</a>). But, to compress the CGI content, I'm using deflate:</div>


<div><br></div><div>var</div><div>  m: TMemoryStream;</div><div>begin</div><div>  if aeDeflate in BrookGetAcceptEncodingSet(ARequest.AcceptEncoding) then</div><div>  begin</div><div>    m := TMemoryStream.Create;</div><div>


    try</div><div>      with TCompressionStream.Create(clMax, m, True) do</div><div>      try</div><div>        Write(AResponse.Content[1], Length(AResponse.Content));</div><div>      finally</div><div>        Free;</div>


<div>      end;</div><div>      m.Seek(0, 0);</div><div>      AResponse.SetCustomHeader(fieldContentEncoding, 'deflate');</div><div>      AResponse.ContentStream := m;</div><div>      AResponse.SendContent;</div>

<div>
    finally</div><div>      m.Free;</div><div>    end;</div><div>  end;</div><div>end;</div><div><br></div><div>Now I need to use gzip instead of deflate, like:</div><div><br></div><div>      AResponse.SetCustomHeader(fieldContentEncoding, 'gzip');</div>


<div><br></div><div>So, how to use zstream to (or other) to compress my content stream in gzip mode? I need to create a temporary gzip file (using TGZFileStream class) and load it after from my stream (m), or I can do it directly in stream?</div>


<div><br></div><div>Thank you!</div><div><div><br></div>-- <br>Silvio Clécio<br>My public projects - <a href="http://github.com/silvioprog" target="_blank">github.com/silvioprog</a>
</div></div>