Commit Graph

70 Commits

Author SHA1 Message Date
Joshua Peek
31ce92f7b5 Use autoload instead of explicit requires for ActionController 2008-11-23 16:35:47 -06:00
Jeremy Kemper
eda9f49d57 Ruby 1.9 compat: CGI switched back to Tempfile 2008-11-08 22:43:29 -05:00
Jeremy Kemper
c82e8e1f48 Move controller assertions from base TestCase to AC:: and AV::TestCase 2008-11-07 15:42:34 -05:00
Michael S. Klishin
e42a235dd1 Request#remote_ip handles the uncommon case that REMOTE_ADDR is a comma-separated list.
[#523 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-27 23:03:11 -07:00
Joshua Peek
894f9ccc53 Use RackRequest as a mock instead of StubCGI into RequestTest 2008-08-17 19:04:01 -05:00
Jeremy Kemper
ba2d61dd81 Update tests for request memoization 2008-08-08 02:31:12 -07:00
Joshua Peek
a87462afcb AbstractRequest.relative_url_root is no longer automatically configured by a HTTP header. It can now be set in your configuration environment with config.action_controller.relative_url_root 2008-07-24 13:41:51 -05:00
Michael Koziarski
2f4aaed7b3 Disable the Accept header by default
The accept header is poorly implemented by browsers and causes strange errors when used on public sites where crawlers make requests too.  You should use formatted urls (e.g. /people/1.xml) to support API clients. Alternatively to re-enable it you need to set:

config.action_controller.use_accept_header = true

A special case remains for ajax requests which will have a javascript format for the base resource (/people/1) if the X-Requested-With header is present.  This lets ajax pages still use format.js despite there being no params[:format]
2008-07-07 07:31:49 +02:00
Mike Subelsky
8f640c381d Added application/jsonrequest as a synonym for application/json
[#536 state:resolved]
2008-07-02 11:39:42 -07:00
David Heinemeier Hansson
edfa195e2a Fixed Request#remote_ip to only raise hell if the HTTP_CLIENT_IP and HTTP_X_FORWARDED_FOR doesnt match (not just if theyre both present) [Mark Imbriaco, Bradford Folkens] 2008-06-03 18:11:47 -05:00
Rick Olson
4d594cffcf Automatically parse posted JSON content for Mime::JSON requests. [rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9242 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-08 05:05:54 +00:00
Jeremy Kemper
30fa377f33 Ruby 1.9 compat: encoding and multibyte test fixes
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9194 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-01 07:39:04 +00:00
Jeremy Kemper
a61b63d420 Avoid remote_ip spoofing
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9124 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-28 21:38:01 +00:00
David Heinemeier Hansson
388e5d3fac Fixed that ActionController::Base#read_multipart would fail if boundary was exactly 10240 bytes (closes #10886) [ariejan]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9113 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-28 19:55:31 +00:00
Rick Olson
1e0ac3a673 Fix more obscure nested parameter hash parsing bug. Closes #10797 [thomas.lee]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9020 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-13 03:22:25 +00:00
Rick Olson
3a17ea9031 Fix nested parameter hash parsing bug. #10797 [thomas.lee]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9010 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-11 07:46:39 +00:00
Rick Olson
8e6638afa4 Fix bug with setting Request#format= after the getter has cached the value. Closes #10889 [cch1]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8811 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-07 16:46:50 +00:00
Jeremy Kemper
9d755f1983 require abstract_unit directly since test is in load path
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8564 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-05 13:32:06 +00:00
Jeremy Kemper
41c82e66c1 Ruby 1.9 compat: file uploads. References #1689 [Frederick Cheung]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8492 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-12-27 11:17:53 +00:00
Jeremy Kemper
f91acf0258 Ruby 1.9 compat: move from the deprecated Base64 module to ActiveSupport::Base64. Closes #10554.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8433 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-12-18 21:14:07 +00:00
David Heinemeier Hansson
26e10218bc Added OPTIONS to list of default accepted HTTP methods (closes #10449) [holoway]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8425 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-12-17 00:06:24 +00:00
Jeremy Kemper
f85089aabb Fixes for standalone tests
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8406 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-12-15 02:29:04 +00:00
Jeremy Kemper
db885e81b9 Ignore illegal seeks on body rewind. Catches CGI errors depending on your httpd. Closes #10404 [Curtis Hawthorne]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8327 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-12-07 04:20:20 +00:00
Rick Olson
0a9bc591e7 Raise UnknownHttpMethod exception for unknown HTTP methods. Closes #10303 [tarmo]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8235 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-11-29 02:08:51 +00:00
Michael Koziarski
6d0e5eaf06 memoize host with port and refactor the tests which depend on it changing
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8164 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-11-17 05:41:47 +00:00
David Heinemeier Hansson
31e2a2d9bb Fixed handling of non-domain hosts (closes #9479) [purp]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8108 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-11-07 14:57:51 +00:00
Jeremy Kemper
82314608b5 Factor Integration::Runner behavior out of IntegrationTest. Introduce Session#request_count which counts processed requests.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8064 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-11-01 07:59:24 +00:00
Jeremy Kemper
79670fb975 request.parameters doesn't overwrite request.request_parameters. Closes #9949 [nullstyle]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7992 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-22 21:10:56 +00:00
Jeremy Kemper
52ca5dad1e Use StringIO and Tempfile subclasses instead of defining singleton methods on each multipart field.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7759 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-06 11:40:13 +00:00
Jeremy Kemper
3405fb3dea Rewind stdin if possible after multipart parsing.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7758 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-06 09:39:31 +00:00
Michael Koziarski
fe31f0e066 Add a user_agent to TestRequest
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7416 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-09-07 03:45:54 +00:00
David Heinemeier Hansson
937a7abe45 Fixed that file.content_type for uploaded files would include a trailing \r #9053 [bgreenlee]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7212 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-07-24 01:20:18 +00:00
Jeremy Kemper
a72fe4ea45 Give the legacy X-POST_DATA_FORMAT header greater precedence during params parsing for backward compatibility.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7126 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-06-26 01:19:18 +00:00
Jeremy Kemper
979c22444d Tolerate missing content type on multipart file uploads. Fix for Safari 3.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7005 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-06-12 07:44:23 +00:00
Jeremy Kemper
e5b3d4b3b5 request.remote_ip understands X-Forwarded-For addresses with nonstandard whitespace. Closes #7386.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6877 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-05-28 00:10:13 +00:00
Jeremy Kemper
06f325f478 Add multipart request parsing test with bracketed parameter key. References #8449.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6831 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-05-24 23:37:37 +00:00
Jeremy Kemper
4bd3e3aa1b Set RAW_POST_DATA when request parameters are parsed.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6823 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-05-23 19:09:37 +00:00
Jeremy Kemper
d2ed32d592 Parse url-encoded and multipart requests ourselves instead of delegating to CGI.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6764 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-05-18 06:24:50 +00:00
Jeremy Kemper
f73e1c2ec0 Move request parameter parsing from CGI to AbstractRequest.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6742 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-05-15 22:10:03 +00:00
Rick Olson
6351e0a541 The default respond_to blocks don't set a specific extension anymore, so that both 'show.rjs' and 'show.js.rjs' will work. [Rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6517 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-04-12 20:25:32 +00:00
Tobias Lütke
e52c28a425 Ignore odd charset declaration in CONTENT_TYPE header which would throw off mime type lookup.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6340 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-03-05 18:24:17 +00:00
Rick Olson
dd6826eba3 Recognize the .txt extension as Mime::TEXT [Rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5912 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-01-12 20:54:04 +00:00
Jeremy Kemper
fe736a54f9 Set request.env['REQUEST_URI'] when absent.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5895 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-01-12 07:01:39 +00:00
David Heinemeier Hansson
7611fa6d46 Added Request#format to return the format used for the request as a mime type. If no format is specified, the first Request#accepts type is used. This means you can stop using respond_to for anything else than responses [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5664 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-12-02 23:07:04 +00:00
David Heinemeier Hansson
efd0bdd9ea * Added GET-masquarading for HEAD, so request.method will return :get even for HEADs. This will help anyone relying on case request.method to automatically work with HEAD and map.resources will also allow HEADs to all GET actions. Rails automatically throws away the response content in a reply to HEAD, so you dont even need to worry about that. If you, for whatever reason, still need to distinguish between GET and HEAD in some edge case, you can use Request#head? and even Request.headers["REQUEST_METHOD"] for get the "real" answer. Closes #6694 [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5621 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-23 23:24:47 +00:00
Jamis Buck
02dc646d55 Fix relative URL root matching problems
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5272 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-10-09 19:14:11 +00:00
Rick Olson
58b996f9b0 Restrict Request Method hacking with ?_method to POST requests. [Rick Olson]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4644 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-08-01 03:02:31 +00:00
Nicholas Seckar
240213177e Add ability for relative_url_root to be specified via an environment variable RAILS_RELATIVE_URL_ROOT. Closes #4243.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3931 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-03-18 16:45:40 +00:00
David Heinemeier Hansson
010e999092 Fixed that SSL would not correctly be detected when running lighttpd/fcgi behind lighttpd w/mod_proxy (closes #3548) [stephen_purcell@yahoo.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3467 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-01-23 05:32:59 +00:00
Jeremy Kemper
c140e80fc4 More robust relative url root discovery for SCGI compatibility. This solves the 'SCGI routes problem' -- you no longer need to prefix all your routes with the name of the SCGI mountpoint. References #3070.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3237 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-12-08 04:40:24 +00:00