Skip to content

Commit

Permalink
Use a frozen Set instance for CGI_VARIABLES.
Browse files Browse the repository at this point in the history
Also expand the CGI_VARIABLE name listing to multiple lines for cleaner diffs and legibility.
  • Loading branch information
nbibler committed Jun 6, 2014
1 parent aa54c91 commit e7b0947
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions actionpack/lib/action_dispatch/http/headers.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,14 +6,27 @@ module Http
# headers = ActionDispatch::Http::Headers.new(env) # headers = ActionDispatch::Http::Headers.new(env)
# headers["Content-Type"] # => "text/plain" # headers["Content-Type"] # => "text/plain"
class Headers class Headers
CGI_VARIABLES = %w( CGI_VARIABLES = Set.new(%W[
CONTENT_TYPE CONTENT_LENGTH AUTH_TYPE
HTTPS AUTH_TYPE GATEWAY_INTERFACE CONTENT_LENGTH
PATH_INFO PATH_TRANSLATED QUERY_STRING CONTENT_TYPE
REMOTE_ADDR REMOTE_HOST REMOTE_IDENT REMOTE_USER GATEWAY_INTERFACE
REQUEST_METHOD SCRIPT_NAME HTTPS
SERVER_NAME SERVER_PORT SERVER_PROTOCOL SERVER_SOFTWARE PATH_INFO
) PATH_TRANSLATED
QUERY_STRING
REMOTE_ADDR
REMOTE_HOST
REMOTE_IDENT
REMOTE_USER
REQUEST_METHOD
SCRIPT_NAME
SERVER_NAME
SERVER_PORT
SERVER_PROTOCOL
SERVER_SOFTWARE
]).freeze

HTTP_HEADER = /\A[A-Za-z0-9-]+\z/ HTTP_HEADER = /\A[A-Za-z0-9-]+\z/


include Enumerable include Enumerable
Expand Down

0 comments on commit e7b0947

Please sign in to comment.