title: GZIP compression using zlib into buffer
body: <p>I want to compress a memory buffer using <strong>gzip</strong> and put the compressed bytes into another memory buffer. I want to send the compressed buffer in the payload of a HTTP packet with <code>Content-Encoding: gzip</code>. I can easily do this using <strong>zlib</strong> for deflate compression ( <code>compress()</code> function ). However, there is no API that I see for what I need ( <strong>gzip</strong> ). The <strong>zlib</strong> API is to compress and write to a file ( <code>gzwrite()</code> ). However, I want to compress and write to a buffer.</p>
  
  <p>Any ideas?</p>
  
  <p>I am in C on Linux.</p>