lib/protocol/hpack/compressor.rb in protocol-hpack-1.4.3 vs lib/protocol/hpack/compressor.rb in protocol-hpack-1.5.0
- old
+ new
@@ -9,10 +9,11 @@
# Copyright, 2018, by Byron Formwalt.
# Copyright, 2018-2024, by Samuel Williams.
# Copyright, 2018, by Kenichi Nakamura.
# Copyright, 2019, by Jingyi Chen.
# Copyright, 2020, by Justin Mazzocchi.
+# Copyright, 2024, by Nathan Froyd.
require_relative 'context'
require_relative 'huffman'
module Protocol
@@ -116,10 +117,10 @@
#
# @param string [String]
# @return [String] binary string
def write_string(string, huffman = self.huffman)
if huffman != :never
- encoded = Huffman.new.encode(string)
+ encoded = Huffman.encode(string)
if huffman == :shorter and encoded.bytesize >= string.bytesize
encoded = nil
end
end