diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-12-10 12:28:41 -0800 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-12-10 12:28:41 -0800 |
commit | b04fe4c539633ff40deca8729d010accc24aa019 (patch) | |
tree | d46160cbe275fe756961537edc4cdc9311a474ec /actionpack | |
parent | 287a8d878ce18da401cbcc57c718a43c16e1494e (diff) | |
parent | bc254cc23558f016c3697ecd5d39e58f46908018 (diff) | |
download | rails-b04fe4c539633ff40deca8729d010accc24aa019.tar.gz rails-b04fe4c539633ff40deca8729d010accc24aa019.tar.bz2 rails-b04fe4c539633ff40deca8729d010accc24aa019.zip |
Merge pull request #8476 from sheerun/fix/multipart-get
Prevent raising EOFError on multipart GET request.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/CHANGELOG.md | 2 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/http/parameters.rb | 6 | ||||
-rw-r--r-- | actionpack/test/dispatch/request/multipart_params_parsing_test.rb | 12 |
3 files changed, 19 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md index 9db30c8cf7..4d43f771c9 100644 --- a/actionpack/CHANGELOG.md +++ b/actionpack/CHANGELOG.md @@ -749,4 +749,6 @@ * `ActionView::Helpers::TextHelper#highlight` now defaults to the HTML5 `mark` element. *Brian Cardarella* +* Prevent raising EOFError on multipart GET request (IE issue). *Adam Stankiewicz* + Please check [3-2-stable](https://github.com/rails/rails/blob/3-2-stable/actionpack/CHANGELOG.md) for previous changes. diff --git a/actionpack/lib/action_dispatch/http/parameters.rb b/actionpack/lib/action_dispatch/http/parameters.rb index 9a7b5bc8c7..6610315da7 100644 --- a/actionpack/lib/action_dispatch/http/parameters.rb +++ b/actionpack/lib/action_dispatch/http/parameters.rb @@ -12,7 +12,11 @@ module ActionDispatch # Returns both GET and POST \parameters in a single hash. def parameters @env["action_dispatch.request.parameters"] ||= begin - params = request_parameters.merge(query_parameters) + params = begin + request_parameters.merge(query_parameters) + rescue EOFError + query_parameters.dup + end params.merge!(path_parameters) encode_params(params).with_indifferent_access end diff --git a/actionpack/test/dispatch/request/multipart_params_parsing_test.rb b/actionpack/test/dispatch/request/multipart_params_parsing_test.rb index 63c5ea26a6..399f15199c 100644 --- a/actionpack/test/dispatch/request/multipart_params_parsing_test.rb +++ b/actionpack/test/dispatch/request/multipart_params_parsing_test.rb @@ -123,6 +123,18 @@ class MultipartParamsParsingTest < ActionDispatch::IntegrationTest end end + # This can happen in Internet Explorer when redirecting after multipart form submit. + test "does not raise EOFError on GET request with multipart content-type" do + with_routing do |set| + set.draw do + get ':action', to: 'multipart_params_parsing_test/test' + end + headers = { "CONTENT_TYPE" => "multipart/form-data; boundary=AaB03x" } + get "/parse", {}, headers + assert_response :ok + end + end + private def fixture(name) File.open(File.join(FIXTURE_PATH, name), 'rb') do |file| |