Commit Graph

489 Commits

Author SHA1 Message Date
Greg Ose
67b3fd5cb8 Custom cookie serializer test
Adapted from
b23ffd0dac/actionpack/test/dispatch/cookies_test.rb (L382-L413)
2014-09-23 16:21:49 +10:00
Charlie Somerville
94331729a1 rename SprocketsApp here to RackApp to not confuse me when grepping 2014-09-15 14:35:17 +10:00
Santiago Pastorino
11fd052aa8 Regenerate sid when sbdy tries to fixate the session
Fixed broken test.

Thanks Stephen Richards for reporting.
2014-08-04 11:36:43 -03:00
Michael Koziarski
d5a4095ca5 Deep Munge the parameters for GET and POST
The previous implementation of this functionality could be accidentally
subverted by instantiating a raw Rack::Request before the first Rails::Request
was constructed.

Fixes CVE-2013-6417

Conflicts:
	actionpack/lib/action_dispatch/http/request.rb
2013-12-02 14:14:35 -08:00
Brian Hahn
03ac291526 pass the extra params to the rack test environment so that routes with block constraints have access 2013-09-06 11:08:41 -07:00
Alexey Chernenkov
0f5ba6e124 Fix assert_redirected_to does not show user-supplied message.
Issue: when `assert_redirected_to` fails due to the response redirect not
matching the expected redirect the user-supplied message (second parameter)
is not shown. This message is only shown if the response is not a redirect.
2013-07-18 10:54:36 +06:00
Andrew White
b0c65978ab Use old style hash syntax for 3-2-stable 2013-06-25 12:24:06 +01:00
Andrew White
622e4ab424 Fix shorthand routes where controller and action are in the scope
Merge `:action` from routing scope and assign endpoint if both `:controller`
and `:action` are present. The endpoint assignment only occurs if there is
no `:to` present in the options hash so should only affect routes using the
shorthand syntax (i.e. endpoint is inferred from the the path).

Fixes #9856

Backport of 37b4276
2013-06-25 11:00:19 +01:00
maximerety
d0f22a99f9 Backport fixes about #7774 to 3-2-stable
Fix ActionDispatch::Request#formats when HTTP_ACCEPT header is an empty
string.
2013-03-05 12:53:10 +01:00
Carlos Antonio da Silva
0c1558d32f Use 1.8 hash style 2013-02-22 14:42:35 -03:00
Yves Senn
a72dab0b6a determine the match shorthand target early.
Backport #9361.
Closes #7554.

This patch determines the `controller#action` directly
in the `match` method when the shorthand syntax is used.
this prevents problems with namespaces and scopes.
2013-02-22 09:04:04 +01:00
Andrew White
431759614d Duplicate possible frozen string from route
Ruby 1.9 freezes Hash string keys by default so where a route is
defined like this:

get 'search' => 'search'

then the Mapper will derive the action from the key. This blows up
later when the action is added to the parameters hash and the
encoding is forced.

Closes #3429
2013-01-21 17:20:51 +00:00
Aditya Sanghi
5f3b40e824 fixes #8631 local inflections from interfereing with HTTP_METHOD_LOOKUP dispatch logic 2013-01-16 15:59:17 +05:30
Rafael Mendonça França
9669aa7cf1 Merge pull request #8914 from nilbus/fix-header-bloat
Remove header bloat introduced by BestStandardsSupport middleware
Conflicts:
	actionpack/CHANGELOG.md
2013-01-15 23:29:45 -02:00
Dylan Smith
7003b36ecf Fix JSON params parsing regression for non-object JSON content.
Backports #8855.
2013-01-11 00:14:49 -05:00
Aaron Patterson
48810a52df Merge branch '3-2-sec' into 3-2-secmerge
* 3-2-sec:
  bumping version
  CVE-2013-0156: Safe XML params parsing. Doesn't allow symbols or yaml.
  * Strip nils from collections on JSON and XML posts. [CVE-2013-0155] * dealing with empty hashes. Thanks Damien Mathieu
  Avoid Rack security warning no secret provided

