lib/http/protocol/http2/client.rb in http-protocol-0.14.0 vs lib/http/protocol/http2/client.rb in http-protocol-0.15.0
- old
+ new
@@ -41,9 +41,26 @@
end
else
raise ProtocolError, "Cannot send connection preface in state #{@state}"
end
end
+
+ def receive_push_promise(frame)
+ if frame.stream_id == 0
+ raise ProtocolError, "Cannot receive headers for stream 0!"
+ end
+
+ if stream = @streams[frame.stream_id]
+ # This is almost certainly invalid:
+ promised_stream, request_headers = stream.receive_push_promise(frame)
+
+ if stream.closed?
+ @streams.delete(stream.id)
+ end
+
+ return promised_stream, request_headers
+ end
+ end
end
end
end
end