aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #29777 from yui-knk/set_content_typeMatthew Draper2017-08-021-3/+2
|\ | | | | Refactoring `Response#charset=`
| * Brush up local variables assignmentyui-knk2017-07-131-3/+2
| |
| * Use `#set_content_type` instead of `#set_header`yui-knk2017-07-131-1/+1
| | | | | | | | | | | | By this commit, `#set_header` is called only via `#set_content_type`. This commit makes the role of `#charset=` more clear.
* | Path parameters should default to UTF8eileencodes2017-08-012-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit changes the behavior such the path_params now default to UTF8 just like regular parameters. This also changes the behavior such that if a path parameter contains invalid UTF8 it returns a 400 bad request. Previously the behavior was to encode the path params as binary but that's not the same as query params. So this commit makes path params behave the same as query params. It's important to test with a path that's encoded as binary because that's how paths are encoded from the socket. The test that was altered was changed to make the behavior for bad encoding the same as query params. We want to treat path params the same as query params. The params in the test are invalid UTF8 so they should return a bad request. Fixes #29669 *Eileen M. Uchitelle, Aaron Patterson, & Tsukuru Tanimichi*
* | Use frozen string literal in actionpack/Kir Shatrov2017-07-2912-0/+24
| |
* | Make actionpack frozen string friendlyKir Shatrov2017-07-241-1/+1
| |
* | `Response#charset=` uses `default_charset` when `nil` is passedyui-knk2017-07-131-1/+1
|/
* [Action Pack] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-112-0/+2
|
* Prepare AP and AR to be frozen string friendlyKir Shatrov2017-07-062-1/+3
|
* Merge branch 'master' into require_relative_2017Xavier Noria2017-07-021-1/+1
|\
| * Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-0214-14/+0
| | | | | | | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
| * Merge pull request #29540 from kirs/rubocop-frozen-stringMatthew Draper2017-07-0214-0/+14
| |\ | | | | | | | | | Enforce frozen string in Rubocop
| | * Enforce frozen string in RubocopKir Shatrov2017-07-0114-0/+14
| | |
| * | Merge pull request #29506 from pat/frozen-string-literalsMatthew Draper2017-07-021-1/+1
| |\ \ | | |/ | |/| | | | Make ActiveSupport frozen-string-literal friendly.
| | * Make ActionMailer frozen string literal friendly.Pat Allan2017-06-201-1/+1
| | |
* | | [Action Dispatch] require => require_relativeAkira Matsuda2017-07-014-11/+11
|/ /
* | Merge branch 'master' into bug/filtered_parameters_classLeonel Galán2017-06-163-6/+4
|\|
| * Use mattr_accessor default: option throughout the projectGenadi Samokovarov2017-06-033-6/+4
| |
* | Merge branch 'master' into bug/filtered_parameters_classLeonel Galán2017-05-173-7/+17
|\|
| * Fixed string being modified in place causing frozen string errors in Ruby 2.3sepehr5002017-05-151-2/+6
| |
| * Do not try to encoding the parameters when the controller is not definedRafael Mendonça França2017-04-261-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When you have a route that points to an nonexistent controller we raise an exception. This exception was being caught by the DebugExceptions middleware in development, but when trying to render the error page, we are reading the request format[[1][]]. To determine the request format we are reading the format parameters[[2][]], and to be able to read the parameters we need to encode them[[3][]]. This was raising another exception that to encode the parameter we try to load the controller to determine if we need to encode the parameters are binary[[4][]]. This new exception inside the DebugExceptions middleware makes Rails to render a generic error page. To avoid this new exception now we only encode the parameters when the controller can be loaded. Fixes #28892 [1]: https://github.com/rails/rails/blob/f52cdaac6336f99d13622ff9bda556a3124a4121/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb#L80 [2]: https://github.com/rails/rails/blob/f52cdaac6336f99d13622ff9bda556a3124a4121/actionpack/lib/action_dispatch/http/mime_negotiation.rb#L63 [3]: https://github.com/rails/rails/blob/f52cdaac6336f99d13622ff9bda556a3124a4121/actionpack/lib/action_dispatch/http/parameters.rb#L58 [4]: https://github.com/rails/rails/blob/f52cdaac6336f99d13622ff9bda556a3124a4121/actionpack/lib/action_dispatch/http/parameters.rb#L88
| * `respond_to_missing?` should be privateRyuta Kamizono2017-04-221-4/+4
| | | | | | | | | | | | | | Follow up of 03d3f036. Some of `respond_to?` were replaced to `respond_to_missing?` in 03d3f036. But the visibility is still public. It should be private.
* | Merge branch 'master' into bug/filtered_parameters_classLeonel Galán2017-04-036-28/+25
|\|
| * Merge pull request #28528 from domcleal/parseerror-const-deprecationRafael França2017-03-221-1/+2
| |\ | | | | | | Change AD::ParamsParser::ParseError deprecation so it can be rescued
| | * Use DeprecatedConstantAccessor for AD::ParamsParser::ParseErrorDominic Cleal2017-03-221-1/+2
| | | | | | | | | | | | Fixes #28525
| * | Small grammar fixJon Moss2017-03-221-2/+1
| |/ | | | | | | | | | | Tried to make the sentence read more clearly. [ci skip]
| * [docs] fix ActionDispatch documentationHrvoje Šimić2017-03-136-27/+24
| |
* | Use of ParameterFilter no longer forces `request.filtered_parameters' class ↵Leonel Galan2017-02-132-2/+2
|/ | | | | | | | | | to be Hash - Fixes issue described on #27944 - `filtered_query_string` used an Array representation of what semantically is a key value pair: better suited for a Hash. Without this change `filtered_params = original_params.class.new` returns an Array with unintended consequences.
* Removed the `attribute_accessors` required file:Edouard CHIN2017-02-121-1/+0
| | | | - This file is no more needed, the call to `cattr_reader` were removed in https://github.com/rails/rails/commit/9e2948e750fa3f641f20adad4b4ecae89b35faa7#diff-c5146df11f35304765e9ceebed108f57L60 and https://github.com/rails/rails/commit/1fe0a1b5ebebb1372968606b85ce08b93bc145c8#diff-c5146df11f35304765e9ceebed108f57L99
* `respond_to_missing?` should fallback to `super` where method_missing could ↵Akira Matsuda2017-01-151-1/+1
| | | | call `super`
* Fix grammar in action_dispatch/http/parameters.rb [ci skip]kenta-s2017-01-111-1/+1
|
* Current default Rails app encoding "utf-8" looks more like a W3C charset ↵Akira Matsuda2017-01-111-1/+1
| | | | than a ruby encoding
* Make ActionDispatch::Request.parameter_parsers public APIRafael Mendonça França2017-01-111-1/+11
| | | | | | | It is the proper way to configure custom parameters parser and it was being recommended in the deprecation for ActionDispatch::ParamsParser. [ci skip]
* Use proper output format [ci skip] (#27498)प्रथमेश Sonpatki2016-12-291-1/+1
|
* Update request.rb --ci skipShardul Parab2016-12-291-0/+3
| | | | | | | | | | | | | | | | Documentation for ActionDispatch::Request#key? [ci skip] Update request.rb --ci skip Documentation for ActionDispatch::Request#key? [ci skip] Also made change after the review by @rafaelfranca . Update request.rb --ci skip Documentation for ActionDispatch::Request#key? [ci skip] Also made change after the review by @rafaelfranca . Update request.rb --ci skip
* Privatize unneededly protected methods in Action PackAkira Matsuda2016-12-242-9/+9
|
* No need to nodoc private methodsAkira Matsuda2016-12-241-1/+1
|
* Describe what we are protectingAkira Matsuda2016-12-231-0/+2
|
* Document and update API for `skip_parameter_encoding`Aaron Patterson2016-12-212-11/+6
| | | | | | | | This commit changes `parameter_encoding` to `skip_parameter_encoding`. `skip_parameter_encoding` will set encoding on all parameters to ASCII-8BIT for a given action on a particular controller. This allows the controller to handle data when the encoding of that data is unknown, for example file systems or truly binary parameters.
* Only default the response charset when it is first setMatthew Draper2016-12-201-1/+3
| | | | | If it is explicitly cleared (e.g., response.sending_file = true), then we should not try to set it again.
* Do not raise exception when content_type is a empty stringRafael Mendonça França2016-12-091-1/+1
| | | | | When content type header is blank we were raising an exception because `empty?` was being called on nil.
* Merge pull request #27007 from maclover7/jm-fix-26912Rafael Mendonça França2016-11-131-2/+2
|\ | | | | | | Don't error on an empty CONTENT_TYPE
| * Don't error on an empty CONTENT_TYPEJon Moss2016-11-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit prevents a possible issue wherein an empty CONTENT_TYPE header is sent in a request to a Rails application, and then `request.content_mime_type` would return `nil`. This is because the `has_content_type?` guard method was not properly checking the validity of a request's content type; it was only checking to see whether or not the header existed, not whether it had a value stored inside. Relatedly, after an internal discussion, it was determined that the `has_content_type?` method is not meant to be part of the public API, and is therefore changed to a `:nodoc:` method in this commit. The test for this behavior is a little bit ugly, for two reasons. One is that it was difficult to determine where to place the test... I figured the best place would be with the rest of the ParamsWrapper stuff, since that's where the original issue was. Also, we have to do some fancy footwork in calling `dispatch` on the test's controller manually... this is because `ActionController::TestCase` will throw an error if you try and pass in a nil content type, which is exactly what we are trying to test here... Because of that, we have to manually call in to the controller, and bypass the `post` request helper. Fixes #26912. This is a regression in behavior between Rails versions 4.2.x and 5.0.x, which was introduced via [this commit](https://github.com/rails/rails/commit/a9f28600e901b11a9222e34bfae8642bfb753186).
* | Merge pull request #26905 from bogdanvlviv/docsAndrew White2016-11-131-1/+1
|\ \ | |/ |/| Add missing `+` around a some literals.
| * Add missing `+` around a some literals.bogdanvlviv2016-10-271-1/+1
| | | | | | | | | | | | Mainly around `nil` [ci skip]
* | Add more rubocop rules about whitespacesRafael Mendonça França2016-10-294-7/+7
|/
* Deprecated ActionDispatch::ParamsParser::ParamsParserRafael Mendonça França2016-10-102-2/+14
| | | | | | ActionDispatch::ParamsParser class was removed in favor of ActionDispatch::Http::Parameters so it is better to move the error constant to the new class.
* Remove deprecated access to mime types through constantsRafael Mendonça França2016-10-101-26/+0
|
* Fix broken comments indentation caused by rubocop auto-correct [ci skip]Ryuta Kamizono2016-09-141-2/+2
| | | | | | All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772. But comments was still kept absolute position. This commit aligns comments with method definitions for consistency.
* Remove default argument, and extract internal convenience methodJon Moss2016-08-291-6/+12
|