biryani 0.0.10 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1aa3fb4dd49abcba22df142cd67d38c5eedc6c8beb6ca8fbcb130147c7e7506a
4
- data.tar.gz: 54bd5a493c027047eeaada80b4ff938ab806c29b80069a6cc112a54f5bb78efc
3
+ metadata.gz: 2182695aff86f0885189fd0f2387a3e1807ad4d44986cac3eafb7a5452cf3ea0
4
+ data.tar.gz: 1c66dbdc500aea8cfacc6ca8dd415531dc46ad989852154effd8bba7998ac6af
5
5
  SHA512:
6
- metadata.gz: 3a8c93ee8ce069cfe77854f7792abadf528addc7e258cd55c84f1b8b2da0b25b278b768e3c8b41a0897a9adc1ee497a9cac4d2ced4c3dd5c644d17f9eb1327c8
7
- data.tar.gz: 2909206008b7794ce6ec3a7c850acf66c475c33bc543d55defd9222d8f606fb661d31b99443cc4ba7a0d3d1da920d3a85209d0f8e0cca3de1cd611ccc43634ac
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.get_values([:U8] * length, cursor)
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 > 128
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) * 2**(i * 7)
59
+ res += (byte & 127) << (i * 7)
60
60
 
61
61
  break if (byte & 128).zero?
62
62
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Biryani
2
- VERSION = '0.0.10'.freeze
2
+ VERSION = '0.0.12'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: biryani
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - thekuwayama
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  - !ruby/object:Gem::Version
100
100
  version: '0'
101
101
  requirements: []
102
- rubygems_version: 4.0.8
102
+ rubygems_version: 4.0.6
103
103
  specification_version: 4
104
104
  summary: An HTTP/2 server implemented using Ruby Ractor
105
105
  test_files: []