我想使用boost :: iostreams(1.53.0)解压缩HTTP请求正文,并稍后处理它。 但是当我运行下面的代码时发生崩溃。发生当使用boost :: iostreams时崩溃
try {
using namespace boost::iostreams;
ifstream file(argv[1], std::ios_base::in | std::ios_base::binary);
boost::iostreams::filtering_istream in;
in.push(gzip_decompressor());
in.push(file);
std::stringstream strstream;
boost::iostreams::copy(in, strstream);
} catch (std::exception& e) {
cout << e.what() << endl;
}
的崩溃gzip_decompressor()
,更具体地说是在gzip_header() { reset(); }
从升压转换器的gzip.hpp(通过查看调用堆栈)。
我编译了自己的boost :: iostreams库,并试图从macports使用boost,但同样的崩溃发生。我也尝试过使用gzstream library,但在构造函数中崩溃,更具体地在igzstream
的构造函数中崩溃。
我倾向于认为这是与zlib相关的问题。 我没有指定,我正在使用Mountain Lion和xCode 4.6的MacBook Pro来构建和运行代码。
你们有没有遇到过这样的问题?
你可以附加一个调试器并发布崩溃的堆栈跟踪吗? –
您是否确认argv [1]实际上指向一个文件? – Zac
@Zac gzip_decompressor()崩溃与提供的argv无关。尽管如此,它指向了一个正确的文件路径。 – afp