diff --git a/lib/protocol/http/header/connection.rb b/lib/protocol/http/header/connection.rb index 33a8246..ceab81c 100644 --- a/lib/protocol/http/header/connection.rb +++ b/lib/protocol/http/header/connection.rb @@ -22,7 +22,7 @@ def << value end def keep_alive? - self.include?(KEEP_ALIVE) + self.include?(KEEP_ALIVE) && !close? end def close? diff --git a/test/protocol/http/header/connection.rb b/test/protocol/http/header/connection.rb index 5ea6c23..55956e6 100644 --- a/test/protocol/http/header/connection.rb +++ b/test/protocol/http/header/connection.rb @@ -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?)