The magic header is 8 bytes: "\x1f\x8b\x08\x00\x00\x00\x00\x00".

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message ----- 
From: "Scott Nichol" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 12, 2004 11:44 AM
Subject: Re: Compressing SOAP requests


Standard Zlib is equivalent to HTTP Content-Encoding header value 'deflate'.  
This differs from 'gzip', in that gzip includes some extra bytes (a header and 
checksum) in the compressed data.  Apache SOAP does not support deflate right 
now.  My experience working with PHP Zlib is that many (most?) gzip are 
satisfied with 4 0x00 bytes as the checksum, and some constant string of (I 
think) 10 bytes at the start for the header.  I don't recall the values, but 
you might poke around php.net for the 
gzinflate/gzdeflate/gzcompress/gzuncompress functions for clues (they would be 
in the notes after the "formal" documentation), or check the IEFT RFCs.

In short, I *think* Zlib can inflate a gzip payload if the first ten (I think) 
bytes of the payload are stripped, as well as the last 4.  You can package up a 
Zlib deflate buffer as a gzip payload if you prepend the magic 10 bytes and 
stick an all-zero dummy checksum at the end.

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message ----- 
From: "Nige White" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 12, 2004 11:11 AM
Subject: Compressing SOAP requests


> I've specified setGzip(true), and the incoming data is encoded.
> 
> I'm having trouble uncompressing it using the zlib library from 
> http://www.gzip.org/zlib/ (I can call C routines from this "DBL" language)
> 
> I can compress and decompress data in DBL using the zlib inflateInit(), 
> inflate(), and inflateEnd() routines, and I get back the data I started 
> with, so the zlib routines I have are consistent with themselves. The 
> good news is that they produce a 3:1 compression ratio on my test string!
> 
> Unfortunately, they won't uncompress the data I'm receiving from Apache 
> SOAP. Although if I write the data I receive out to a .gz file, then 
> gunzip will see it just fine.
> 
> So my question is, why won't the zlib routines from http://www.gzip.org/ 
> work? Is there an older version with a different compression algorithm I 
> should use? Should I do anything to the data before sending it into the 
> inflate() routine?
> 
> Hope you can help!
> 
> Nigel
> 
> _____________________________________________________________________
> This message has been checked for all known viruses. Virus scanning
> powered by Messagelabs http://www.messagelabs.com For more information
> e-mail : [EMAIL PROTECTED]
> 
> 
>

Reply via email to