Permalink
Browse files

Use a frozen Set instance for CGI_VARIABLES.

Also expand the CGI_VARIABLE name listing to multiple lines for cleaner diffs and legibility.
  • Loading branch information...
1 parent aa54c91 commit e7b0947afdc8c9f4119d06628070667b9e7875d1 @nbibler nbibler committed Jun 6, 2014
Showing with 21 additions and 8 deletions.
  1. +21 −8 actionpack/lib/action_dispatch/http/headers.rb
@@ -6,14 +6,27 @@ module Http
# headers = ActionDispatch::Http::Headers.new(env)
# headers["Content-Type"] # => "text/plain"
class Headers
- CGI_VARIABLES = %w(
- CONTENT_TYPE CONTENT_LENGTH
- HTTPS AUTH_TYPE GATEWAY_INTERFACE
- 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
- )
+ CGI_VARIABLES = Set.new(%W[
+ AUTH_TYPE
+ CONTENT_LENGTH
+ CONTENT_TYPE
+ GATEWAY_INTERFACE
+ HTTPS
+ 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/
include Enumerable

0 comments on commit e7b0947

Please sign in to comment.