http-protocol 0.1.0 → 0.1.1
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/http/protocol/http2/connection.rb +9 -12
- data/lib/http/protocol/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: dc3146b471e66a9c5aa3c96ca8542b8a0c62b9e5db3c5ab345f9631320496b66
|
4
|
+
data.tar.gz: c1aeb31222c732ed4f7e20cff448b8b6ae0cedc3f6d0fe534084d7d3505131df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b322ec2b8596ea94eb543efe7b4ace32b32eb15111fbff9760b2fdfe3ef1967c1b766e7b8d87bdee968e46fc594cb4ae8df83fc3eb241d9a3f4a180860c11040
|
7
|
+
data.tar.gz: 3a770b0dc7a42d435cd93823483b6e4d27f80a7d3fb7bd254177f4ea7835d78f107fe4acea2b2959868d4b49cab060e241b813504dce668234d9250a1f6256f9
|
@@ -31,13 +31,13 @@ module HTTP
|
|
31
31
|
class Connection
|
32
32
|
include FlowControl
|
33
33
|
|
34
|
-
def initialize(framer,
|
34
|
+
def initialize(framer, local_stream_id)
|
35
35
|
@state = :new
|
36
36
|
@streams = {}
|
37
37
|
|
38
38
|
@framer = framer
|
39
|
-
@
|
40
|
-
@
|
39
|
+
@local_stream_id = local_stream_id
|
40
|
+
@remote_stream_id = 0
|
41
41
|
|
42
42
|
@local_settings = PendingSettings.new
|
43
43
|
@remote_settings = Settings.new
|
@@ -93,9 +93,9 @@ module HTTP
|
|
93
93
|
|
94
94
|
# Streams are identified with an unsigned 31-bit integer. Streams initiated by a client MUST use odd-numbered stream identifiers; those initiated by the server MUST use even-numbered stream identifiers. A stream identifier of zero (0x0) is used for connection control messages; the stream identifier of zero cannot be used to establish a new stream.
|
95
95
|
def next_stream_id
|
96
|
-
id = @
|
96
|
+
id = @local_stream_id
|
97
97
|
|
98
|
-
@
|
98
|
+
@local_stream_id += 2
|
99
99
|
|
100
100
|
return id
|
101
101
|
end
|
@@ -237,11 +237,7 @@ module HTTP
|
|
237
237
|
end
|
238
238
|
|
239
239
|
def create_stream(stream_id = next_stream_id)
|
240
|
-
|
241
|
-
|
242
|
-
@last_stream_id = stream_id
|
243
|
-
|
244
|
-
return stream
|
240
|
+
Stream.new(self, stream_id)
|
245
241
|
end
|
246
242
|
|
247
243
|
def receive_headers(frame)
|
@@ -251,11 +247,12 @@ module HTTP
|
|
251
247
|
if stream.closed?
|
252
248
|
@streams.delete(stream.id)
|
253
249
|
end
|
254
|
-
elsif frame.stream_id > @
|
250
|
+
elsif frame.stream_id > @remote_stream_id
|
255
251
|
if @streams.count < self.maximum_concurrent_streams
|
256
252
|
stream = create_stream(frame.stream_id)
|
257
253
|
stream.receive_headers(frame)
|
258
254
|
|
255
|
+
@remote_stream_id = stream.id
|
259
256
|
@streams[stream.id] = stream
|
260
257
|
else
|
261
258
|
raise ProtocolError, "Exceeded maximum concurrent streams"
|
@@ -286,7 +283,7 @@ module HTTP
|
|
286
283
|
super
|
287
284
|
elsif stream = @streams[frame.stream_id]
|
288
285
|
stream.receive_window_update(frame)
|
289
|
-
elsif frame.stream_id <= @
|
286
|
+
elsif frame.stream_id <= @local_stream_id or frame.stream_id <= @remote_stream_id
|
290
287
|
# The stream was closed/deleted, ignore
|
291
288
|
else
|
292
289
|
raise ProtocolError, "Cannot update window of non-existant stream: #{frame.stream_id}"
|