~michaelforrest/use-case-mapper/trunk

« back to all changes in this revision

Viewing changes to vendor/rails/actionpack/lib/action_controller/cgi_ext/query_extension.rb

  • Committer: Richard Lee (Canonical)
  • Date: 2010-10-15 15:17:58 UTC
  • mfrom: (190.1.3 use-case-mapper)
  • Revision ID: richard.lee@canonical.com-20101015151758-wcvmfxrexsongf9d
Merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
require 'cgi'
2
 
 
3
 
class CGI #:nodoc:
4
 
  module QueryExtension
5
 
    # Remove the old initialize_query method before redefining it.
6
 
    remove_method :initialize_query
7
 
 
8
 
    # Neuter CGI parameter parsing.
9
 
    def initialize_query
10
 
      # Fix some strange request environments.
11
 
      env_table['REQUEST_METHOD'] ||= 'GET'
12
 
 
13
 
      # POST assumes missing Content-Type is application/x-www-form-urlencoded.
14
 
      if env_table['CONTENT_TYPE'].blank? && env_table['REQUEST_METHOD'] == 'POST'
15
 
        env_table['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'
16
 
      end
17
 
 
18
 
      @cookies = CGI::Cookie::parse(env_table['HTTP_COOKIE'] || env_table['COOKIE'])
19
 
      @params = {}
20
 
    end
21
 
  end
22
 
end