Commit Graph

281 Commits

Author SHA1 Message Date
José Valim
2ab2077235 Fix failing cascade exception. 2011-12-03 11:38:25 +01:00
José Valim
76a3ec7f6e Try to play nice with plugins doing monkey patches. 2011-12-02 09:57:43 +01:00
José Valim
f9edc079e0 Split and improve show and debug exceptions middlewares. 2011-12-01 21:15:42 +01:00
José Valim
750bb5c865 Split ShowExceptions responsibilities in two middlewares. 2011-12-01 20:46:18 +01:00
José Valim
956ecff833 Add a deprecation to old show exceptions API (even though it was not public). 2011-12-01 20:16:12 +01:00
José Valim
0b677b18ff Add an ExceptionWrapper that wraps an exception and provide convenience helpers. 2011-12-01 20:02:00 +01:00
José Valim
b4359bc723 Allow rescue responses to be configured through a railtie. 2011-12-01 19:21:35 +01:00
lest
fe7d4f09ef put backtrace_cleaner to env 2011-11-28 19:25:37 +03:00
lest
cd9d28d6fd middlewares should use logger from env 2011-11-25 13:09:46 +03:00
lest
98a1717e7c configuration option to always write cookie 2011-11-23 23:50:04 +03:00
kennyj
ea70e027b6 Remove unreachable code, and add additional testcases. 2011-11-24 00:25:34 +09:00
lest
3a1d51959b deprecation warning, changelog entry 2011-11-22 17:36:58 +03:00
lest
a9e8cf78fd add ActionController::Metal#show_detailed_exceptions? 2011-11-22 11:38:24 +03:00
Arun Agrawal
c3ae1d2aec It should be @calculated_ip not @calculate_ip
We are using @calculated_ip. 
@calculate_ip is no where used
2011-11-17 12:50:19 +05:30
Aaron Patterson
e367142255 Initialize our instance variables. 2011-11-16 16:55:11 -08:00
Aaron Patterson
70f9b74a49 Merge pull request #3649 from indirect/remote_ip
Fixes for Request#remote_ip (no middleware, all proxies)
2011-11-16 16:44:09 -08:00
Jon Leighton
272f2b778f Merge pull request #3500 from olivierlacan/error-whitespace
CSS fix to prevent error output from being breaking out of body element.
2011-11-16 15:26:31 -08:00
Andre Arko
5621abd569 🤦 Request#remote_ip has to work without the middleware 2011-11-16 12:54:18 -10:00
Andre Arko
f05ccf805a Revert "Revert "Merge pull request #3640 from indirect/remote_ip""
This reverts commit 8d1a2b3ecd, because I have fixed the issues this commit caused in the next commit.
2011-11-16 12:53:43 -10:00
Jon Leighton
8d1a2b3ecd Revert "Merge pull request #3640 from indirect/remote_ip"
This reverts commit 6491aadc52, reversing
changes made to 83bf0b626c.

See https://github.com/rails/rails/pull/3640#issuecomment-2752761 for
explanation.
2011-11-15 22:47:18 +00:00
Andre Arko
d743954792 GetIp#to_s should never return nil. That's icky. 2011-11-14 16:43:21 -10:00
Andre Arko
cda1a5d5fe memoize the relatively expensive remote IP code 2011-11-14 11:20:57 -10:00
Andre Arko
00a0a4ddeb cleaner names 2011-11-14 11:20:20 -10:00
Andre Arko
9c4532bf74 remove ignored flag, fixes warnings 2011-11-13 10:22:12 -10:00
Andre Arko
2d063c6269 turns out the tests expect remote_addrs.first 2011-11-13 10:20:55 -10:00
Andre Arko
2189bff732 correctly raise IpSpoofAttackError message 2011-11-13 10:20:29 -10:00
Andre Arko
317f4e2236 defer calculating the remote IP until requested 2011-11-12 00:45:31 -10:00
Andre Arko
9432163c60 refactor RemoteIp middleware
- return the last forwarded IP before REMOTE_ADDR to handle proxies
- remove completely superfluous RemoteIpGetter class
- remove duplication of trusted proxies regexp
- remove unused constant from Request
- move comments from Request to where they are actually relevant
- edit comments for clarity of purpose

The original code (confusingly) tried to return REMOTE_ADDR both at the beginning and the end of the chain of options. Since REMOTE_ADDR is _always_ set, this is kind of silly. This change leaves REMOTE_ADDR as the last option, so that proxied requests will be assigned the correct remote IP address.
2011-11-11 21:25:08 -10:00
Olivier Lacan
a50f659e08 CSS fix to prevent error output from being breaking out of body element.
Using the white-space: pre-wrap adds extra line breaks to prevent the text from breaking out of the element's box. In this case single line output can be extremely long, breaking out the <body> element.

