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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a248a6b8419639fb567474da1539e38772b452b706d21ef12c52c02adb60352d
4
- data.tar.gz: 302d1563c4c6516d88d2487ef63eeac1fa9277739194d8bf60716b0a40e52f9b
3
+ metadata.gz: dc3146b471e66a9c5aa3c96ca8542b8a0c62b9e5db3c5ab345f9631320496b66
4
+ data.tar.gz: c1aeb31222c732ed4f7e20cff448b8b6ae0cedc3f6d0fe534084d7d3505131df
5
5
  SHA512:
6
- metadata.gz: a69be0f9448ab54d044326705a3fe70b7b37fc673aef27d04e4c8ac3d2669374a1e4ad25a3385ef227ce2884c7ce80a27bf2b86f140735479e1df48b2cb3bbb9
7
- data.tar.gz: 7d09ffea378ea59cd1e9465669226f6e8b40f1e8e16530a74ec77050aeb159cecf60f4dd9d65c36b059b5405a7cc7c12850e14c5dc428169a542914e059a4203
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, next_stream_id)
34
+ def initialize(framer, local_stream_id)
35
35
  @state = :new
36
36
  @streams = {}
37
37
 
38
38
  @framer = framer
39
- @next_stream_id = next_stream_id
40
- @last_stream_id = 0
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 = @next_stream_id
96
+ id = @local_stream_id
97
97
 
98
- @next_stream_id += 2
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
- stream = Stream.new(self, stream_id)
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 > @last_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 <= @last_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}"
@@ -20,6 +20,6 @@
20
20
 
21
21
  module HTTP
22
22
  module Protocol
23
- VERSION = "0.1.0"
23
+ VERSION = "0.1.1"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http-protocol
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams