Changeset 1303
- Timestamp:
- 05/14/05 08:36:19 (3 years ago)
- Files:
-
- trunk/actionpack/lib/action_controller/cgi_ext/cgi_ext.rb (modified) (1 diff)
- trunk/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb (modified) (3 diffs)
- trunk/actionpack/lib/action_controller/cgi_process.rb (modified) (1 diff)
- trunk/actionpack/lib/action_controller/request.rb (modified) (1 diff)
- trunk/actionpack/lib/action_controller/vendor/xml_simple.rb (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/lib/action_controller/cgi_ext/cgi_ext.rb
r525 r1303 26 26 27 27 def request_parameters 28 CGIMethods.parse_request_parameters(params )28 CGIMethods.parse_request_parameters(params, env_table) 29 29 end 30 30 trunk/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
r39 r1303 1 1 require 'cgi' 2 require 'action_controller/vendor/xml_simple' 2 3 3 4 # Static methods for parsing the query and request parameters that can be used in … … 17 18 18 19 if k =~ /(.*)\[\]$/ 19 if parsed_params.has_key? $120 parsed_params[$1] << v21 else22 parsed_params[$1] = [v]23 end20 if parsed_params.has_key? $1 21 parsed_params[$1] << v 22 else 23 parsed_params[$1] = [v] 24 end 24 25 else 25 parsed_params[k] = v.nil? ? nil : v26 parsed_params[k] = v.nil? ? nil : v 26 27 end 27 28 } … … 46 47 47 48 return parsed_params 49 end 50 51 def self.parse_formatted_request_parameters(format, raw_post_data) 52 case format 53 when :xml 54 return XmlSimple.xml_in(raw_post_data, 'ForceArray' => false) 55 when :yaml 56 return YAML.load(raw_post_data) 57 end 58 rescue Object => e 59 { "exception" => "#{e.message} (#{e.class})", "backtrace" => e.backtrace, 60 "raw_post_data" => raw_post_data, "format" => format } 48 61 end 49 62 trunk/actionpack/lib/action_controller/cgi_process.rb
r1211 r1303 64 64 65 65 def request_parameters 66 CGIMethods.parse_request_parameters(@cgi.params) 66 if env['HTTP_POST_DATA_FORMAT'] 67 CGIMethods.parse_formatted_request_parameters(env['HTTP_POST_DATA_FORMAT'].downcase.intern, env['RAW_POST_DATA']) 68 else 69 CGIMethods.parse_request_parameters(@cgi.params) 70 end 67 71 end 68 72 trunk/actionpack/lib/action_controller/request.rb
r1211 r1303 30 30 def head? 31 31 method == :head 32 end 33 34 35 def post_format 36 if env['POST_DATA_FORMAT'] 37 env['POST_DATA_FORMAT'].downcase.intern 38 else 39 :query_string 40 end 41 end 42 43 def formatted_post? 44 [ :xml, :yaml ].include?(post_format) && post? 45 end 46 47 def xml_post? 48 post_format == :xml && post? 49 end 50 51 def yaml_post? 52 post_format == :yaml && post? 32 53 end 33 54