Aaron Patterson
f4174ad429
Array parameters should not contain nil values.
2012-06-10 22:47:42 -05:00
Aaron Patterson
5b83bbfab7
Strip [nil] from parameters hash.
...
Thanks to Ben Murphy for reporting this!
CVE-2012-2660
2012-05-30 15:13:55 -07:00
Andrew White
e98893b189
Don't ignore nil positional arguments for url helpers - fixes #6196 .
2012-05-10 22:07:14 +01:00
Andrew White
7336b33008
Refactor the handling of default_url_options in integration tests
...
This commit improves the handling of default_url_options in integration
tests by making behave closer to how a real application operates.
Specifically the following issues have been addressed:
* Options specified in routes.rb are used (fixes #546 )
* Options specified in controllers are used
* Request parameters are recalled correctly
* Tests can override default_url_options directly
2012-05-10 21:33:31 +01:00
Andrew White
0cfa6b71f2
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:02:08 +01:00
Will Bryant
d625a7ac17
fix the Flash middleware loading the session on every request (very dangerous especially with Rack::Cache), it should only be loaded when the flash method is called
2012-04-30 00:20:17 -07:00
Andrew White
78c181b701
Escape interpolated params when redirecting - fixes #5688
2012-04-29 21:37:03 +01:00
Arun Agrawal
54d3645e93
:subdomain can now be specified with a value of false in url_for,
...
allowing for subdomain(s) removal from the host during link generation.
Closes #4083
cherry-picked from
de942e5534
96aa3bd0ea
2012-04-01 00:16:38 +05:30
José Valim
bef0b354e4
Avoid inspecting the whole route set, closes #1525
2012-03-27 19:57:47 +02:00
Carlos Antonio da Silva
a16aa8c3d2
Return the same session data object when setting session id
...
Make sure to return the same hash object instead of returning a new one.
Returning a new one causes failures on cookie store tests, where it
tests for the 'Set-Cookie' header with the session signature.
This is due to the hash ordering changes on Ruby 1.8.7-p358.
2012-03-26 16:18:20 -03:00
Aaron Patterson
47147a0555
Merge pull request #5456 from brianmario/redirect-sanitization
...
Strip null bytes from Location header
2012-03-15 14:58:49 -07:00
Andrew White
5c18b995c1
Detect optional glob params when adding non-greedy regexp - closes #4817 .
2012-02-26 00:29:43 +00:00
Justin Woodbridge
e6fca559a1
Fix typo in match :to docs
2012-02-25 21:55:11 +05:30
Andrew White
bea34a7729
Simplify regexp
2012-02-17 14:45:09 +00:00
Andrew White
5fcbb94edc
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:16:45 +00:00
Piotr Sarnacki
c2af40b679
Add original_fullpath and original_url methods to Request
2012-01-10 04:53:55 +01:00
José Valim
6d5a27aa6f
Override respond_to? since we are also overriding method_missing.
2012-01-03 20:33:14 +01:00
Aaron Patterson
4371be2125
use Array#join so that file encoding doesn't impact returned string.
...
Fixes #3957
2011-12-12 19:47:25 -08:00
José Valim
39528548b0
Improve cache on route_key lookup.
...
Conflicts:
activemodel/lib/active_model/naming.rb
2011-12-08 20:38:09 +01:00
Uģis Ozols
7f6b1a58ac
what's -> that's
2011-11-26 20:19:20 +05:30
Bradford Folkens
0fdcd5449e
Fixed ' and ' should be ' && '
2011-11-08 07:27:42 -06:00
Bradford Folkens
92955d0053
Fix trouble using :subdomain in development environment when using numeric addresses.
...
Otherwise the following occurs:
TypeError: can't convert nil into String
/Users/bfolkens/dev/bfolkens-rails-core/actionpack/lib/action_dispatch/http/url.rb:75:in host_or_subdomain_and_domain'
/Users/bfolkens/dev/bfolkens-rails-core/actionpack/lib/action_dispatch/http/url.rb:37:in url_for'
/Users/bfolkens/dev/bfolkens-rails-core/actionpack/lib/action_dispatch/routing/url_for.rb:147:in test_subdomain_may_be_accepted_with_numeric_host'
/Users/bfolkens/dev/bfolkens-rails-core/activesupport/lib/active_support/testing/setup_and_teardown.rb:67:in run'
/Users/bfolkens/dev/bfolkens-rails-core/activesupport/lib/active_support/callbacks.rb:426:in send'
/Users/bfolkens/dev/bfolkens-rails-core/activesupport/lib/active_support/callbacks.rb:81:in run'
2011-11-07 23:23:36 -06:00
Alexey Vakhov
740655c497
Fix typo in constraints method documentation
2011-11-05 20:51:32 +05:30
mjy
58b0d507d3
Adds missing closing regex slashes.
2011-10-30 14:52:24 +05:30
José Valim
4cdc31c53a
Add some implementation docs. closes #3298 . closes #2509 .
2011-10-12 09:24:13 +02:00
Bruno Zanchet
4d986c4a10
swallow error when can't unmarshall object from session
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2011-10-12 09:21:42 +02:00
José Valim
f63b1dee65
TestCase should respect the view_assigns API instead of pulling variables on its own.
2011-10-02 11:33:12 +02:00
Santiago Pastorino
3200cd072e
Revert "Make process reuse the env var passed as argument"
...
This reverts commit 0e4748cd41 .
2011-09-24 17:22:29 -03:00
Pawel Pierzchala
d87921318c
Fix named routes modifying arguments
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2011-09-22 17:14:10 +02:00
Andrew Kaspick
05d4d8b9a2
fix assert_select_email to work on non-multipart emails as well as converting the Mail::Body to a string to prevent errors.
2011-09-07 17:15:58 -05:00
Santiago Pastorino
699b83a2e0
Merge pull request #2577 from rails-noob/master
...
Fix double slash at start of paths when mounting an engine at the root.
2011-09-06 13:11:14 -03:00
Arun Agrawal
f397ced82a
stop circular require warnings
2011-09-04 08:41:50 +05:30
Aaron Patterson
af7c9b9cef
CookieJar is enumerable. fixes #2795
2011-09-01 13:37:33 -07:00
Vijay Dev
d3d2ceaf0f
doc fixes
2011-09-01 03:47:13 +05:30
Arun Agrawal
d761ec4864
We actually don't need a reverse_merge! here. dup removed was giving error with nil class.
2011-08-13 08:26:30 +05:30
Santiago Pastorino
d9d78d4165
Merge pull request #2497 from akaspick/url_for_fix
...
When calling url_for with a hash, additional (likely unwanted) values (such as :host) would be returned in the hash
2011-08-11 19:55:48 -03:00
Santiago Pastorino
eff7fddeb2
x_sendfile_header now defaults to nil and production.rb env file doesn't
...
set a particular value for it. This allows servers to set it through
X-Sendfile-Type, read
https://github.com/rack/rack/blob/master/lib/rack/sendfile.rb for more
info. Anyways you can force this value in your production.rb
2011-08-07 13:13:19 -03:00
Vijay Dev
7e494f0bca
document meta method
2011-08-04 16:45:30 -07:00
thedarkone
34c50895b4
Make use of the inherited initializer.
2011-07-28 20:18:54 +02:00
thedarkone
0753d0bd05
There is no need to be destructive with the passed-in options.
...
This fixes a bug that is caused by Resource/SingletonResource mangling resource options when using inline "multi"-resource declarations.
2011-07-28 20:18:45 +02:00
Erik Michaels-Ober
c41ecd7164
Allow a route to have :format => true
...
When format is true, it is mandatory (as opposed to :format => false).
This is currently not possible with resource routes, which automatically
make format optional by default.
2011-07-25 11:46:52 -07:00
Dave Rogers
8a551086ec
Ensure the constraints block is only applied to the correct route
...
addresses issue #1907 - any routes that follow a route with a constraints
block are inheriting the previous route's constraints.
2011-07-25 10:40:40 -07:00
thedarkone
9395e89b72
Make polymorphic_url calls go through application helpers again.
...
This brings back the ability to overwrite/extend url generating methods in application heleprs.
2011-07-25 15:43:36 +02:00
Bradford Folkens
36836f1add
write_cookies! in ActionDispatch::TestRequest won't write nil value when == 'u' on 1.8.7
2011-07-14 13:03:03 -05:00
Damien Mathieu
827e8a5983
provide a more explicit message when using url_for with nil
...
This fixes the problem of having a non-explicit message when the :location option is not provided in respond_with.
2011-07-03 02:13:53 +02:00
José Valim
cb307d1c4a
Add has_key? and key? methods to CookieJar removed in 0ca69ca65f
2011-06-30 08:02:37 -03:00
Damien Mathieu
fa5529366c
all requests are utf-8. Don't use the external encoding.
2011-06-15 13:01:30 +02:00
Damien Mathieu
f6fe174168
encode the uploaded file's name in the default external encoding - Closes #869
2011-06-15 13:01:25 +02:00
ganesh
b3ade0cc05
shallow_path example updated
2011-06-11 01:16:40 +02:00
wycats
63467a4301
Restructure TemplateAssertions-related code to eliminate circular requires.
...
Also, no need to include dependencies in AS::Concerns inside included blocks.
2011-06-04 08:57:56 +05:30