I had a quick look at TDecompressionstream and Tcompressionstream. Header processing is indeed missing both for decompression and compression. The parametername SkipHeader suggest more than it really does...
As mentioned earlier, the library I'm using is a variant of the Nomssi paszlib that I slightly modified to support in-memory GZ compression. The difference with fpc Nomssi paszlib is quite big. FE: the type z_stream is different, types are named different (Tbytearray <->zByteArray), etc. I googled for the function DecompressBuf in zUnCompr to find the original source of the library but no success. There are some results for procedure DecompressBuf but that is in the Delphi zlib implementation and has nothing to do with this function. I have no problem sharing this library knowing that: 1) I haven't written DecompressBuf myself and don't have a clue who has. Readme and Copyright headers in the sources are identical to fpc/Nomssi paszlib. 2) There are no class wrappers. Everything is pure procedurial and in memory (GetMem, ReallocMem). 3) For the compression I took a shortcut for the header in that it is a fixed #$1F#$8B#8#0#0#0#0#0#0#0; (Z_DEFLATED, no time, xflags and OS code, no file name, no .gz file comment and no header crc). This matches the decompression that skips/ignores these flags/fields. 4) No Doc. If you're interested I'll comment the new functions a little bit more. 5) The library works fine on windows and linux, both 32 and 64 bit. However the library contains functions such as zcalloc, zmemcmp (zutil.pas) that use a lot of ifdef's with defines such as CALLDOS, Delphi16, HugeMem, DPMI,... I don't have a clue if they are still functional. Ludo -----Message d'origine----- De : Michael Van Canneyt [mailto:mich...@freepascal.org] Envoyé : mercredi 13 avril 2011 20:58 À : Ararat Synapse Objet : Re: [Synalist] RE : RE : Reading the HTTP headers of a page On Wed, 13 Apr 2011, Ludo Brands wrote: > Downside of TGZFileStream is that it only works with a file. If you > only need to decompress an odd page than that is fine. If you have a > lot of packets with variable sizes to compress/decompress then using > intermediate files slows things down quite a lot. In my case the > application runs as a library which also adds file system access > complications. Hence the modified paszlib library I mentioned earlier > which does everything in memory. TDecompressionstream and TCompressionstream have a SkipHeader parameter which should enable you to compress/decompress gzip streams in memory; You just have to take care of the header blocks yourself. The paszlib library distributed with FPC is the nommsi paszlib library. So if you have a unit with a convenience function/class, please consider donating it to FPC. Michael. > > Ludo > > -----Message d'origine----- > De : Michael Van Canneyt [mailto:mich...@freepascal.org] Envoyé : > mercredi 13 avril 2011 20:02 À : Ararat Synapse > Objet : Re: [Synalist] RE : Reading the HTTP headers of a page > > > > > On Wed, 13 Apr 2011, Felipe Monteiro de Carvalho wrote: > >> Hello, >> >> Does anyone know if zlib will successfully uncompress the data >> received in "gzip" method from an HTTP server? I think gzip is the >> same as zlib, but I'm not sure =o > > gzip adds an additional header, but this can be read with the > TGZFileStream class from zstream. > >> Or else which Pascal bindings or Pascal uncompressor should be used? > > zstream should be able to handle it. > > Michael. > > ---------------------------------------------------------------------- > ------ > -- > Forrester Wave Report - Recovery time is now measured in hours and minutes > not days. Key insights are discussed in the 2010 Forrester Wave Report as > part of an in-depth evaluation of disaster recovery service providers. > Forrester found the best-in-class provider in terms of services and vision. > Read this report now! http://p.sf.net/sfu/ibm-webcastpromo > _______________________________________________ > synalist-public mailing list synalist-public@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/synalist-public > > > ---------------------------------------------------------------------- > -------- > Forrester Wave Report - Recovery time is now measured in hours and minutes > not days. Key insights are discussed in the 2010 Forrester Wave Report as > part of an in-depth evaluation of disaster recovery service providers. > Forrester found the best-in-class provider in terms of services and vision. > Read this report now! http://p.sf.net/sfu/ibm-webcastpromo > _______________________________________________ > synalist-public mailing list > synalist-public@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/synalist-public > ------------------------------------------------------------------------------ Benefiting from Server Virtualization: Beyond Initial Workload Consolidation -- Increasing the use of server virtualization is a top priority.Virtualization can reduce costs, simplify management, and improve application availability and disaster protection. Learn more about boosting the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev _______________________________________________ synalist-public mailing list synalist-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/synalist-public