From 02ba3f089363c2869d211faa5e24bb7f286d2f13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Tue, 29 Dec 2015 14:11:35 +0100 Subject: [PATCH 1/2] [client] Be sure to send the preface if receiving data first. --- lib/http/2/client.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/http/2/client.rb b/lib/http/2/client.rb index f4aacfa8..95ede3fd 100644 --- a/lib/http/2/client.rb +++ b/lib/http/2/client.rb @@ -34,13 +34,23 @@ def initialize(**settings) # @see Connection # @param frame [Hash] def send(frame) - send_connection_preface + if @state == :waiting_connection_preface + send_connection_preface + end super(frame) end + def connection_management(frame) + if @state == :waiting_connection_preface + send_connection_preface + connection_settings(frame) + else + super(frame) + end + end + # Emit the connection preface if not yet def send_connection_preface - return unless @state == :waiting_connection_preface @state = :connected emit(:frame, CONNECTION_PREFACE_MAGIC) From 74f387e944d84c8e78eb28e694716ead5a5a489d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Thu, 31 Dec 2015 14:06:53 +0100 Subject: [PATCH 2/2] [gemspec] Required keyword arguments require Ruby >= 2.1.0. Required keyword arguments are used e.g. here: https://github.com/igrigorik/http-2/blob/2bb4a4b42d4907354dad550989048a372f581c1a/lib/http/2/stream.rb#L74 --- http-2.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http-2.gemspec b/http-2.gemspec index 16078c68..269b4b67 100644 --- a/http-2.gemspec +++ b/http-2.gemspec @@ -12,7 +12,7 @@ Gem::Specification.new do |spec| spec.summary = spec.description spec.homepage = 'https://github.com/igrigorik/http-2' spec.license = 'MIT' - spec.required_ruby_version = '>=2.0.0' + spec.required_ruby_version = '>=2.1.0' spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR) spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }