aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http/parameters.rb
Commit message (Collapse)AuthorAgeFilesLines
* Allow rescue from parameter parse errorsGannon McGibbon2018-11-131-3/+13
| | | | [Gannon McGibbon + Josh Cheek]
* Remove deprecated `ActionController::ParamsParser::ParseError`Rafael Mendonça França2017-10-231-5/+0
|
* Path parameters should default to UTF8eileencodes2017-08-011-6/+8
| | | | | | | | | | | | | | | | | | | | 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-291-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* 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
* Use DeprecatedConstantAccessor for AD::ParamsParser::ParseErrorDominic Cleal2017-03-221-1/+2
| | | | Fixes #28525
* [docs] fix ActionDispatch documentationHrvoje Šimić2017-03-131-4/+4
|
* Fix grammar in action_dispatch/http/parameters.rb [ci skip]kenta-s2017-01-111-1/+1
|
* 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]
* Document and update API for `skip_parameter_encoding`Aaron Patterson2016-12-211-10/+5
| | | | | | | | 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.
* Deprecated ActionDispatch::ParamsParser::ParamsParserRafael Mendonça França2016-10-101-1/+13
| | | | | | ActionDispatch::ParamsParser class was removed in favor of ActionDispatch::Http::Parameters so it is better to move the error constant to the new class.
* Add three new rubocop rulesRafael Mendonça França2016-08-161-1/+1
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* Make private method privateRafael Mendonça França2016-08-121-11/+11
|
* Allow specifying encoding of parameters by actionKerri Miller2016-08-091-0/+16
| | | | | At GitHub we need to handle parameter encodings that are not UTF-8. This patch allows us to specify encodings per parameter per action.
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-13/+13
|
* modernizes hash syntax in actionpackXavier Noria2016-08-061-1/+1
|
* applies new string literal convention in actionpack/libXavier Noria2016-08-061-2/+2
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Also yield in parameters for a nil content_mime_typeJulian Nadeau2016-07-251-1/+1
|
* Check `request.path_parameters` encoding at the point they're setGrey Baker2016-07-141-0/+7
| | | | | | | | Check for any non-UTF8 characters in path parameters at the point they're set in `env`. Previously they were checked for when used to get a controller class, but this meant routes that went directly to a Rack app, or skipped controller instantiation for some other reason, had to defend against non-UTF8 characters themselves.
* Transform the mime object to symbol when registering the parsersRafael Mendonça França2016-02-221-4/+13
| | | | | This will keep our current API working without having the users to change their codebases.
* Use symbol of mime type instead of object to get correct parserMehmet Emin İNAÇ2016-02-221-2/+2
| | | | | | After registering new `:json` mime type `parsers.fetch` can't find the mime type because new mime type is not equal to old one. Using symbol of the mime type as key on parsers hash solves the problem. Closes #23766
* Remember the parameter hash we returnMatthew Draper2015-12-221-1/+1
| | | | Callers expect to be able to manipulate it.
* Deprecate exception#original_exception in favor of exception#causeYuki Nishijima2015-11-031-2/+2
|
* Use `Mime[:foo]` instead of `Mime::Type[:FOO]` for back compatJeremy Daer2015-10-061-1/+1
| | | | | | | | | | | | | | | | | Rails 4.x and earlier didn't support `Mime::Type[:FOO]`, so libraries that support multiple Rails versions would've had to feature-detect whether to use `Mime::Type[:FOO]` or `Mime::FOO`. `Mime[:foo]` has been around for ages to look up registered MIME types by symbol / extension, though, so libraries and plugins can safely switch to that without breaking backward- or forward-compatibility. Note: `Mime::ALL` isn't a real MIME type and isn't registered for lookup by type or extension, so it's not available as `Mime[:all]`. We use it internally as a wildcard for `respond_to` negotiation. If you use this internal constant, continue to reference it with `Mime::ALL`. Ref. efc6dd550ee49e7e443f9d72785caa0f240def53
* deprecate accessing mime types via constantsAaron Patterson2015-09-211-1/+1
| | | | | | | | | | | | | | | | | | We don't want to manage a list of constants on `Mime::`. Managing constants is strange because it will break method caches, not to mention looking up by a constant could cause troubles. For example suppose there is a top level constant `HTML`, but nobody registers the HTML mime type and someone accesses `Mime::HTML`. Instead of getting an error about how the mime type doesn't exist, instead you'll get the top level constant. So, instead of directly accessing the constants, change this: Mime::HTML To this: Mime::Type[:HTML]
* remove the request parameter from `parse_formatted_parameters`Aaron Patterson2015-09-181-5/+5
| | | | | This is an instance method on the request object now so we don't need it anymore
* push the parameter parsers on to the classAaron Patterson2015-09-181-0/+35
| | | | | | | | The middleware stack is a singleton in the application (one instance is shared for the entire application) which means that there was only one opportunity to set the parameter parsers. Since there is only one set of parameter parsers in an app, lets just configure them on the request class (since that is where they are used).
* Code cleanupMarcin Olichwirowicz2015-08-271-11/+0
| | | | | | | | Cleanup for `ActionDispatch::Http::Parameters` - no need for required libraries and remove not used private method. Apparently this method was used in `ActionDispatch::Http::Request` - fixed by calling `Request::Utils` explicitly (as was done in other parts of the codebase)
* use get / set header to avoid depending on the `env` ivarAaron Patterson2015-08-221-11/+14
|
* push param encoding in to the utils moduleAaron Patterson2015-07-211-14/+1
| | | | we'll refactor deep munge mostly out of existence shortly
* recurse for arrays in `normalize_encode_params`Aaron Patterson2015-07-211-5/+3
| | | | | this just pushes the conditional in to the case / when so we can switch to method dispatch later
* Remove deprecated `ActionDispatch::Http::Parameters#symbolized_path_parameters`Rafael Mendonça França2015-01-041-8/+0
|
* edit pass over all warningsXavier Noria2014-10-281-1/+1
| | | | | | | | | | | | | | | This patch uniformizes warning messages. I used the most common style already present in the code base: * Capitalize the first word. * End the message with a full stop. * "Rails 5" instead of "Rails 5.0". * Backticks for method names and inline code. Also, converted a few long strings into the new heredoc convention.
* Merge pull request #13999 from jamox/update_rackAaron Patterson2014-07-081-9/+2
|\ | | | | This updates rails to use edge rack
| * Since upgrading rack we can remove unnecessary string encodingsJarmo Isotalo2014-05-191-9/+2
| | | | | | | | https://github.com/rack/rack/commit/5a5aee36
* | Remove symbolized_path_parameters.Guo Xiang Tan2014-07-021-3/+4
| | | | | | | | This pull request is a continuation of https://github.com/rails/rails/commit/925bd975 and https://github.com/rails/rails/commit/8d8ebe3d.
* | Merge pull request #15349 from tgxworld/remove_duplicated_method_callRafael Mendonça França2014-06-031-1/+0
|\ \ | | | | | | Remove duplicated HashWithIndifferentAccess#with_indifferent_access.
| * | Remove duplicated HashWithIndifferentAccess#with_indifferent_access.Guo Xiang Tan2014-05-261-1/+0
| | |
* | | rm dead codeAaron Patterson2014-05-271-5/+0
| | |
* | | PARAMETERS_KEY is only used in the request, so move the constant thereAaron Patterson2014-05-271-2/+4
| | |
* | | rm reset_parameters because we automatically do it from 9ca4839aAaron Patterson2014-05-271-4/+0
|/ /
* | just return path parametersAaron Patterson2014-05-221-2/+1
| |
* | Fix the hash key being delete from envRafael Mendonça França2014-05-221-1/+1
| | | | | | | | It was changed by mistake at c5d64b2b86aa42f57881091491ee289b3c489c7e.
* | use the existing constant rather than the hardcoded stringAaron Patterson2014-05-211-3/+3
|/ | | | | | | | | | | so tht I don't go totally insane with THsi crazy hash driven development. why is Everything a hash? Why do people think hashes in hashes with random keys is a Good API? You can't find things or deprecate them or control access whatsoever, you just have to hope that everyone is like "oh, you want to change that? that's cool! we all know it's hashes so go for it!" The End.
* Use each_with_objectSantiago Pastorino2013-08-191-4/+2
|
* Organize normalize_encoding_params' conditionals a bit better and use a case ↵Santiago Pastorino2013-08-191-15/+18
| | | | | | statement for it Refactor of the work done in #11891
* Normalize file parameters in same place as other parameters ↵robertomiranda2013-08-141-0/+2
| | | | (ActionDispatch::Http::Parameters#normalize_encode_params)
* Refactor ActionDispatch::Http::Parameters#normalize_encode_paramsGenadi Samokovarov2013-06-041-11/+7
|