0
我想直接将目录压缩到Poco :: HTTPServerResponse流中。但是,下载由以下代码生成的zip文件会导致损坏的存档。我知道下面的压缩方法对本地创建的zip文件有效,因为我已经成功完成了这些工作。我错过了什么或者这是不可能的? (波索V1.6.1)将Poco Zip压缩到Poco HTTPServerResponse
std::string directory = "/tmp/data";
response.setStatusAndReason(HTTPResponse::HTTPStatus::HTTP_OK);
response.setKeepAlive(true);
response.setContentType("application/zip");
response.set("Content-Disposition","attachment; filename=\"data.zip\"");
Poco::Zip::Compress compress(response.send(),false);
compress.addRecursive(directory,
Poco::Zip::ZipCommon::CompressionMethod::CM_STORE,
Poco::Zip::ZipCommon::CompressionLevel::CL_MAXIMUM,
false, "data");
compress.close();