diff options
Diffstat (limited to 'actionpack/lib/action_controller/cgi_process.rb')
-rw-r--r-- | actionpack/lib/action_controller/cgi_process.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/cgi_process.rb b/actionpack/lib/action_controller/cgi_process.rb index 59849c7364..ee6e5ca250 100644 --- a/actionpack/lib/action_controller/cgi_process.rb +++ b/actionpack/lib/action_controller/cgi_process.rb @@ -58,6 +58,16 @@ module ActionController #:nodoc: end end + # The request body is an IO input stream. If the RAW_POST_DATA environment + # variable is already set, wrap it in a StringIO. + def body + if raw_post = env['RAW_POST_DATA'] + StringIO.new(raw_post) + else + @cgi.stdinput + end + end + def query_parameters @query_parameters ||= (qs = self.query_string).empty? ? {} : CGI.parse_query_parameters(qs) @@ -66,7 +76,7 @@ module ActionController #:nodoc: def request_parameters @request_parameters ||= if ActionController::Base.param_parsers.has_key?(content_type) - CGI.parse_formatted_request_parameters(content_type, @env['RAW_POST_DATA']) + CGI.parse_formatted_request_parameters(content_type, body.read) else CGI.parse_request_parameters(@cgi.params) end |