http-2 1.1.1 → 1.1.2

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: 8c3e5ca05eb466a1e2f6c0895ccd5827987cfb8bf8ddbefeeb74210e0e6e3e97
4
- data.tar.gz: 8589dab8b8c89aefc5067206219ebcac9bffbc185da25d89a5f6dccc11aafcd8
3
+ metadata.gz: 05c943cd91ee0339a8542cde981636d694618d64c80e30ff0f6ccb55fc636d45
4
+ data.tar.gz: 325abe52e215d7d7007f9fe383a3e8ebd8b1cdfae1a004fc227b5371efb637b8
5
5
  SHA512:
6
- metadata.gz: d66c154674cdd29924c0c169ce60c8eeda6ba833b435b2db74b787e86bab101a7f9748f4fb632ecbecf32aaa216fdf1cd9e8d73c333cd501f454b52d0628c6fe
7
- data.tar.gz: 68f86eca1a92474fd7802502af0883595b52afe42c49c975ea6952e79a523c59508ad5213d18f77f9a50a4539deb6200013407b001f81dcdb5560639ef030242
6
+ metadata.gz: 88a97115e7d09b247b669c304fd3bced538c8be53263ca4f2650ddae125e7d7a3fa6b97419e2f8dbac9dcd3c95a0c581a494fc4b185664ae5d2d64bee9da3d7c
7
+ data.tar.gz: f8f257ed1e984d82c8209677d2496c21f000c9dc23ca6f754fe50b1309c4c2b92491fb4d6dfb608eb5f54923cf47fb1a2f508bbb97fa4ec2b1d62b5f51dbb145
@@ -525,7 +525,8 @@ module HTTP2
525
525
  when :closed
526
526
  case frame_type
527
527
  when :goaway
528
- connection_error
528
+ # 6.8. GOAWAY
529
+ # An endpoint MAY send multiple GOAWAY frames if circumstances change.
529
530
  when :ping
530
531
  ping_management(frame)
531
532
  else
@@ -25,7 +25,7 @@ module HTTP2
25
25
  def read_str(str, n)
26
26
  return "".b if n == 0
27
27
 
28
- chunk = str.byteslice(0..n - 1)
28
+ chunk = str.byteslice(0..(n - 1))
29
29
  remaining = str.byteslice(n..-1)
30
30
  remaining ? str.replace(remaining) : str.clear
31
31
  chunk
data/lib/http/2/framer.rb CHANGED
@@ -185,7 +185,7 @@ module HTTP2
185
185
  {
186
186
  type: type,
187
187
  flags: FRAME_FLAGS[type].filter_map do |name, pos|
188
- name if flags.anybits?((1 << pos))
188
+ name if flags.anybits?(1 << pos)
189
189
  end,
190
190
  length: length,
191
191
  stream: stream & RBIT
@@ -359,7 +359,7 @@ module HTTP2
359
359
  # Padding: Padding octets that contain no application semantic value.
360
360
  # Padding octets MUST be set to zero when sending and ignored when
361
361
  # receiving.
362
- append_str(bytes, ("\0" * padlen))
362
+ append_str(bytes, "\0" * padlen)
363
363
  end
364
364
 
365
365
  frame[:length] = length
@@ -211,7 +211,7 @@ module HTTP2
211
211
  emit = [name, value]
212
212
 
213
213
  # add to table
214
- if type == :incremental && size_check(name.bytesize + value.bytesize + 32)
214
+ if type == :incremental && size_check?(name.bytesize + value.bytesize + 32)
215
215
  @table.unshift(emit)
216
216
  @current_table_size += name.bytesize + value.bytesize + 32
217
217
  @_table_updated = true
@@ -302,7 +302,7 @@ module HTTP2
302
302
  # When the size is reduced, some headers might be evicted.
303
303
  def table_size=(size)
304
304
  @limit = size
305
- size_check(0)
305
+ resize_table(0)
306
306
  end
307
307
 
308
308
  def listen_on_table
@@ -313,22 +313,25 @@ module HTTP2
313
313
 
314
314
  private
315
315
 
316
+ def resize_table(cmdsize)
317
+ return if @table.empty?
318
+
319
+ while @current_table_size + cmdsize > @limit
320
+
321
+ name, value = @table.pop
322
+ @current_table_size -= name.bytesize + value.bytesize + 32
323
+ break if @table.empty?
324
+
325
+ end
326
+ end
327
+
316
328
  # To keep the dynamic table size lower than or equal to @limit,
317
329
  # remove one or more entries at the end of the dynamic table.
318
330
  #
319
331
  # @param cmdsize [Integer]
320
332
  # @return [Boolean] whether +cmd+ fits in the dynamic table.
321
- def size_check(cmdsize)
322
- unless @table.empty?
323
- while @current_table_size + cmdsize > @limit
324
-
325
- name, value = @table.pop
326
- @current_table_size -= name.bytesize + value.bytesize + 32
327
- break if @table.empty?
328
-
329
- end
330
- end
331
-
333
+ def size_check?(cmdsize)
334
+ resize_table(cmdsize)
332
335
  cmdsize <= @limit
333
336
  end
334
337
  end
@@ -29,7 +29,7 @@ module HTTP2
29
29
  def encode(str, buffer = "".b)
30
30
  bitstring = String.new("", encoding: Encoding::BINARY, capacity: (str.bytesize * 30) + ((8 - str.size) % 8))
31
31
  str.each_byte { |chr| append_str(bitstring, ENCODE_TABLE[chr]) }
32
- append_str(bitstring, ("1" * ((8 - bitstring.size) % 8)))
32
+ append_str(bitstring, "1" * ((8 - bitstring.size) % 8))
33
33
  pack([bitstring], "B*", buffer: buffer)
34
34
  end
35
35
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTTP2
4
- VERSION = "1.1.1"
4
+ VERSION = "1.1.2"
5
5
  end
@@ -46,7 +46,9 @@ module HTTP2
46
46
 
47
47
  def add_to_table: (string name, string value) -> void
48
48
 
49
- def size_check: (Integer cmdsize) -> bool
49
+ def resize_table: (Integer cmdsize) -> void
50
+
51
+ def size_check?: (Integer cmdsize) -> bool
50
52
  end
51
53
  end
52
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http-2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
@@ -9,7 +9,7 @@ authors:
9
9
  - Kaoru Maeda
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-04-16 00:00:00.000000000 Z
12
+ date: 1980-01-02 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Pure-ruby HTTP 2.0 protocol implementation
15
15
  email:
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  requirements: []
80
- rubygems_version: 3.6.2
80
+ rubygems_version: 3.6.9
81
81
  specification_version: 4
82
82
  summary: Pure-ruby HTTP 2.0 protocol implementation
83
83
  test_files: []