mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #8476 from sheerun/fix/multipart-get
Prevent raising EOFError on multipart GET request.
This commit is contained in:
commit
b04fe4c539
3 changed files with 19 additions and 1 deletions
|
@ -749,4 +749,6 @@
|
||||||
* `ActionView::Helpers::TextHelper#highlight` now defaults to the
|
* `ActionView::Helpers::TextHelper#highlight` now defaults to the
|
||||||
HTML5 `mark` element. *Brian Cardarella*
|
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.
|
Please check [3-2-stable](https://github.com/rails/rails/blob/3-2-stable/actionpack/CHANGELOG.md) for previous changes.
|
||||||
|
|
|
@ -12,7 +12,11 @@ module ActionDispatch
|
||||||
# Returns both GET and POST \parameters in a single hash.
|
# Returns both GET and POST \parameters in a single hash.
|
||||||
def parameters
|
def parameters
|
||||||
@env["action_dispatch.request.parameters"] ||= begin
|
@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)
|
params.merge!(path_parameters)
|
||||||
encode_params(params).with_indifferent_access
|
encode_params(params).with_indifferent_access
|
||||||
end
|
end
|
||||||
|
|
|
@ -123,6 +123,18 @@ class MultipartParamsParsingTest < ActionDispatch::IntegrationTest
|
||||||
end
|
end
|
||||||
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
|
private
|
||||||
def fixture(name)
|
def fixture(name)
|
||||||
File.open(File.join(FIXTURE_PATH, name), 'rb') do |file|
|
File.open(File.join(FIXTURE_PATH, name), 'rb') do |file|
|
||||||
|
|
Loading…
Reference in a new issue