protocol-http2 0.11.6 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -1
- data/lib/protocol/http2/connection.rb +4 -9
- data/lib/protocol/http2/flow_controlled.rb +2 -1
- data/lib/protocol/http2/version.rb +1 -1
- data/lib/protocol/http2/window_update_frame.rb +28 -4
- data/protocol-http2.gemspec +2 -2
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99c1f6c39bfa00e6f872c275ce33513a8a5668abd84f790cf3125af3b1d6c5fd
|
4
|
+
data.tar.gz: 5e28c4e9f222db72ef413c88dc0205351688557510e81c408051c147da5e4cea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55a6923f22ad89c5c831cafc45bec918424ea368326f1e584fece860cb9e7c8e001c331b39ce5673db7b28cb2cd8df9b4c3994367b27846e63b3d0013d60c147
|
7
|
+
data.tar.gz: a0b0a7e36751c4da1472c3a8f26a90c9a55af83a5449a563b20bd5f78b734df659fdecd6f70222a006338e011b7e6e117fa68150deaab0c274e7fef411da2a00
|
data/.travis.yml
CHANGED
@@ -2,14 +2,16 @@ language: ruby
|
|
2
2
|
dist: xenial
|
3
3
|
cache: bundler
|
4
4
|
|
5
|
+
script: bundle exec rspec
|
6
|
+
|
5
7
|
matrix:
|
6
8
|
include:
|
7
|
-
- rvm: 2.4
|
8
9
|
- rvm: 2.5
|
9
10
|
- rvm: 2.6
|
10
11
|
- rvm: 2.7
|
11
12
|
- rvm: 2.6
|
12
13
|
env: COVERAGE=PartialSummary,Coveralls
|
14
|
+
- rvm: 2.7
|
13
15
|
- rvm: truffleruby
|
14
16
|
- rvm: jruby-head
|
15
17
|
env: JRUBY_OPTS="--debug -X+O"
|
@@ -55,8 +55,8 @@ module Protocol
|
|
55
55
|
@decoder = HPACK::Context.new
|
56
56
|
@encoder = HPACK::Context.new
|
57
57
|
|
58
|
-
@local_window =
|
59
|
-
@remote_window = Window.new
|
58
|
+
@local_window = LocalWindow.new
|
59
|
+
@remote_window = Window.new
|
60
60
|
end
|
61
61
|
|
62
62
|
def id
|
@@ -183,13 +183,6 @@ module Protocol
|
|
183
183
|
frame.pack(changes)
|
184
184
|
|
185
185
|
write_frame(frame)
|
186
|
-
|
187
|
-
# If the initial window size is set to something bigger than the default, we want to increase it.
|
188
|
-
difference = @local_settings.pending.initial_window_size - @local_window.capacity
|
189
|
-
|
190
|
-
if difference > 0
|
191
|
-
send_window_update(difference)
|
192
|
-
end
|
193
186
|
end
|
194
187
|
|
195
188
|
# Transition the connection into the closed state.
|
@@ -235,6 +228,8 @@ module Protocol
|
|
235
228
|
@streams.each_value do |stream|
|
236
229
|
stream.local_window.capacity = capacity
|
237
230
|
end
|
231
|
+
|
232
|
+
@local_window.desired = capacity
|
238
233
|
end
|
239
234
|
|
240
235
|
def update_remote_settings(changes)
|
@@ -60,13 +60,14 @@ module Protocol
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def consume_local_window(frame)
|
63
|
+
# For flow-control calculations, the 9-octet frame header is not counted.
|
63
64
|
amount = frame.length
|
64
65
|
@local_window.consume(amount)
|
65
66
|
end
|
66
67
|
|
67
68
|
def request_window_update
|
68
69
|
if @local_window.limited?
|
69
|
-
self.send_window_update(@local_window.
|
70
|
+
self.send_window_update(@local_window.wanted)
|
70
71
|
end
|
71
72
|
end
|
72
73
|
|
@@ -33,10 +33,6 @@ module Protocol
|
|
33
33
|
@capacity = capacity
|
34
34
|
end
|
35
35
|
|
36
|
-
def dup
|
37
|
-
return self.class.new(@capacity)
|
38
|
-
end
|
39
|
-
|
40
36
|
# The window is completely full?
|
41
37
|
def full?
|
42
38
|
@available <= 0
|
@@ -73,6 +69,10 @@ module Protocol
|
|
73
69
|
end
|
74
70
|
end
|
75
71
|
|
72
|
+
def wanted
|
73
|
+
@used
|
74
|
+
end
|
75
|
+
|
76
76
|
def limited?
|
77
77
|
@available < (@capacity / 2)
|
78
78
|
end
|
@@ -82,6 +82,30 @@ module Protocol
|
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
|
+
# This is a window which efficiently maintains a desired capacity.
|
86
|
+
class LocalWindow < Window
|
87
|
+
def initialize(capacity = 0xFFFF, desired: nil)
|
88
|
+
super(capacity)
|
89
|
+
|
90
|
+
@desired = desired
|
91
|
+
end
|
92
|
+
|
93
|
+
attr_accessor :desired
|
94
|
+
|
95
|
+
def wanted
|
96
|
+
if @desired
|
97
|
+
# We must send an update which allows at least @desired bytes to be sent.
|
98
|
+
(@desired - @capacity) + @used
|
99
|
+
else
|
100
|
+
@used
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def limited?
|
105
|
+
@available < ((@desired || @capacity) / 2)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
85
109
|
# The WINDOW_UPDATE frame is used to implement flow control.
|
86
110
|
#
|
87
111
|
# +-+-------------------------------------------------------------+
|
data/protocol-http2.gemspec
CHANGED
@@ -18,13 +18,13 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.required_ruby_version = '~> 2.
|
21
|
+
spec.required_ruby_version = '~> 2.5'
|
22
22
|
|
23
23
|
spec.add_dependency "protocol-hpack", "~> 1.4"
|
24
24
|
spec.add_dependency "protocol-http", "~> 0.15"
|
25
25
|
|
26
26
|
spec.add_development_dependency "covered"
|
27
|
+
spec.add_development_dependency "bake-bundler"
|
27
28
|
spec.add_development_dependency "bundler"
|
28
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
29
29
|
spec.add_development_dependency "rspec", "~> 3.0"
|
30
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protocol-http2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: protocol-hpack
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: bundler
|
56
|
+
name: bake-bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -67,19 +67,19 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -144,14 +144,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
144
144
|
requirements:
|
145
145
|
- - "~>"
|
146
146
|
- !ruby/object:Gem::Version
|
147
|
-
version: '2.
|
147
|
+
version: '2.5'
|
148
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
requirements: []
|
154
|
-
rubygems_version: 3.
|
154
|
+
rubygems_version: 3.1.2
|
155
155
|
signing_key:
|
156
156
|
specification_version: 4
|
157
157
|
summary: A low level implementation of the HTTP/2 protocol.
|