Conflicts:
	actionpack/CHANGELOG.md
	activerecord/CHANGELOG.md
	activesupport/CHANGELOG.md
2013-01-08 11:37:48 -08:00
Aaron Patterson
d5cd97baa4 * Strip nils from collections on JSON and XML posts. [CVE-2013-0155] * dealing with empty hashes. Thanks Damien Mathieu 2013-01-08 09:08:26 -08:00
Andrew White
9c581d3811 Don't use 1.9 hash syntax on 3-2-stable 2012-12-14 14:52:24 +00:00
Andrew White
6ab1a9540b Clear url helper methods when routes are reloaded
Clear url helper methods when routes are reloaded by removing the
methods explicitly rather than just clearing the module because it
didn't work properly and could be the source of a memory leak.

Closes #8488.
2012-12-14 13:50:14 +00:00
Rafael Mendonça França
6fbee4fc53 Merge pull request #8490 from mattv/fix_request_raw_post
Fix rewinding in ActionDispatch::Request#raw_post
Conflicts:
	actionpack/CHANGELOG.md
2012-12-11 21:01:49 -03:00
Andrew White
0c7a236f30 Refactor Generator class to not rely on in-place editing the controller 2012-11-16 21:44:24 -02:00
Nikita Beloglazov
09c4dfa06b Fix bug when url_for changes controller. 2012-11-16 21:44:18 -02:00
Carlos Antonio da Silva
90a5ec758d Merge pull request #8093 from nikitug/keep_app_x_ua_compatible
Fix #8086 (BestStandardsSupport rewrites app X-UA-Compatible header)

Conflicts:
	actionpack/CHANGELOG.md
2012-11-08 20:50:11 -02:00
Yves Senn
d12e753409 backport, handle trailing slash with engines
this is a backport of #8115 to fix #7842
2012-11-08 21:26:26 +01:00
Rafael Mendonça França
190dddf231 Add test to avoid regression of 4a86362 2012-11-02 18:10:46 -02:00
Rafael Mendonça França
4a8636264d Revert "Merge pull request #7668 from Draiken/fix_issue_6497"
This reverts commit 61d5d2d8a9.

Conflicts:
	actionpack/CHANGELOG.md

REASON: This added a backward incompatible change.
2012-11-02 14:33:20 -02:00
Rafael Mendonça França
3b5bc8d71b Merge pull request #7789 from senny/7777_resource_functions_modify_options
resource and resources do no longer modify passed options
2012-10-01 12:53:53 -03:00
Rafael Mendonça França
628e38d789 Since File instance doesn't respond to #open use a double to test the
behavior added at c53e5def08
2012-09-30 22:59:23 -03:00
Rafael Mendonça França
61d5d2d8a9 Merge pull request #7668 from Draiken/fix_issue_6497
Removing to_shorthand to fix #6497
Conflicts:
	actionpack/CHANGELOG.md
2012-09-19 10:10:00 -03:00
Marc-Andre Lafortune
728e925735 Fix bug when Rails.application is defined but is nil. See #881 2012-08-28 21:06:58 -07:00
brainopia
ca07bc0de7 Test actual content of permanent cookie 2012-08-10 10:00:27 +04:00
brainopia
bbe634e72c Dont stream back cookie value if it was set to the same value 2012-08-10 10:00:04 +04:00
Andrew White
71d274dbbb Add support for optional root segments containing slashes
Optional segments with a root scope need to have the leading slash
outside of the parentheses, otherwise the generated url will be empty.
However if the route has non-optional elements then the leading slash
needs to remain inside the parentheses otherwise the generated url
will have two leading slashes, e.g:

Blog::Application.routes.draw do
  get '/(:category)', :to => 'posts#index', :as => :root
  get '/(:category)/author/:name', :to => 'posts#author', :as => :author
end

$ rake routes
  root GET /(:category)(.:format)              posts#index
author GET (/:category)/author/:name(.:format) posts#author

This change adds support for optional segments that contain a slash,
allowing support for urls like /page/2 for the root path, e.g:

