Index: boost/iostreams/filter/gzip.hpp =================================================================== --- boost/iostreams/filter/gzip.hpp (revision 60141) +++ boost/iostreams/filter/gzip.hpp (working copy) @@ -32,6 +32,7 @@ #include #include #include // failure. +#include #include #include #include @@ -531,10 +532,11 @@ { if (offset_) { putback_[--offset_] = c; - return true; } else { - return boost::iostreams::putback(src_, c); + boost::throw_exception( + boost::iostreams::detail::bad_putback()); } + return true; } void putback(const string_type& s) { Index: libs/iostreams/test/gzip_test.cpp =================================================================== --- libs/iostreams/test/gzip_test.cpp (revision 60141) +++ libs/iostreams/test/gzip_test.cpp (working copy) @@ -83,10 +83,28 @@ BOOST_CHECK(std::equal(data.begin(), data.end(), dest.begin() + dest.size() / 2)); } +void array_source_test() +{ + std::string data = "simple test string."; + std::string encoded; + + filtering_ostream out; + out.push(gzip_compressor()); + out.push(io::back_inserter(encoded)); + io::copy(make_iterator_range(data), out); + + std::string res; + io::array_source src(encoded.data(),encoded.length()); + io::copy(io::compose(io::gzip_decompressor(), src), io::back_inserter(res)); + + BOOST_CHECK_EQUAL(data, res); +} + test_suite* init_unit_test_suite(int, char* []) { test_suite* test = BOOST_TEST_SUITE("gzip test"); test->add(BOOST_TEST_CASE(&compression_test)); test->add(BOOST_TEST_CASE(&multiple_member_test)); + test->add(BOOST_TEST_CASE(&array_source_test)); return test; }