aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http/headers.rb
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2013-03-13 11:14:49 +0100
committerYves Senn <yves.senn@gmail.com>2013-03-13 16:27:47 +0100
commit8945be464feb8c9ec8c4e7be52e5195f17a1ef5e (patch)
treea54070d140b34164d06a0a21e6ec433767e72271 /actionpack/lib/action_dispatch/http/headers.rb
parentb5493c83f5c5ab16878827ae0edf25fbf24825e9 (diff)
downloadrails-8945be464feb8c9ec8c4e7be52e5195f17a1ef5e.tar.gz
rails-8945be464feb8c9ec8c4e7be52e5195f17a1ef5e.tar.bz2
rails-8945be464feb8c9ec8c4e7be52e5195f17a1ef5e.zip
Http::Headers respects headers that are not prefixed with HTTP_
Diffstat (limited to 'actionpack/lib/action_dispatch/http/headers.rb')
-rw-r--r--actionpack/lib/action_dispatch/http/headers.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/http/headers.rb b/actionpack/lib/action_dispatch/http/headers.rb
index dc04d4577b..187e83cbd9 100644
--- a/actionpack/lib/action_dispatch/http/headers.rb
+++ b/actionpack/lib/action_dispatch/http/headers.rb
@@ -1,6 +1,16 @@
module ActionDispatch
module Http
class Headers
+ NON_PREFIX_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
+ )
+ HEADER_REGEXP = /\A[A-Za-z-]+\z/
+
include Enumerable
def initialize(env = {})
@@ -32,7 +42,9 @@ module ActionDispatch
end
def cgi_name(k)
- "HTTP_#{k.upcase.gsub(/-/, '_')}"
+ k = k.upcase.gsub(/-/, '_')
+ k = "HTTP_#{k.upcase.gsub(/-/, '_')}" unless NON_PREFIX_VARIABLES.include?(k)
+ k
end
end
end