See for reference: http://www.quirksmode.org/css/whitespace.html

Before: http://link.olivierlacan.com/BVU4
After: http://link.olivierlacan.com/BUfM
2011-11-03 10:01:32 -04:00
Brian Durand
2b04c2f66e Add ActionDispatch::Session::CacheStore as a generic way of storing sessions in a cache. 2011-10-21 13:13:29 -05:00
Marc Bowes
951a325c99 Remove the unneeded \d when sanitizing X-Request-Id. 2011-10-20 10:00:42 +03:00
José Valim
4ef7453694 Load object/blank and make use of presence. 2011-10-19 22:10:43 +02:00
José Valim
f1fecd9b4e Make tests run on 1.8.x, add integration setup. 2011-10-19 22:09:36 +02:00
David Heinemeier Hansson
ada78066fd Blah, SecureRandom#uuid is not supported in 1.8.7 -- cant wait for Rails 4.0 to drop compatibility with 1.8.x 2011-10-19 14:45:42 -05:00
José Valim
1b50207ed3 Require missing string access dependency. 2011-10-19 22:17:54 +03:00
José Valim
ddbb2cae31 Require securerandom as it is the proper dependency. 2011-10-19 22:15:25 +03:00
David Heinemeier Hansson
afde6fdd5e Added X-Request-Id tracking and TaggedLogging to easily log that and other production concerns 2011-10-19 12:59:33 -05:00
Alexey Vakhov
bed5825f77 Remove superfluous assignment in cookies 2011-10-18 22:57:55 +04:00
José Valim
2cb2ca68b1 Add some implementation docs. closes #3298. closes #2509. 2011-10-12 09:29:40 +02:00
José Valim
43d27e9105 Deprecate passing the template handler in the template name.
For example, calling hello.erb is now deprecated. Since Rails 3.0
passing the handler had no effect whatsover. This commit simply
deprecates such cases so we can clean up the code in later releases.
2011-09-22 15:37:38 +02:00
Aaron Patterson
fdd619e9a7 CookieJar is enumerable. fixes #2795 2011-09-01 13:37:14 -07:00
Daniel Schierbeck
a720243961 Split long string into multiple shorter ones
This makes the code more readable.
2011-08-29 04:15:15 +03:00
Vishnu Atrai
525fd3ac86 TODO fix explicitly loading exceptations, autoload removed 2011-07-11 13:14:02 +05:30
José Valim
f34f0b7e08 Add has_key? and key? methods to CookieJar removed in 0ca69ca65f 2011-06-30 08:01:53 -03:00
Aaron Patterson
1d43409d32 Revert "Delegate to @flashes with 'delegate' instead of manually."
This reverts commit 701e8554a8.
2011-06-29 13:52:44 -07:00
Ben Orenstein
701e8554a8 Delegate to @flashes with 'delegate' instead of manually. 2011-06-29 15:16:57 -04:00
Santiago Pastorino
1d3618a9b4 remove warning: assigned but unused variable 2011-06-08 00:26:09 -03:00
Andrew White
e864ff7259 Add backward compatibility for testing cookies
This commit restores the ability to assign cookies for testing via
@request.env['HTTP_COOKIE'] and @request.cookies, e.g:

    @request.env['HTTP_COOKIE'] = 'user_name=david'
    get :index
    assert_equal 'david', cookies[:user_name]

and

    @request.cookies[:user_name] = 'david'
    get :index
    assert_equal 'david', cookies[:user_name]

Assigning via cookies[] is the preferred method and will take precedence
over the other two methods. This is so that cookies set in controller
actions have precedence and are carried over between calls to get, post, etc.
2011-06-05 12:34:27 +01:00
Andrew White
0a9270417c Ensure cookie keys are strings 2011-06-05 12:03:31 +01:00
Andrew White
d4658d86fe Refactor ActionController::TestCase cookies
Assigning cookies for test cases should now use cookies[], e.g:

  cookies[:email] = 'user@example.com'
  get :index
  assert_equal 'user@example.com', cookies[:email]

To clear the cookies, use clear, e.g:

  cookies.clear
  get :index
  assert_nil cookies[:email]

We now no longer write out HTTP_COOKIE and the cookie jar is
persistent between requests so if you need to manipulate the environment
for your test you need to do it before the cookie jar is created.
2011-06-04 07:09:11 +01:00