Skip to content

Commit 90f0baf

Browse files
committed
Expanded documentation for unwrap_headers.
1 parent cd6d4ec commit 90f0baf

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/protocol/rack/adapter/generic.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,17 @@ def logger
3434
Console
3535
end
3636

37-
# Unwrap raw HTTP headers into the CGI-style expected by Rack middleware.
37+
# Unwrap HTTP headers into the CGI-style expected by Rack middleware, and add them to the rack `env`.
3838
#
39-
# Rack separates multiple headers with the same key, into a single field with multiple lines.
39+
# e.g. `accept-encoding` becomes `HTTP_ACCEPT_ENCODING`.
40+
#
41+
# Headers keys with underscores will generate the same CGI-style header key as headers with dashes.
42+
#
43+
# e.g `accept_encoding` becomes `HTTP_ACCEPT_ENCODING` too.
44+
#
45+
# You should not implicitly trust the `HTTP_` headers for security purposes, as they are generated by the client.
46+
#
47+
# Multiple headers are combined with a comma, with one exception: `HTTP_COOKIE` headers are combined with a semicolon.
4048
#
4149
# @parameter headers [Protocol::HTTP::Headers] The raw HTTP request headers.
4250
# @parameter env [Hash] The rack request `env`.

0 commit comments

Comments
 (0)