我正在尝试使用 Ubuntu Linux 上的 POCO C++ 库从网络流中解压缩文件,但解压缩失败并出现“非法状态”异常。HTTPResponse
status 和 reason 是302 Moved Temporarily。同时我可以用浏览器下载和解压链接。HTTPClientSession
当HTTPResponse
处于这种状态时我该怎么办?
...
HTTPResponse res;
std::istream& rs = h_ses.receiveResponse (res);
if (res.getStatus () != HTTPResponse::HTTP_OK) {
poco_error (logger, "http response status: " + std::to_string (res.getStatus ()) + " " + res.getReason ());
}
if (!rs) {
poco_error (logger, "responese stream is in bad state: " + std::to_string (rs.rdstate()));
}
Decompress dec (rs, target_dir_.native ());
poco_debug (logger, "Unzipping: " + dl + " ...");
dec.EError += Poco::Delegate<Addon_Loader, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &Addon_Loader::on_decompress_error);
dec.decompressAllFiles ();
...