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

Prefer 'close' over 'keep-alive' when both are present #41

Merged
Merged
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 lib/protocol/http/header/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def << value
end

def keep_alive?
self.include?(KEEP_ALIVE)
self.include?(KEEP_ALIVE) && !close?
end

def close?
Expand Down
7 changes: 7 additions & 0 deletions test/protocol/http/header/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
end
end

with "close, keep-alive" do
it "should prioritize close over keep-alive" do
expect(header).to be(:close?)
expect(header).not.to be(:keep_alive?)
end
end

with "upgrade" do
it "should indiciate connection can be upgraded" do
expect(header).to be(:upgrade?)
Expand Down
Loading