protocol-http2 0.19.3 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/protocol/http2/connection.rb +3 -1
- data/lib/protocol/http2/dependency.rb +34 -7
- data/lib/protocol/http2/version.rb +1 -1
- data/lib/traces/provider/protocol/http2/framer.rb +52 -0
- data/lib/traces/provider/protocol/http2.rb +6 -0
- data.tar.gz.sig +0 -0
- metadata +5 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80a795de54c7f452a70b82f310c4f0aa3bda4bd15f034f548114a41bfc8d1649
|
4
|
+
data.tar.gz: 496e203587367c71ce4b0298ba96492d5ce4892842fdcbf57796031556ca3f1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4b587ae75dc73dbd99ff3bc20cafe6c55cb329ab275bac187572730de5d5365f2f8c521d88b32bffb80363736cf0cdc62d579d2495872f13982b4f1cd1fdfa0
|
7
|
+
data.tar.gz: f2964d07b204b702ded73b1a3df961dad07c95989e78311732d4264184b59a6671f7bb81511e1d196c1dd9ccf18f81db1fd8064607c3156550191dc7cec8a5d2
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -62,7 +62,9 @@ module Protocol
|
|
62
62
|
@remote_settings.maximum_frame_size
|
63
63
|
end
|
64
64
|
|
65
|
-
# The maximum number of concurrent streams that this connection can initiate
|
65
|
+
# The maximum number of concurrent streams that this connection can initiate. This is a setting that can be changed by the remote peer.
|
66
|
+
#
|
67
|
+
# It is not the same as the number of streams that can be accepted by the connection. The number of streams that can be accepted is determined by the local settings, and the number of streams that can be initiated is determined by the remote settings.
|
66
68
|
def maximum_concurrent_streams
|
67
69
|
@remote_settings.maximum_concurrent_streams
|
68
70
|
end
|
@@ -58,6 +58,10 @@ module Protocol
|
|
58
58
|
@weight <=> other.weight
|
59
59
|
end
|
60
60
|
|
61
|
+
def == other
|
62
|
+
@id == other.id
|
63
|
+
end
|
64
|
+
|
61
65
|
# The connection this stream belongs to.
|
62
66
|
attr :connection
|
63
67
|
|
@@ -101,13 +105,30 @@ module Protocol
|
|
101
105
|
|
102
106
|
dependency.parent = self
|
103
107
|
|
104
|
-
|
108
|
+
if @ordered_children
|
109
|
+
# Binary search for insertion point:
|
110
|
+
index = @ordered_children.bsearch_index do |child|
|
111
|
+
child.weight >= dependency.weight
|
112
|
+
end
|
113
|
+
|
114
|
+
if index
|
115
|
+
@ordered_children.insert(index, dependency)
|
116
|
+
else
|
117
|
+
@ordered_children.push(dependency)
|
118
|
+
end
|
119
|
+
|
120
|
+
@total_weight += dependency.weight
|
121
|
+
end
|
105
122
|
end
|
106
123
|
|
107
124
|
def remove_child(dependency)
|
108
125
|
@children&.delete(dependency.id)
|
109
126
|
|
110
|
-
|
127
|
+
if @ordered_children
|
128
|
+
# Don't do a linear search here, it can be slow. Instead, the child's parent will be set to `nil`, and we check this in {#consume_window} using `delete_if`.
|
129
|
+
# @ordered_children.delete(dependency)
|
130
|
+
@total_weight -= dependency.weight
|
131
|
+
end
|
111
132
|
end
|
112
133
|
|
113
134
|
# An exclusive flag allows for the insertion of a new level of dependencies. The exclusive flag causes the stream to become the sole dependency of its parent stream, causing other dependencies to become dependent on the exclusive stream.
|
@@ -195,11 +216,17 @@ module Protocol
|
|
195
216
|
end
|
196
217
|
|
197
218
|
# Otherwise, allow the dependent children to use up the available window:
|
198
|
-
self.ordered_children&.
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
219
|
+
self.ordered_children&.delete_if do |child|
|
220
|
+
if child.parent
|
221
|
+
# Compute the proportional allocation:
|
222
|
+
allocated = (child.weight * size) / @total_weight
|
223
|
+
|
224
|
+
child.consume_window(allocated) if allocated > 0
|
225
|
+
|
226
|
+
false
|
227
|
+
else
|
228
|
+
true
|
229
|
+
end
|
203
230
|
end
|
204
231
|
end
|
205
232
|
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2024, by Samuel Williams.
|
5
|
+
|
6
|
+
require "traces/provider"
|
7
|
+
require_relative "../../../../protocol/http2/framer"
|
8
|
+
|
9
|
+
Traces::Provider(Protocol::HTTP2::Framer) do
|
10
|
+
def write_connection_preface
|
11
|
+
Traces.trace("protocol.http2.framer.write_connection_preface") do
|
12
|
+
super
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def read_connection_preface
|
17
|
+
Traces.trace("protocol.http2.framer.read_connection_preface") do
|
18
|
+
super
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def write_frame(frame)
|
23
|
+
attributes = {
|
24
|
+
"frame.length" => frame.length,
|
25
|
+
"frame.class" => frame.class.name,
|
26
|
+
"frame.type" => frame.type,
|
27
|
+
"frame.flags" => frame.flags,
|
28
|
+
"frame.stream_id" => frame.stream_id,
|
29
|
+
}
|
30
|
+
|
31
|
+
Traces.trace("protocol.http2.framer.write_frame", attributes: attributes) do
|
32
|
+
super
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def read_frame(...)
|
37
|
+
Traces.trace("protocol.http2.framer.read_frame") do |span|
|
38
|
+
super.tap do |frame|
|
39
|
+
span["frame.length"] = frame.length
|
40
|
+
span["frame.type"] = frame.type
|
41
|
+
span["frame.flags"] = frame.flags
|
42
|
+
span["frame.stream_id"] = frame.stream_id
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def flush
|
48
|
+
Traces.trace("protocol.http2.framer.flush") do
|
49
|
+
super
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protocol-http2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -40,7 +40,7 @@ cert_chain:
|
|
40
40
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
41
41
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
42
42
|
-----END CERTIFICATE-----
|
43
|
-
date: 2024-
|
43
|
+
date: 2024-11-09 00:00:00.000000000 Z
|
44
44
|
dependencies:
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
46
|
name: protocol-hpack
|
@@ -99,6 +99,8 @@ files:
|
|
99
99
|
- lib/protocol/http2/version.rb
|
100
100
|
- lib/protocol/http2/window.rb
|
101
101
|
- lib/protocol/http2/window_update_frame.rb
|
102
|
+
- lib/traces/provider/protocol/http2.rb
|
103
|
+
- lib/traces/provider/protocol/http2/framer.rb
|
102
104
|
- license.md
|
103
105
|
- readme.md
|
104
106
|
homepage: https://github.com/socketry/protocol-http2
|
@@ -122,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
124
|
- !ruby/object:Gem::Version
|
123
125
|
version: '0'
|
124
126
|
requirements: []
|
125
|
-
rubygems_version: 3.5.
|
127
|
+
rubygems_version: 3.5.22
|
126
128
|
signing_key:
|
127
129
|
specification_version: 4
|
128
130
|
summary: A low level implementation of the HTTP/2 protocol.
|
metadata.gz.sig
CHANGED
Binary file
|