http-protocol 0.1.1 → 0.2.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ba0f4a74cb833ca6a7c69171365f88c20bbec3259f772113584925184eaa94d
|
4
|
+
data.tar.gz: 26a7e84575e89fb6df648385919c78d83b97eebdc62964f2236760d9014bdcab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0e337d55ea940907d52cd94767b2a6a0016a19512b35cbdf8632e96f82ef510d06de7d63e2bafea741d6c37fd0f55966ffcdf3865b1829b107891533b237b4c
|
7
|
+
data.tar.gz: 7c9c8dd1cd2684a8036260cbd847d60e1540450467cc871460a6baa63a9f460906d0c3bf3f0e6494ba6e4db5c0e11273bd0b6fbb356eed4128ee3c9181214846
|
@@ -127,13 +127,18 @@ module HTTP
|
|
127
127
|
|
128
128
|
def send_goaway(error_code = 0, message = "")
|
129
129
|
frame = GoawayFrame.new
|
130
|
-
frame.pack @
|
130
|
+
frame.pack @remote_stream_id, error_code, message
|
131
131
|
|
132
132
|
write_frame(frame)
|
133
133
|
|
134
134
|
@state = :closed
|
135
135
|
end
|
136
136
|
|
137
|
+
def receive_goaway(frame)
|
138
|
+
@state = :closed
|
139
|
+
@framer.close
|
140
|
+
end
|
141
|
+
|
137
142
|
def write_frame(frame)
|
138
143
|
# puts "#{self.class} #{@state} write_frame: #{frame.inspect}"
|
139
144
|
@framer.write_frame(frame)
|
@@ -260,11 +265,20 @@ module HTTP
|
|
260
265
|
end
|
261
266
|
end
|
262
267
|
|
268
|
+
def deleted_stream? frame
|
269
|
+
frame.stream_id <= @local_stream_id or frame.stream_id <= @remote_stream_id
|
270
|
+
end
|
271
|
+
|
263
272
|
def receive_priority(frame)
|
264
273
|
if stream = @streams[frame.stream_id]
|
265
274
|
stream.receive_priority(frame)
|
275
|
+
elsif deleted_stream? frame
|
276
|
+
# ignore
|
266
277
|
else
|
267
|
-
|
278
|
+
stream = create_stream(frame.stream_id)
|
279
|
+
stream.receive_priority(frame)
|
280
|
+
|
281
|
+
@streams[frame.stream_id] = stream
|
268
282
|
end
|
269
283
|
end
|
270
284
|
|
@@ -273,6 +287,8 @@ module HTTP
|
|
273
287
|
stream.receive_reset_stream(frame)
|
274
288
|
|
275
289
|
@streams.delete(stream.id)
|
290
|
+
elsif deleted_stream? frame
|
291
|
+
# ignore
|
276
292
|
else
|
277
293
|
raise ProtocolError, "Bad stream"
|
278
294
|
end
|
@@ -283,8 +299,8 @@ module HTTP
|
|
283
299
|
super
|
284
300
|
elsif stream = @streams[frame.stream_id]
|
285
301
|
stream.receive_window_update(frame)
|
286
|
-
elsif
|
287
|
-
#
|
302
|
+
elsif deleted_stream? frame
|
303
|
+
# ignore
|
288
304
|
else
|
289
305
|
raise ProtocolError, "Cannot update window of non-existant stream: #{frame.stream_id}"
|
290
306
|
end
|
@@ -60,6 +60,10 @@ module HTTP
|
|
60
60
|
@buffer = String.new.b
|
61
61
|
end
|
62
62
|
|
63
|
+
def close
|
64
|
+
@io.close
|
65
|
+
end
|
66
|
+
|
63
67
|
def write_connection_preface
|
64
68
|
@io.write(CONNECTION_PREFACE_MAGIC)
|
65
69
|
end
|
@@ -97,7 +101,12 @@ module HTTP
|
|
97
101
|
end
|
98
102
|
|
99
103
|
def read_header
|
100
|
-
|
104
|
+
if buffer = @io.read(9)
|
105
|
+
return Frame.parse_header(buffer)
|
106
|
+
else
|
107
|
+
# TODO: Is this necessary? I thought the IO would throw this.
|
108
|
+
raise EOFError
|
109
|
+
end
|
101
110
|
end
|
102
111
|
end
|
103
112
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http-protocol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.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: 2018-
|
11
|
+
date: 2018-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http-hpack
|