- No changes.
- No changes.
- No changes.
- No changes.
-
Fix regression in behavior of
normalize_path.In Rails 5 there was a change to ensure the encoding of the original string in a path was maintained. This was incorrectly backported to Rails 4.2 which caused a regression.
Eileen M. Uchitelle
-
Use more specific check for :format in route path
The current check for whether to add an optional format to the path is very lax and will match things like
:format_idwhere there are nested resources, e.g:resources :formats do resources :items end
Fix this by using a more restrictive regex pattern that looks for the patterns
(.:format),.:formator/at the end of the path. Note that we need to allow for multiple closing parenthesis since the route may be of this form:get "/books(/:action(.:format))", controller: "books"
This probably isn't what's intended since it means that the default index action route doesn't support a format but we have a test for it so we need to allow it.
Fixes #28517.
Andrew White
- No changes.
- No changes.
- No changes.
-
Do not allow render with unpermitted parameter.
Fixes CVE-2016-2098.
Arthur Neves
- No changes.
-
ActionController::TestCasecan teardown gracefully if an error is raised early in thesetupchain.Yves Senn
-
Parse RSS/ATOM responses as XML, not HTML.
Alexander Kaupanin
-
Fix regression in mounted engine named routes generation for app deployed to a subdirectory.
relative_url_rootwas prepended to the path twice (e.g. "/subdir/subdir/engine_path" instead of "/subdir/engine_path")Fixes #20920. Fixes #21459.
Matthew Erhard
-
url_fordoes not modify its arguments when generating polymorphic URLs.Bernerd Schaefer
-
Update
ActionController::TestSession#fetchto behave more likeActionDispatch::Request::Session#fetchwhen using non-string keys.Jeremy Friesen
-
ActionController::TestSession now accepts a default value as well as a block for generating a default value based off the key provided.
This fixes calls to session#fetch in ApplicationController instances that take more two arguments or a block from raising
ArgumentError: wrong number of arguments (2 for 1)when performing controller tests.Matthew Gerrior
-
Fix to keep original header instance in
ActionDispatch::SSLActionDispatch::SSLchanges headers toHash. So some headers will be broken if there are some middlewares onActionDispatch::SSLand if it usesRack::Utils::HeaderHash.Fumiaki Matsushima
-
Fix rake routes not showing the right format when nesting multiple routes.
See #18373.
Ravil Bayramgalin
-
Fix regression where a gzip file response would have a Content-type, even when it was a 304 status code.
See #19271.
Kohei Suzuki
-
Fix handling of empty X_FORWARDED_HOST header in raw_host_with_port
Previously, an empty X_FORWARDED_HOST header would cause Actiondispatch::Http:URL.raw_host_with_port to return nil, causing Actiondispatch::Http:URL.host to raise a NoMethodError.
Adam Forsyth
-
Fallback to
ENV['RAILS_RELATIVE_URL_ROOT']inurl_for.Fixed an issue where the
RAILS_RELATIVE_URL_ROOTenvironment variable is not prepended to the path whenurl_foris called. IfSCRIPT_NAME(used by Rack) is set, it takes precedence.Fixes #5122.
Yasyf Mohamedali
-
Fix regression in functional tests. Responses should have default headers assigned.
See #18423.
Jeremy Kemper, Yves Senn
- No Changes *
-
Non-string authenticity tokens do not raise NoMethodError when decoding the masked token.
Ville Lautanala
-
Explicitly ignored wildcard verbs when searching for HEAD routes before fallback
Fixes an issue where a mounted rack app at root would intercept the HEAD request causing an incorrect behavior during the fall back to GET requests.
Example:
draw do get '/home' => 'test#index' mount rack_app, at: '/' end head '/home' assert_response :success
In this case, a HEAD request runs through the routes the first time and fails to match anything. Then, it runs through the list with the fallback and matches
get '/home'. The original behavior would match the rack app in the first pass.Terence Sun
-
Preserve default format when generating URLs
Fixes an issue that would cause the format set in default_url_options to be lost when generating URLs with fewer positional arguments than parameters in the route definition.
Backport of #18627
Tekin Suleyman, Dominic Baggott
-
Default headers, removed in controller actions, are no longer reapplied on the test response.
Jonas Baumann
-
Ensure
append_info_to_payloadis called even if an exception is raised.Fixes an issue where when an exception is raised in the request the additonal payload data is not available.
See:
- #14903
- roidrage/lograge#37
Dieter Komendera, Margus Pärt
-
Correctly rely on the response's status code to handle calls to
head.Robin Dupret
-
Using
headmethod returns empty response_body instead of returning a single space " ".The old behavior was added as a workaround for a bug in an early version of Safari, where the HTTP headers are not returned correctly if the response body has a 0-length. This is been fixed since and the workaround is no longer necessary.
Fixes #18253.
Prathamesh Sonpatki
-
Fix how polymorphic routes works with objects that implement
to_model.Travis Grathwell
-
Fixed handling of positional url helper arguments when
format: false.Fixes #17819.
Andrew White, Tatiana Soukiassian
-
Fixed usage of optional scopes in URL helpers.
Alex Robbin
-
Add
ActionController::Parameters#to_unsafe_hto return an unfilteredHashrepresentation of Parameters object. This is now a preferred way to retrieve unfiltered parameters as we will stop inheritingAC::Parametersobject in Rails 5.0.Prem Sichanugrist
-
Restore handling of a bare
Authorizationheader, withouttoken=prefix.Fixes #17108.
Guo Xiang Tan
-
Deprecate use of string keys in URL helpers.
Use symbols instead. Fixes #16958.
Byron Bischoff, Melanie Gilman
-
Deprecate the
only_pathoption on*_pathhelpers.In cases where this option is set to
true, the option is redundant and can be safely removed; otherwise, the corresponding*_urlhelper should be used instead.Fixes #17294.
Dan Olson, Godfrey Chan
-
Improve Journey compliance to RFC 3986.
The scanner in Journey failed to recognize routes that use literals from the sub-delims section of RFC 3986. It's now able to parse those authorized delimiters and route as expected.
Fixes #17212.
Nicolas Cavigneaux
-
Deprecate implicit Array conversion for Response objects. It was added (using
#to_ary) so we could conveniently use implicit splatting:status, headers, body = responseBut it also means
response + responseworks and[response].flattencascades down to the Rack body. Nonsense behavior. Instead, rely on explicit conversion and splatting with#to_a:status, header, body = *responseJeremy Kemper
-
Don't rescue
IPAddr::InvalidAddressError.IPAddr::InvalidAddressErrordoes not exist in Ruby 1.9.3 and fails for JRuby in 1.9 mode.Peter Suschlik
-
Fix bug where the router would ignore any constraints added to redirect routes.
Fixes #16605.
Agis Anastasopoulos
-
Allow
config.action_dispatch.trusted_proxiesto accept an IPAddr object.Example:
# config/environments/production.rb config.action_dispatch.trusted_proxies = IPAddr.new('4.8.15.0/16')Sam Aarons
-
Avoid duplicating routes for HEAD requests.
Instead of duplicating the routes, we will first match the HEAD request to HEAD routes. If no match is found, we will then map the HEAD request to GET routes.
Guo Xiang Tan, Andrew White
-
Requests that hit
ActionDispatch::Staticcan now take advantage of gzipped assets on disk. By default a gzip asset will be served if the client supports gzip and a compressed file is on disk.Richard Schneeman
-
ActionController::Parameterswill stop inheriting fromHashandHashWithIndifferentAccessin the next major release. If you use any method that is not available onActionController::Parametersyou should consider calling#to_hto convert it to aHashfirst before calling that method.Prem Sichanugrist
-
ActionController::Parameters#to_hnow returns aHashwith unpermitted keys removed. This change is to reflect on a security concern where some method performed on anActionController::Parametersmay yield aHashobject which does not maintainpermitted?status. If you would like to get aHashwith all the keys intact, duplicate and mark it as permitted before calling#to_h.params = ActionController::Parameters.new({ name: 'Senjougahara Hitagi', oddity: 'Heavy stone crab' }) params.to_h # => {} unsafe_params = params.dup.permit! unsafe_params.to_h # => {"name"=>"Senjougahara Hitagi", "oddity"=>"Heavy stone crab"} safe_params = params.permit(:name) safe_params.to_h # => {"name"=>"Senjougahara Hitagi"}This change is consider a stopgap as we cannot change the code to stop
ActionController::Parametersto inherit fromHashWithIndifferentAccessin the next minor release.Prem Sichanugrist
-
Deprecated
TagAssertions.Kasper Timm Hansen
-
Use the Active Support JSON encoder for cookie jars using the
:jsonor:hybridserializer. This allows you to serialize custom Ruby objects into cookies by defining the#as_jsonhook on such objects.Fixes #16520.
Godfrey Chan
-
Add
config.action_dispatch.cookies_digestoption for setting custom digest. The default remains the same - 'SHA1'.Łukasz Strzałkowski
-
Move
respond_with(and the class-levelrespond_to) to therespondersgem.José Valim
-
When your templates change, browser caches bust automatically.
New default: the template digest is automatically included in your ETags. When you call
fresh_when @post, the digest forposts/show.html.erbis mixed in so future changes to the HTML will blow HTTP caches for you. This makes it easy to HTTP-cache many more of your actions.If you render a different template, you can now pass the
:templateoption to include its digest instead:fresh_when @post, template: 'widgets/show'Pass
template: falseto skip the lookup. To turn this off entirely, set:config.action_controller.etag_with_template_digest = falseJeremy Kemper
-
Remove deprecated
AbstractController::Helpers::ClassMethods::MissingHelperErrorin favor ofAbstractController::Helpers::MissingHelperError.Yves Senn
-
Fix
assert_templatenot being able to assert that no files were rendered.Guo Xiang Tan
-
Extract source code for the entire exception stack trace for better debugging and diagnosis.
Ryan Dao
-
Allows ActionDispatch::Request::LOCALHOST to match any IPv4 127.0.0.0/8 loopback address.
Earl St Sauver, Sven Riedel
-
Preserve original path in
ShowExceptionsmiddleware by stashing it asenv["action_dispatch.original_path"]ActionDispatch::ShowExceptionsoverwritesPATH_INFOwith the status code for the exception defined inExceptionWrapper, so the path the user was visiting when an exception occurred was not previously available to any custom exceptions_app. The originalPATH_INFOis now stashed inenv["action_dispatch.original_path"].Grey Baker
-
Use
String#bytesizeinstead ofString#sizewhen checking for cookie overflow.Agis Anastasopoulos
-
render nothing: trueor rendering anilbody no longer add a single space to the response body.The old behavior was added as a workaround for a bug in an early version of Safari, where the HTTP headers are not returned correctly if the response body has a 0-length. This is been fixed since and the workaround is no longer necessary.
Use
render body: ' 'if the old behavior is desired.See #14883 for details.
Godfrey Chan
-
Prepend a JS comment to JSONP callbacks. Addresses CVE-2014-4671 ("Rosetta Flash").
Greg Campbell
-
Because URI paths may contain non US-ASCII characters we need to force the encoding of any unescaped URIs to UTF-8 if they are US-ASCII. This essentially replicates the functionality of the monkey patch to URI.parser.unescape in active_support/core_ext/uri.rb.
Fixes #16104.
Karl Entwistle
-
Generate shallow paths for all children of shallow resources.
Fixes #15783.
Seb Jacobs
-
JSONP responses are now rendered with the
text/javascriptcontent type when rendering through arespond_toblock.Fixes #15081.
Lucas Mazza
-
Add
config.action_controller.always_permitted_parametersto configure which parameters are permitted globally. The default value of this configuration is['controller', 'action'].Gary S. Weaver, Rafael Chacon
-
Fix env['PATH_INFO'] missing leading slash when a rack app mounted at '/'.
Fixes #15511.
Larry Lv
-
ActionController::Parameters#require now accepts
falsevalues.Fixes #15685.
Sergio Romano
-
With authorization header
Authorization: Token token=,authenticatenow recognize token as nil, instead of "token".Fixes #14846.
Larry Lv
-
Ensure the controller is always notified as soon as the client disconnects during live streaming, even when the controller is blocked on a write.
Nicholas Jakobsen, Matthew Draper
-
Routes specifying 'to:' must be a string that contains a "#" or a rack application. Use of a symbol should be replaced with
action: symbol. Use of a string without a "#" should be replaced withcontroller: string.Aaron Patterson
-
Fix URL generation with
:trailing_slashsuch that it does not add a trailing slash after.:formatDan Langevin
-
Build full URI as string when processing path in integration tests for performance reasons. One consequence of this is that the leading slash is now required in integration test
processhelpers, whereas previously it could be omitted. The fact that this worked was a unintended consequence of the implementation and was never an intentional feature.Guo Xiang Tan
-
Fix
'Stack level too deep'when renderinghead :okin an action method called 'status' in a controller.Fixes #13905.
Christiaan Van den Poel
-
Add MKCALENDAR HTTP method (RFC 4791).
Sergey Karpesh
-
Instrument fragment cache metrics.
Adds
:controller: and:actionkeys to the instrumentation payload for the*_fragment.action_controllernotifications. This allows tracking e.g. the fragment cache hit rates for each controller action.Daniel Schierbeck
-
Always use the provided port if the protocol is relative.
Fixes #15043.
Guilherme Cavalcanti, Andrew White
-
Moved
params[request_forgery_protection_token]into its own method and improved tests.Fixes #11316.
Tom Kadwill
-
Added verification of route constraints given as a Proc or an object responding to
:matches?. Previously, when given an non-complying object, it would just silently fail to enforce the constraint. It will now raise anArgumentErrorwhen setting up the routes.Xavier Defrang
-
Properly treat the entire IPv6 User Local Address space as private for purposes of remote IP detection. Also handle uppercase private IPv6 addresses.
Fixes #12638.
Caleb Spare
-
Fixed an issue with migrating legacy json cookies.
Previously, the
VerifyAndUpgradeLegacySignedMessageassumes all incoming cookies are marshal-encoded. This is not the case whensecret_tokenis used in conjunction with the:jsonor:hybridserializer.In those case, when upgrading to use
secret_key_base, this would cause aTypeError: incompatible marshal file formatand a 500 error for the user.Fixes #14774.
Godfrey Chan
-
Make URL escaping more consistent:
- Escape '%' characters in URLs - only unescaped data should be passed to URL helpers
- Add an
escape_segmenthelper toRouter::Utilsthat escapes '/' characters - Use
escape_segmentrather thanescape_fragmentin optimized URL generation - Use
escape_segmentrather thanescape_pathin URL generation
For point 4 there are two exceptions. Firstly, when a route uses wildcard segments (e.g.
*foo) then we useescape_pathas the value may contain '/' characters. This means that wildcard routes can't be optimized. Secondly, if a:controllersegment is used in the path then this usesescape_pathas the controller may be namespaced.Fixes #14629, #14636 and #14070.
Andrew White, Edho Arief
-
Add alias
ActionDispatch::Http::UploadedFile#to_iotoActionDispatch::Http::UploadedFile#tempfile.Tim Linquist
-
Returns null type format when format is not know and controller is using
anyformat block.Fixes #14462.
Rafael Mendonça França
-
Improve routing error page with fuzzy matching search.
Winston
-
Only make deeply nested routes shallow when parent is shallow.
Fixes #14684.
Andrew White, James Coglan
-
Append link to bad code to backtrace when exception is
SyntaxError.Boris Kuznetsov
-
Swapped the parameters of assert_equal in
assert_selectso that the proper values were printed correctly.Fixes #14422.
Vishal Lal
-
The method
shallow?returns false if the parent resource is a singleton so we need to check if we're not inside a nested scope before copying the :path and :as options to their shallow equivalents.Fixes #14388.
Andrew White
-
Make logging of CSRF failures optional (but on by default) with the
log_warning_on_csrf_failureconfiguration setting inActionController::RequestForgeryProtection.John Barton
-
Fix URL generation in controller tests with request-dependent
default_url_optionsmethods.Tony Wooster
Please check 4-1-stable for previous changes.