Blog::Application.routes.draw do
  get '/(page/:page)', :to => 'posts#index', :as => :root
end

$ rake routes
root GET /(page/:page)(.:format) posts#index

Fixes #7073
(cherry picked from commit d8745decaf59aad32aa2f09abdba99b8d0e48b31)
2012-07-17 20:09:28 +01:00
Aaron Patterson
38edea0c91 Array parameters should not contain nil values. 2012-06-11 14:00:05 -07:00
Aaron Patterson
dff6db1884 Strip [nil] from parameters hash.
Thanks to Ben Murphy for reporting this!

CVE-2012-2660
2012-05-30 15:13:42 -07:00
Andrew White
66e338aa98 Don't ignore nil positional arguments for url helpers - fixes #6196. 2012-05-10 22:13:04 +01:00
Andrew White
7c7fb3a862 Reset the request parameters after a constraints check
A callable object passed as a constraint for a route may access the request
parameters as part of its check. This causes the combined parameters hash
to be cached in the environment hash. If the constraint fails then any subsequent
access of the request parameters will be against that stale hash.

To fix this we delete the cache after every call to `matches?`. This may have a
negative performance impact if the contraint wraps a large number of routes as the
parameters hash is built by merging GET, POST and path parameters.

Fixes #2510.
(cherry picked from commit 56030506563352944fed12a6bb4793bb2462094b)
2012-05-03 00:00:19 +01:00
Andrew White
6cad407623 Restore interpolation of path option in redirect routes 2012-04-29 22:51:04 +01:00
Andrew White
b608cdd64c Escape interpolated params when redirecting - fixes #5688 2012-04-29 21:19:18 +01:00
Rafael Mendonça França
27fc6ec95e Fix the redirect when it receive blocks with arity of 1.
Closes #5677
2012-03-31 17:59:21 +02:00
Michael Reinsch
55cac81bc5 fix ArgumentError being raised in case of invalid byte sequences 2012-03-08 20:44:28 +09:00
kennyj
39d4617033 Fix some warnings on 3-2-stable 2012-02-21 12:43:41 +09:00
Andrew White
41c182c368 Remove fixture files with Windows incompatible filenames
Windows doesn't allow `\ / : * ? " < > |` in filenames so create
the fixture files at runtime and ignore the incompatible ones when
running on Windows.
2012-02-20 04:57:49 +00:00
Andrew White
86d3bc37b8 Fix ActionDispatch::Static to serve files with unencoded PCHAR
RFC 3986[1] allows sub-delim characters in path segments unencoded,
however Rack::File requires them to be encoded so we use URI's
unescape method to leave them alone and then escape them again.

Also since the path gets passed to Dir[] we need to escape any glob
characters in the path.

[1]: http://www.ietf.org/rfc/rfc3986.txt
2012-02-17 14:08:13 +00:00
Aditya Sanghi
dffd85a192 backporting #4918 to 3.2 stable; adding extra test for accept header given by googlebot 2012-02-17 15:10:52 +05:30
Aaron Patterson
73fcbaaa78 Merge pull request #4988 from kennyj/fix_4720-3
Fix GH #4720. Routing problem with nested namespace and already camelized controller option.
2012-02-10 10:01:06 -08:00
José Valim
ab44418881 Merge pull request #4908 from kennyj/fix_3864
Fix url_for method's behavior. GH #3684.
2012-02-06 17:03:42 +01:00
José Valim
9cb0e12e46 Merge pull request #4879 from kennyj/fix_4873
Fix GH #4873. Allow swapping same class middleware.
2012-02-04 15:32:40 +01:00
Paul McMahon
22980e0c17 Test for unicode path support
This is currently broken due to a bug in journey.
2012-01-25 15:27:33 +09:00
Carlos Antonio da Silva
e5e87041ce Deprecate AC::UnknownError and AC::DoubleRenderError
Use the constants AbstractController::ActionNotFound and
AbstractController::DoubleRenderError respectively instead.
2012-01-17 18:07:08 -02:00