biryani 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/biryani/hpack/huffman.rb +3 -11
- data/lib/biryani/hpack/integer.rb +2 -2
- data/lib/biryani/http/request.rb +3 -3
- data/lib/biryani/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2182695aff86f0885189fd0f2387a3e1807ad4d44986cac3eafb7a5452cf3ea0
|
|
4
|
+
data.tar.gz: 1c66dbdc500aea8cfacc6ca8dd415531dc46ad989852154effd8bba7998ac6af
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fa61f7da21c1802542365734855aac5c805b8c211fd6f8b2a40fea793947841e4ac6a237f5bfccf57daf61dcc14f592702c7e5ca55ccaf48c6e7d0b3f6e7104b
|
|
7
|
+
data.tar.gz: 66b276311e545cf440bda25787b17ee63c1de8aa1bb18c951fb91dd44c44818bfbf816f92e5f55d3483af418147015a70752aac4ff24b64d7fdc025589b39204
|
|
@@ -531,16 +531,8 @@ module Biryani
|
|
|
531
531
|
#
|
|
532
532
|
# @return [String]
|
|
533
533
|
def self.encode(s)
|
|
534
|
-
bits = s.bytes.map { |sym| ENCODE_TABLE[sym] }
|
|
535
|
-
|
|
536
|
-
acc = IO::Buffer.new(bits.sum(&:bytesize))
|
|
537
|
-
offset = 0
|
|
538
|
-
bits.each do |s|
|
|
539
|
-
acc.set_string(s, offset)
|
|
540
|
-
offset += s.bytesize
|
|
541
|
-
end
|
|
542
|
-
|
|
543
|
-
[acc.get_string.ljust((acc.size + 7) & ~7, '1')].pack('B*')
|
|
534
|
+
bits = s.bytes.map { |sym| ENCODE_TABLE[sym] }.join
|
|
535
|
+
[bits.ljust((bits.bytesize + 7) & ~7, '1')].pack('B*')
|
|
544
536
|
end
|
|
545
537
|
|
|
546
538
|
# @param io [IO::Buffer]
|
|
@@ -554,7 +546,7 @@ module Biryani
|
|
|
554
546
|
res = ''.b
|
|
555
547
|
bits = 0
|
|
556
548
|
bits_len = 0
|
|
557
|
-
bytes = io.
|
|
549
|
+
bytes = io.get_string(cursor, length).bytes
|
|
558
550
|
(length * 8).times do |i|
|
|
559
551
|
bits_len += 1
|
|
560
552
|
bits += 1 if (bytes[i / 8] & (1 << 7 - (i % 8))).positive?
|
|
@@ -32,7 +32,7 @@ module Biryani
|
|
|
32
32
|
|
|
33
33
|
bytes = [limit | mask]
|
|
34
34
|
i -= limit
|
|
35
|
-
while i
|
|
35
|
+
while i >= 128
|
|
36
36
|
bytes << i % 128 + 128
|
|
37
37
|
i /= 128
|
|
38
38
|
end
|
|
@@ -56,7 +56,7 @@ module Biryani
|
|
|
56
56
|
i = 0
|
|
57
57
|
loop do
|
|
58
58
|
byte = io.get_value(:U8, c + i)
|
|
59
|
-
res += (byte & 127)
|
|
59
|
+
res += (byte & 127) << (i * 7)
|
|
60
60
|
|
|
61
61
|
break if (byte & 128).zero?
|
|
62
62
|
|
data/lib/biryani/http/request.rb
CHANGED
|
@@ -82,15 +82,15 @@ module Biryani
|
|
|
82
82
|
# @return [Request, ConnectionError]
|
|
83
83
|
def self.build(h, s)
|
|
84
84
|
return ConnectionError.new(ErrorCode::PROTOCOL_ERROR, 'missing pseudo-header fields') unless PSEUDO_HEADER_FIELDS.all? { |x| h.key?(x) }
|
|
85
|
-
return ConnectionError.new(ErrorCode::PROTOCOL_ERROR, 'invalid content-length') if h.key?('content-length') && !s.empty? && s.length != h['content-length'].to_i
|
|
85
|
+
return ConnectionError.new(ErrorCode::PROTOCOL_ERROR, 'invalid content-length') if h.key?('content-length') && !s.empty? && s.length != h['content-length'][0].to_i
|
|
86
86
|
|
|
87
87
|
scheme = h[':scheme'][0]
|
|
88
88
|
domain = h[':authority'][0]
|
|
89
89
|
path = h[':path'][0]
|
|
90
90
|
uri = URI("#{scheme}://#{domain}#{path}")
|
|
91
|
-
method = h[':method'][0]
|
|
91
|
+
method = h[':method'][0].upcase
|
|
92
92
|
h['cookie'] = [h['cookie'].join('; ')] if h.key?('cookie')
|
|
93
|
-
Request.new(method, uri, h, s)
|
|
93
|
+
Request.new(method, uri, h.except(*PSEUDO_HEADER_FIELDS), s)
|
|
94
94
|
end
|
|
95
95
|
end
|
|
96
96
|
end
|
data/lib/biryani/version.rb
CHANGED