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) } 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)