Skip to content

Commit

Permalink
There is no real reason why this has to be the default.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Dec 1, 2024
1 parent ea4b387 commit 5fc22dd
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 37 deletions.
12 changes: 0 additions & 12 deletions lib/protocol/http2/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,6 @@ def send_connection_preface(settings = [])
if @state == :new
@framer.write_connection_preface

# We don't support RFC7540 priorities:
if settings.is_a?(Hash)
settings = settings.dup
else
settings = settings.to_h
end

unless settings.key?(Settings::NO_RFC7540_PRIORITIES)
settings = settings.dup
settings[Settings::NO_RFC7540_PRIORITIES] = 1
end

send_settings(settings)

yield if block_given?
Expand Down
2 changes: 1 addition & 1 deletion lib/protocol/http2/framer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module HTTP2
FRAMES = [
DataFrame,
HeadersFrame,
nil, # PriorityFrame is deprecated / removed.
nil, # PriorityFrame is deprecated and ignored, instead consider using PriorityUpdateFrame instead.
ResetStreamFrame,
SettingsFrame,
PushPromiseFrame,
Expand Down
12 changes: 0 additions & 12 deletions lib/protocol/http2/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,6 @@ def read_connection_preface(settings = [])
if @state == :new
@framer.read_connection_preface

# We don't support RFC7540 priorities:
if settings.is_a?(Hash)
settings = settings.dup
else
settings = settings.to_h
end

unless settings.key?(Settings::NO_RFC7540_PRIORITIES)
settings = settings.dup
settings[Settings::NO_RFC7540_PRIORITIES] = 1
end

send_settings(settings)

read_frame do |frame|
Expand Down
12 changes: 1 addition & 11 deletions test/protocol/http2/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

client_settings_frame = framer.read_frame
expect(client_settings_frame).to be_a Protocol::HTTP2::SettingsFrame
expect(client_settings_frame.unpack).to be == settings + [[Protocol::HTTP2::Settings::NO_RFC7540_PRIORITIES, 1]]
expect(client_settings_frame.unpack).to be == settings

# Fake (empty) server settings:
server_settings_frame = Protocol::HTTP2::SettingsFrame.new
Expand Down Expand Up @@ -63,16 +63,6 @@
end.to raise_exception(Protocol::HTTP2::ProtocolError, message: be =~ /First frame must be Protocol::HTTP2::SettingsFrame/)
end

it "should send connection preface with no RFC7540 priorities" do
server_settings_frame = client.send_connection_preface({}) do
client_settings_frame = server.read_connection_preface({})

expect(client_settings_frame.unpack).to be == [[Protocol::HTTP2::Settings::NO_RFC7540_PRIORITIES, 1]]
end

expect(server_settings_frame.unpack).to be == [[Protocol::HTTP2::Settings::NO_RFC7540_PRIORITIES, 1]]
end

it "can generate a stream id" do
id = client.next_stream_id
expect(id).to be == 1
Expand Down
2 changes: 1 addition & 1 deletion test/protocol/http2/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
# The server immediately sends its own settings frame...
frame = framer.read_frame
expect(frame).to be_a Protocol::HTTP2::SettingsFrame
expect(frame.unpack).to be == server_settings + [[Protocol::HTTP2::Settings::NO_RFC7540_PRIORITIES, 1]]
expect(frame.unpack).to be == server_settings

# And then it acknowledges the client settings:
frame = framer.read_frame
Expand Down

0 comments on commit 5fc22dd

Please sign in to comment.