Xiang Zhang added the comment:

Thanks for your review, Martin. :) I have replied with after thinking and try.

Yes, this is more like a feature request. But for the end user, this behaviour 
is quite like a bug.

> If we were to add full support of inflateSetDictionary() for raw deflate 
> mode, I imagine it would be a new decompressobj.set_dictionary() method.

I don't support adding a new set_dictionary() method. Right now decompressobj 
handles raw deflate format, zlib format and gzip format. Adding a 
set_dictionary() method for raw deflate format seems weird. If we are going to 
do so, I suggest reorganize the zlib like PHP and nodejs do, separating 
different formats into different objects.

> I did some quick tests with specifying an unnecessary zdict buffer to the 
> decompressor (when zdict not used for compression), and it doesn’t _seem_ to 
> break anything, but I am not 100% sure.

This patch only affects raw inflate. You have to set wbits negative. If you are 
decompressing with an unnecessary zdict, I think it ought to emit an error.

With Python background, zlib dictionary is really hard to understand. I think 
manual doesn't tell much. I understand why zdict is needed until reading 
https://blog.cloudflare.com/improving-compression-with-preset-deflate-dictionary/.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27164>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to