Skip to content

Poco::Zip::Compress with non-seekable stream fails for CM_STORE #1239

@micheleselea

Description

@micheleselea

Hi all, I found a strange behavior of the Compress utility for zip.
If you use something like

std::ostream& ostr = response.send();
bool bSeekable=false;
Poco::Zip::Compress c(ostr, bSeekable);

to stream for example over network (here you have a slice of code from Poco::HttpServer
std::string sFileName("c:\somefile.txt");
Poco::Path pFile(sFileName);
c.addFile(pFile, pFile, Poco::Zip::ZipCommon::CM_STORE, Poco::Zip::ZipCommon::CL_SUPERFAST);
c.close();

the addFile with Poco::Zip::ZipCommon::CM_DEFLATE is ok, with Poco::Zip::ZipCommon::CM_STORE it throw exception on outputstream. ostr is a ofstream on your disk it's all ok.
The error occur even with CM_AUTO if you try compress jpeg because internally is used CM_STORE.

Do you think it's not possible to use CM_STORE over network?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions