Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[client] Be sure to send the preface if receiving data first. #44

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion http-2.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down
14 changes: 12 additions & 2 deletions lib/http/2/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down