protocol-hpack 1.2.2 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34a3b1305216170fc892c4490259a257e3d3e6a3206942a80a016bd9c07aaef9
4
- data.tar.gz: e4c0fa6bf1e28c6f8add782403ffbeee5ae49fca3ad72967d3d223b6028a2b97
3
+ metadata.gz: dbb8247fa7eb3b3ae4c8aadda670c34cf6c4b82d4ef9c0c2b9dab708cfcb94f9
4
+ data.tar.gz: fafe89f7170284e2c406dcf85a6308bc5bb98ff36d0e38284882c5e53d088370
5
5
  SHA512:
6
- metadata.gz: 67fbe38ec846794fc8e5b60d38e13f84c4e8c22482323c120b81aaf9de95f35d1eb875f444a2b070ee4b9cc422602481476541ff282d330a64292b9ec4302229
7
- data.tar.gz: 314b4288c6289fe0fef3570ff51847031fa056fe516adb9bf244fe608c669f82720f26363e6c2ff777d2f0eb7f23c110b1ded7513d0ebb41b75b0de17fa1e4bd
6
+ metadata.gz: acf91072388222f898e2ed09af677679037b8da6e9730010a43730260134289b580b8be00e8da7c626497ccb7feef11aef7bddf637e6b81577b4b40d3af380fc
7
+ data.tar.gz: aa88d7ef93b60650142fa24ad8358f8261e1d0c53822498deee7142e21c7dec0c2af5ef60fb6acf274aff756fa95e14e3f9d3e47267d93c9d2867c14eb4b149e
@@ -72,7 +72,7 @@ module Protocol
72
72
  # @return [Integer]
73
73
  def read_integer(bits)
74
74
  limit = 2**bits - 1
75
- value = !bits.zero? ? (read_byte & limit) : 0
75
+ value = bits.zero? ? 0 : (read_byte & limit)
76
76
 
77
77
  shift = 0
78
78
 
@@ -82,7 +82,7 @@ module Protocol
82
82
 
83
83
  break if (byte & 128).zero?
84
84
  end if (value == limit)
85
-
85
+
86
86
  return value
87
87
  end
88
88
 
@@ -94,6 +94,9 @@ module Protocol
94
94
  huffman = (peek_byte & 0x80) == 0x80
95
95
 
96
96
  length = read_integer(7)
97
+
98
+ raise CompressionError, "Invalid string length!" unless length
99
+
97
100
  string = read_bytes(length)
98
101
 
99
102
  raise CompressionError, "Invalid string length, got #{string.bytesize}, expecting #{length}!" unless string.bytesize == length
@@ -26,5 +26,8 @@ module Protocol
26
26
 
27
27
  class CompressionError < Error
28
28
  end
29
+
30
+ class DecompressionError < Error
31
+ end
29
32
  end
30
33
  end
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Protocol
22
22
  module HPACK
23
- VERSION = "1.2.2"
23
+ VERSION = "1.3.0"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protocol-hpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams