Project

General

Profile

Feature #5937

Zlib::Inflate#add_dictionary to pre-supply dictionaries for inflate streams

Added by drbrain (Eric Hodel) over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
[ruby-core:42240]

Description

The attached patch allows Zlib::Inflate users to supply dictionaries ahead of time in order to avoid handling the Zlib::NeedDict exception.

Multiple dictionaries may be provided. Zlib::Inflate will choose a matching dictionary based on the adler32 checksum of the provided dictionaries.


Files

zlib.c.add_dictionary.patch (3.77 KB) zlib.c.add_dictionary.patch drbrain (Eric Hodel), 01/27/2012 08:04 AM

Related issues

Related to Ruby master - Bug #5929: Zlib::Inflate#set_dictionary does not work with short inputClosed01/26/2012Actions

Associated revisions

Revision 1516f8eb
Added by drbrain (Eric Hodel) over 7 years ago

  • ext/zlib/zlib.c (rb_inflate_add_dictionary): Added Zlib::Inflate#add_dictionary to allow users to pre-specify for using during #inflate. [ruby-trunk - Feature #5937]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 34553
Added by drbrain (Eric Hodel) over 7 years ago

  • ext/zlib/zlib.c (rb_inflate_add_dictionary): Added Zlib::Inflate#add_dictionary to allow users to pre-specify for using during #inflate. [ruby-trunk - Feature #5937]

Revision 34553
Added by drbrain (Eric Hodel) over 7 years ago

  • ext/zlib/zlib.c (rb_inflate_add_dictionary): Added Zlib::Inflate#add_dictionary to allow users to pre-specify for using during #inflate. [ruby-trunk - Feature #5937]

Revision 34553
Added by drbrain (Eric Hodel) over 7 years ago

  • ext/zlib/zlib.c (rb_inflate_add_dictionary): Added Zlib::Inflate#add_dictionary to allow users to pre-specify for using during #inflate. [ruby-trunk - Feature #5937]

Revision 34553
Added by drbrain (Eric Hodel) over 7 years ago

  • ext/zlib/zlib.c (rb_inflate_add_dictionary): Added Zlib::Inflate#add_dictionary to allow users to pre-specify for using during #inflate. [ruby-trunk - Feature #5937]

Revision 34553
Added by drbrain (Eric Hodel) over 7 years ago

  • ext/zlib/zlib.c (rb_inflate_add_dictionary): Added Zlib::Inflate#add_dictionary to allow users to pre-specify for using during #inflate. [ruby-trunk - Feature #5937]

Revision 34553
Added by drbrain (Eric Hodel) over 7 years ago

  • ext/zlib/zlib.c (rb_inflate_add_dictionary): Added Zlib::Inflate#add_dictionary to allow users to pre-specify for using during #inflate. [ruby-trunk - Feature #5937]

History

#2

Updated by drbrain (Eric Hodel) over 7 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r34553.
Eric, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • ext/zlib/zlib.c (rb_inflate_add_dictionary): Added Zlib::Inflate#add_dictionary to allow users to pre-specify for using during #inflate. [ruby-trunk - Feature #5937]

Updated by igrigorik (Ilya Grigorik) over 7 years ago

What are the odds of having this be backported to 1.9.x? We need custom dictionary support to support SPDY without relying on FFI or other native extensions.

ex: https://github.com/igrigorik/spdy/blob/master/lib/spdy/compressor.rb

Updated by naruse (Yui NARUSE) over 7 years ago

igrigorik (Ilya Grigorik) wrote:

What are the odds of having this be backported to 1.9.x? We need custom dictionary support to support SPDY without relying on FFI or other native extensions.

ex: https://github.com/igrigorik/spdy/blob/master/lib/spdy/compressor.rb

You may know, in principle backporting is for bug fixes.
And even if 1.9.3 backport this, 1.9.2 and 1.8.x still needs ffi.
This means your pain won't decrease, will it?

Updated by drbrain (Eric Hodel) over 7 years ago

I think #5929 should be backported instead. While #5937 makes working with custom dictionaries easier, #5929 fixes the current API (#set_dictionary) to be fully usable.

#6

Updated by igrigorik (Ilya Grigorik) over 7 years ago

naruse (Yui NARUSE): as Eric pointed out in his original ticket (#5929), I do believe this is a bug, as the current API advertises that it can set and use the dictionary, but that is not the case.

I've opened a different / new ticket: http://bugs.ruby-lang.org/issues/6516

Also available in: Atom PDF