tags:

views:

36

answers:

0

I'm trying to use boost::iostreams with a zlib filter like this:

    std::ostringstream oss;
    boost::iostreams::filtering_stream<boost::iostreams::output> out;
    out.push(boost::iostreams::zlib_compressor());
    out.push(oss);

    out << requestXML << std::flush;

to compress a lump of xml in accordance with RFC1951, however I suspect that I need to set some zlib parameters to make it produce the right output. The boost documentation (http://www.boost.org/doc/libs/1_38_0/libs/iostreams/doc/classes/zlib.html) mentions all the parameters, but doesn't say anything about RFC1951 compliance.

Edit: I think I've found it: the noheader parameter should be set to true:

noheader - True if the ZLIB header and trailing ADLER-32 checksum should be omitted (see [Deutsch1]). This results in compression according to the deflate specification