Skip to content

Commit 05934d2

Browse files
committed
deprecate the env method on controller instances
people should be accessing request information through the request object, not via the env hash. If they really really want at the env hash, then they can get it off the request.
1 parent 869b007 commit 05934d2

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

‎actionpack/lib/action_controller/metal.rb‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require 'active_support/core_ext/array/extract_options'
22
require 'action_dispatch/middleware/stack'
3+
require 'active_support/deprecation'
34

45
module ActionController
56
# Extend ActionDispatch middleware stack to make it aware of options
@@ -119,6 +120,7 @@ class Metal < AbstractController::Base
119120
def env
120121
@_request.env
121122
end
123+
deprecate :env
122124

123125
# Returns the last part of the controller's name, underscored, without the ending
124126
# <tt>Controller</tt>. For instance, PostsController returns <tt>posts</tt>.

‎actionpack/lib/action_controller/metal/streaming.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ module Streaming
199199
def _process_options(options) #:nodoc:
200200
super
201201
if options[:stream]
202-
if env["HTTP_VERSION"] == "HTTP/1.0"
202+
if request.version == "HTTP/1.0"
203203
options.delete(:stream)
204204
else
205205
headers["Cache-Control"] ||= "no-cache"

‎actionpack/lib/action_dispatch/http/request.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Request < Rack::Request
3535
HTTP_ACCEPT HTTP_ACCEPT_CHARSET HTTP_ACCEPT_ENCODING
3636
HTTP_ACCEPT_LANGUAGE HTTP_CACHE_CONTROL HTTP_FROM
3737
HTTP_NEGOTIATE HTTP_PRAGMA HTTP_CLIENT_IP
38-
HTTP_X_FORWARDED_FOR
38+
HTTP_X_FORWARDED_FOR HTTP_VERSION
3939
].freeze
4040

4141
ENV_METHODS.each do |env|

0 commit comments

Comments
 (0)