aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2015-10-26 21:42:53 +0900
committerKazuki Yamaguchi <k@rhe.jp>2015-10-26 21:42:53 +0900
commit18043d0510439347a10bd18e57f998049bbd4ba2 (patch)
treeffa2998a9196e9d82392433289c5a36ac93a5f3f
parentdd5209c919a52ce0a026f006b65dc9041ecedd7b (diff)
downloadplum-18043d0510439347a10bd18e57f998049bbd4ba2.tar.gz
rack/connection: remove invalid response headers
-rw-r--r--lib/plum/rack/connection.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/plum/rack/connection.rb b/lib/plum/rack/connection.rb
index 75569c7..27813a5 100644
--- a/lib/plum/rack/connection.rb
+++ b/lib/plum/rack/connection.rb
@@ -3,6 +3,8 @@ using Plum::BinaryString
module Plum
module Rack
+ INVALID_HEADERS = Set["connection", "keep-alive", "proxy-connection", "transfer-encoding", "upgrade"].freeze
+
class Connection
attr_reader :app, :plum
@@ -139,10 +141,8 @@ module Plum
when ":scheme"
ebase["rack.url_scheme"] = v
else
- if k.start_with?(":")
- # unknown HTTP/2 pseudo-headers
- else
- if "cookie" == k && ebase["HTTP_COOKIE"]
+ unless k.start_with?(":") # ignore unknown pseudo-headers
+ if k == "cookie" && ebase["HTTP_COOKIE"]
if ebase["HTTP_COOKIE"].frozen?
(ebase["HTTP_COOKIE"] += "; ") << v
else
@@ -173,7 +173,7 @@ module Plum
if "set-cookie" == key
rbase[key] = v_.gsub("\n", "; ") # RFC 7540 8.1.2.5
- else
+ elsif !INVALID_HEADERS.member?(key)
key.byteshift(2) if key.start_with?("x-")
rbase[key] = v_.tr("\n", ",") # RFC 7230 7
end