Commit Graph

395 Commits

Author SHA1 Message Date
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
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
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
Andrew White
a7862366ff 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:59:59 +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
040b7946d2 adding tests for #4029 2011-12-20 19:52:33 -07: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
86a5271e74 Provide failing test case for #3298 #2509 2011-10-12 09:21:33 +02:00
José Valim
f23f5ec6cd Fix wrong identation and remove extra spaces. 2011-10-12 09:01:00 +02: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
Arun Agrawal
1ca38c6681 Warnings removed unused variables. Please don't add them 2011-09-10 13:03:46 +05:30
Aaron Patterson
af7c9b9cef CookieJar is enumerable. fixes #2795 2011-09-01 13:37:33 -07:00
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
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
Santiago Pastorino
9441c945eb Fix indentation 2011-07-14 15:25:07 -03: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
José Valim
cb307d1c4a Add has_key? and key? methods to CookieJar removed in 0ca69ca65f 2011-06-30 08:02:37 -03:00
Lukáš Konarovský
055a88d345 Use assert_equal instead of assert in uploaded file test. 2011-06-15 13:03:07 +02: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
Jon Leighton
5a6927ec1e Replace references to ActiveSupport::SecureRandom with just SecureRandom, and require 'securerandom' from the stdlib when active support is required. 2011-05-23 20:24:44 +01:00
steve
2d50887b24 adding test 2011-05-19 10:33:18 -04:00
José Valim
324f1451b0 Dump and load rack-cache stuff. 2011-05-17 17:33:17 -04:00
José Valim
3aa8f348ef Fix previous commit by allowing a proc to be given as response_body. This is deprecated and is going to be removed in future releases. 2011-05-10 16:53:57 +02:00
José Valim
4d5ce4738b Merge pull request #446 from danielstutzman/response_body_is_proc
New test: setting response_body to a Proc should be supported.
2011-05-10 07:38:43 -07:00
Daniel Stutzman
2ab42dcc3e New test: setting response_body to a Proc should be supported. 2011-05-07 16:35:56 -06:00
David Lee
17a91a6ef9 Logs should show overridden method; Issue 426 2011-05-07 03:04:26 -07:00
José Valim
0e5adbceb7 Don't pluralize, camelize. 2011-05-06 17:00:59 +02:00
José Valim
afc3ccf74c Fix renew feature on cookies. 2011-05-04 20:12:27 +02:00
José Valim
6b79463ed8 Fix .subdomain regression. 2011-05-04 20:05:35 +02:00
Matias Korhonen
49b825e502 Sets the HTTP charset parameter for rescue response. 2011-05-03 16:30:59 +03:00
José Valim
e1c1685016 Static middleware accepts cache control. 2011-05-03 12:32:14 +02:00
José Valim
ed3e667415 Multipart is now fixed in Rack. 2011-05-03 12:10:11 +02:00
José Valim
11db2ae4e0 Koz asked to test something crazy. 2011-05-02 23:45:24 +02:00
José Valim
73c94ed97a Add ignore_accept_header config to AD::Request. 2011-05-02 23:38:57 +02:00
Prem Sichanugrist
8c9e4d5202 Add ActionController::ParamsWrapper to wrap parameters into a nested hash
This will allow us to do a rootless JSON/XML request to server.
2011-05-03 03:21:43 +07:00
Piotr Sarnacki
f545a5081e Fix tests, main_app mounted helper must be defined explicitly now. 2011-04-25 17:57:52 +02:00
José Valim
a66c917235 Do not inherit from Rack::Response, remove a shit-ton of unused code. 2011-04-19 11:54:12 +02:00
José Valim
d5ad92ced1 Make static faster as we don't have to serve multiple paths anymore. 2011-04-15 20:09:39 +02:00
Prem Sichanugrist
733bfa63f5 Remove #among? from Active Support
After a long list of discussion about the performance problem from using varargs and the reason that we can't find a great pair for it, it would be best to remove support for it for now.

It will come back if we can find a good pair for it. For now, Bon Voyage, `#among?`.
2011-04-13 20:25:28 +08:00
David Heinemeier Hansson
d1575ae1b9 Change Object#either? to Object#among? -- thanks to @jamesarosen for the suggestion! 2011-04-12 00:23:07 +02:00
Prem Sichanugrist
d6edaeeaf8 Fix failing test case on master
It turned out that I overlook at some replacements ..
2011-04-10 22:40:21 -07:00
Prem Sichanugrist
a9f3c9da01 Using Object#in? and Object#either? in various places
There're a lot of places in Rails source code which make a lot of sense to switching to Object#in? or Object#either? instead of using [].include?.
2011-04-11 03:17:09 +08:00