diff options
Diffstat (limited to 'lib/plum/hpack/huffman.rb')
-rw-r--r-- | lib/plum/hpack/huffman.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/plum/hpack/huffman.rb b/lib/plum/hpack/huffman.rb index c4d8c53..b3db49e 100644 --- a/lib/plum/hpack/huffman.rb +++ b/lib/plum/hpack/huffman.rb @@ -11,7 +11,7 @@ module Plum bytestr.bytes.each do |b| out << HUFFMAN_TABLE[b] end - out << "1" * (8 - (out.size % 8)) + out << "1" * (8 - (out.bytesize % 8)) [out].pack("B*") end @@ -20,16 +20,16 @@ module Plum bits = encoded.unpack("B*")[0] buf = "" outl = [] - while (n = bits.shift(1)).size > 0 + while (n = bits.shift(1)).bytesize > 0 if c = HUFFMAN_DECODE_TABLE[buf << n] buf = "" outl << c end end - if buf.size > 7 + if buf.bytesize > 7 raise HPACKError.new("huffman: padding is too large (> 7 bits)") - elsif buf != "1" * buf.size + elsif buf != "1" * buf.bytesize raise HPACKError.new("huffman: unknown suffix: #{buf}") else outl.pack("C*") |