Commit Graph

5479 Commits

Author SHA1 Message Date
Rafael Mendonça França
d282125a18 Remove deprecate *_path helpers in email views 2015-01-04 11:58:42 -03:00
Rafael Mendonça França
1f3b0a8609 Remove deprecated support to define routes with :to option that
doesn't contain `#`
2015-01-04 11:58:41 -03:00
Rafael Mendonça França
4b19d5b7bc Remove deprecated ActionDispatch::Response#to_ary 2015-01-04 11:58:41 -03:00
Rafael Mendonça França
e4cfd353a4 Remove deprecated option use_route in controller tests 2015-01-04 11:58:41 -03:00
Rafael Mendonça França
3456d543eb Merge pull request #10380 from JonRowe/test_all_domain_2_letter_tld
Assert that 2 letter tlds with 3 letter domain names work when option specified.
2015-01-02 21:27:38 -03:00
Rafael Mendonça França
2d743b528c Merge pull request #17978 from kommen/fixed-pr-14903
Ensure append_info_to_payload is called even if an exception is raised.

Conflicts:
	actionpack/CHANGELOG.md
2015-01-02 14:16:15 -03:00
brainopia
95333e1317 Integration requests should work in contexts without setup and teardown 2015-01-02 16:52:32 +03:00
Robin Dupret
7ef7f1cc15 Correctly use the response's status code calling head
Commit 20fece1 introduced the `_status_code` method to fix calls to
`head :ok`. This method has been added on both ActionController::Metal
and ActionDispatch::Response.

As for the latter, this method is just equivalent to the `response_code`
one so commit aefec3c removed it from the `Reponse` object so call to
the `_status_code` method on an ActionController::Base instance would be
handled by the `Metal` class (which `Base` inherits from) but the status
code is not updated according to the response at this level.

The fix is to actually rely on `response_code` for ActionController::Base
instances but this method doesn't exist for bare Metal controllers so we
need to define it.
2014-12-31 16:37:35 +01:00
Prathamesh Sonpatki
75757c5c3b Remove single space response body for head request
- The single space response was added due to a bug in safari
  in cb0f8fda96
  and
  807df4fcf0.
- This was removed from the `render nothing: true` in
  https://github.com/rails/rails/pull/14883.
- Removing it from response of :head also. As :head is more obvious
  alternative to call `render nothing:
  true`(http://guides.rubyonrails.org/layouts_and_rendering.html#using-head-to-build-header-only-responses),
  removing it from head method also.
- Closes #18253.
2014-12-30 20:50:23 +05:30
Godfrey Chan
111f2f4422 Use released rack
`rack.version` was bumped in 28e77c710a
2014-12-19 01:26:19 -08:00
Rafael Mendonça França
e745ae297f Merge pull request #17995 from jethroo/fix/assert_template_with_unsupported_layout_type
assert template should raise ArgumentError for unsupported layout types
2014-12-16 18:35:38 -02:00
Carsten Wirth
7ff31feb14 adding that assert_template with :layout will raise ArgumentError for unknown layout type 2014-12-16 19:30:52 +01:00
Rafael Mendonça França
3bdd110dfe Merge pull request #18052 from timoschilling/reset_variants
allow reseting of request variants
2014-12-16 15:06:01 -02:00
Timo Schilling
e1fb3483d6 allow reseting of request variants
The current implementation of `variants=` don't allow a resetting to nil, wich is the default value.

This results in the following code smell:
```ruby
case request.user_agent
when /iPhone/
  request.variants = :phone
when /iPad/
  request.variants = :ipad
end
```

With the ability to reset variants to nil, it could be:
```ruby
request.variants = case request.user_agent
when /iPhone/
  :phone
when /iPad/
  :ipad
end
```
2014-12-16 11:37:04 +01:00
claudiob
8dfa585db2 Remove misleading test: around_action return false
When an `around_action` does not `yield`, then the corresponding action is
*never* executed and the `after_` actions are *never* invoked.

The value returned by the `around_action` does not have any impact on this:
an `around_action` can "return" `true`, `false`, or `"pizza"`, but as long
as `yield` is not invoked, the corresponding action and after callbacks are
not executed.

The test suite for `ActionController::Callbacks` currently includes separate
tests to distinguish the cases in which a non-yielding `around_actions` returns
`true` or `false`.

In my opinion, having such tests is misleading, giving the impression that the
returned value might have some sort of impact, while it does not. At least
that's the impression I got when I read those tests.

For completeness, the tests were introduced 7 years ago by @NZKoz in e80fabb.
2014-12-15 16:36:50 -08:00
Chris Sinjakli
8f8ccb9901 Don't convert empty arrays to nils when deep munging params 2014-12-15 14:51:07 +00:00
Santiago Pastorino
ef99d4cd3e Merge pull request #18022 from agrobbin/url-helpers-optional-scopes
Allow URL helpers to work with optional scopes
2014-12-13 19:03:30 -02:00
Alex Robbin
a842c5c12d allow URL helpers to work with optional scopes 2014-12-13 15:52:41 -05:00
Nate Berkopec
d57d85a126 ParameterFilter shouldn't try to dup symbol keys 2014-12-13 15:34:59 -05:00
Tatiana Soukiassian
1a50be8231 Fix handling of positional url helper arguments when format is false
There is no need to subtract one from the path_params size when there is
no format parameter because it is not present in the path_params array.

Fixes #17819.
2014-12-13 15:42:15 +00:00
Prem Sichanugrist
61fff0e23b Add AC::Parameters#to_unsafe_h
As suggested in #16299([1]), this method should be a new public API for
retrieving unfiltered parameters from `ActionController::Parameters`
object, given that `Parameters#to_hash` will no longer work in Rails
5.0+ as we stop inheriting `Parameters` from `Hash`.

[1]: https://github.com/rails/rails/pull/16299#issuecomment-50220919
2014-12-12 18:52:10 +07:00
Dieter Komendera
2fde159f6b Ensure append_info_to_payload is called even if an exception is raised.
See:
* https://github.com/rails/rails/pull/14903
* https://github.com/roidrage/lograge/issues/37

Some code by mxrguspxrt from #14903.
2014-12-10 22:13:13 +01:00
T.J. Schuck
ee65f48c26 Mounted Rack apps should have default named routes based on app name
This fixes a regression in 4.2.0 from 4.1.8.

https://github.com/rails/rails/pull/17823 fixed a similar regression regarding _explicitly_ named routes for a mounted Rack app, but there was another regression for the default value.

With a route like:

    Rails.application.routes.draw do
      mount Mountable::Web, at: 'some_route'
    end

The "Prefix" column of rake routes gives the following:

- 4.1.8:         mountable_web
- 4.2.0.beta1-4: [nothing]
- 4.2.0.rc1:     [nothing]
- 4.2.0.rc2:     some_route   <- regression

This fixes the default to go back to being based off the name of the class like the docs specify: 785d04e310/actionpack/lib/action_dispatch/routing/mapper.rb (L558-L560)

Explicitly named routes still work correctly per https://github.com/rails/rails/pull/17823:

    Rails.application.routes.draw do
      mount Mountable::Web, at: 'some_route', as: 'named'
    end

- 4.1.8:         named
- 4.2.0.beta1-4: [nothing]
- 4.2.0.rc1:     [nothing]
- 4.2.0.rc2:     named
2014-12-06 01:17:50 -05:00
Tu Hoang
8ef51f64e5 Typo: Hello = Guten Tag (in German) 2014-12-05 12:54:15 +07:00
Rafael Mendonça França
dfa45ce7e1 Merge pull request #17792 from rockrep/master
allow 'all' for :domain option in addition to :all
2014-12-04 15:21:47 -02:00
claudiob
e428ddecec Remove "rescue" clause around "require 'openssl'"
Some `require 'openssl'` statements were surrounded by `rescue` blocks to deal with Ruby versions that did not support `OpenSSL::Digest::SHA1` or `OpenSSL::PKCS5`.

[As @jeremy explains](a6a0904fcb (commitcomment-8826666)) in the original commit:

> If jruby didn't have jruby-openssl gem, the require wouldn't work. Not sure whether either of these are still relevant today.

According to the [release notes for JRuby 1.7.13](http://www.jruby.org/2014/06/24/jruby-1-7-13.html):

> jruby-openssl 0.9.5 bundled

which means the above `rescue` block is not needed anymore.

All the Ruby versions supported by the current version of Rails provide those OpenSSL libraries, so Travis CI should also be happy by removing the `rescue` blocks.

---

Just to confirm, with JRuby:

    $ ruby --version #=> jruby 1.7.16.1 (1.9.3p392) 2014-10-28 4e93f31 on Java HotSpot(TM) 64-Bit Server VM 1.8.0_20-b26 +jit [darwin-x86_64]
    $ irb
    irb(main):001:0> require 'openssl' #=> true
    irb(main):002:0> OpenSSL::Digest::SHA1 #=> OpenSSL::Digest::SHA1
    irb(main):003:0> OpenSSL::PKCS5 # => OpenSSL::PKCS5

And with Ruby 2.1:

    $ ruby --version #=> ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
    $ irb
    irb(main):001:0> require 'openssl' #=> true
    irb(main):002:0> OpenSSL::Digest::SHA1 #=> OpenSSL::Digest::SHA1
    irb(main):003:0> OpenSSL::PKCS5 #=> OpenSSL::PKCS5
2014-12-03 21:58:02 -08:00
Melissa Xie
3b43d1d822 Fix "nonexistent" typo in tests 2014-12-02 19:19:10 -05:00
Rafael Mendonça França
9fd6011f40 Merge pull request #17873 from kirs/refactor-debug-erb
Refactor debug view
2014-12-02 12:55:08 -02:00
Kir Shatrov
083f657c0f Refactor debug view
Avoid logic in ERB and use helpers
2014-12-02 09:45:20 -05:00
Rafael Mendonça França
921576b1d9 Merge pull request #17862 from lucasmazza/lm-hide-action
`_generate_paths_by_default` should always be private.
2014-12-02 11:40:11 -02:00
Aaron Patterson
c9a5ed22d5 Merge pull request #17827 from rkh/rkh-fix-or-pattern
Fix OR in Journey patterns
2014-12-01 07:55:29 -08:00
Sean Griffin
5493d16d9e Merge pull request #17823 from byroot/fix-mount-rack-apps-with-as
Pure rack apps can be mounted with a name
2014-11-29 15:31:12 -07:00
Jean Boussier
f413cbee8d Pure rack apps can be mounted with a name
See 9b15828b5c (commitcomment-8764492)
2014-11-29 09:24:43 -05:00
Erik Michaels-Ober
d1374f99bf Pass symbol as an argument instead of a block 2014-11-29 11:53:24 +01:00
Konstantin Haase
0d690d75fb make OR in journey patterns compile to a valid regular expression 2014-11-29 01:26:10 +01:00
rockrep
f7dbf388bd allow 'all' for :domain option in addition to :all 2014-11-26 13:34:52 -08:00
Matthew Draper
25b14b4d32 Merge pull request #17186 from tgxworld/header_authentication_token
Allow authentication header to not have to specify 'token=' key.
2014-11-27 01:44:13 +10:30
Rafael Mendonça França
f84ffdd5de Merge pull request #17733 from yuki24/do-not-rescue-exception-in-params-parser
Do not rescue Exception in ActionDispatch::ParamsParser
2014-11-25 20:01:58 -02:00
Santiago Pastorino
d3dafaa0b3 Merge branch 'nil_script_name' 2014-11-25 10:31:26 -02:00
Santiago Pastorino
ad973ab8a0 Add regression test case to ensure script_name as nil is not used anymore in url_for 2014-11-25 10:29:48 -02:00
Sean Griffin
9545e6edc7 Merge branch 'deprecate-string-options-in-url-helpers' 2014-11-24 19:18:01 -07:00
Melanie Gilman
4d84922840 Deprecate string options in URL helpers
Fixes https://github.com/rails/rails/issues/16958

[Byron Bischoff & Melanie Gilman]
2014-11-24 21:16:33 -05:00
David Heinemeier Hansson
47728d53aa Merge pull request #17747 from gsamokovarov/missing-template-backtrace
Show source view and backtrace on missing template errors
2014-11-24 23:10:22 +03:00
Genadi Samokovarov
92ace39692 Show source view and backtrace on missing template errors
This will help you debug missing template errors, especially if they
come from a programmatic template selection. Thanks to @dhh for
suggesting that.

As a bonus, also show request and response info on the routing error
page for consistency.
2014-11-24 22:06:11 +02:00
Yuki Nishijima
1d85c707b6 Do not rescue Exception in ParamsParser
Unlike ShowExceptions or PublicExceptions, ParamsParser shouldn't
transform exceptions like Interrupt and NoMemoryError into ParserError.
2014-11-23 13:47:09 -08:00
Godfrey Chan
8e73abbda8 Deprecate use_route in controller tests
Reference #17453
2014-11-23 01:42:46 -08:00
Godfrey Chan
938d130c62 Fix cases where the wrong name is passed to Formatter#generate
These are currently working "by accident" because `match_route` does not check
that the name is valid.
2014-11-23 01:08:53 -08:00
Godfrey Chan
77a276411e Test using ActionController::TestCase with engines
Reference #17453

[Godfrey Chan, Washington Luiz]
2014-11-23 00:07:30 -08:00
Guo Xiang Tan
46041c5208 Anchor should not be appended when set to nil/false.
Fixes https://github.com/rails/rails/issues/17714.
2014-11-23 08:23:26 +08:00
Rafael Mendonça França
1b9e85dbbd Make sure assert_select can assert body tag
This reverts commit f93df52845766216f0fe36a4586f8abad505cac4, reversing
changes made to a455e3f4e9dbfb9630d47878e1239bc424fb7d13.

Conflicts:
	actionpack/lib/action_controller/test_case.rb
	actionview/lib/action_view/test_case.rb
2014-11-18 18:47:22 -02:00
Rafael Mendonça França
5495771938 Merge pull request #17642 from tgxworld/fix_template_assertion_on_assigns
Fix for assigns(:..) resetting template assertions
2014-11-17 11:50:09 -02:00
Calvin Correli
c3e8d15e8b Fix for assigns(:..) resetting template assertions
When calling assigns(:...) or cookies(:...), template assertions would be reset, which they obviously shouldn't be.
2014-11-17 09:49:07 +08:00
Genadi Samokovarov
20ad04e5fc Rename #source_extract to #source_extracts in ExceptionWrapper
It returns multiple source extracts since 1ed264bc. Also cleaned its
result structure, as we no longer need the file in a code extract.
2014-11-16 18:39:45 +02:00
Genadi Samokovarov
e05714fdbc Don't let #{application,framework,full}_trace be nil
Those three can be nil when exception backtrace is nil. This happens and
that forced a couple of nil guards in the code. I'm proposing to make
those always return an array, even on nil backtrace.
2014-11-16 17:17:06 +02:00
Santiago Pastorino
ee74d9c969 Merge pull request #17614 from gsamokovarov/exception-wrapper-basic-tests
Add basic tests for ActionDispatch::ExceptionWrapper
2014-11-14 12:21:22 -02:00
Genadi Samokovarov
5007929826 Add basic tests for ActionDispatch::ExceptionWrapper 2014-11-13 23:34:27 +01:00
Rafael Mendonça França
3c60fb429d Make FlashHash#key? work with symbol and string
Closes #17586
2014-11-11 01:04:06 -02:00
Godfrey Chan
6625000b73 Remove useless only_path: true in path helpers
We added a deprecation warning for these cases in aa1fadd, so these are now
causing deprecation warnings in the test output. AFAICT, in these two cases, the
option is not integral to the purpose of the test, so they can be safely removed
2014-11-10 00:47:25 -08:00
Godfrey Chan
aa6637d140 Pass the route name explicitly
Follow up to 212057b9. Since that commit, we need to pass the `route_name`
explicitly. This is one of the left-over cases that was not handled in that
commit, which was causing `use_route` to be ignored in functional tests.
2014-11-10 00:31:49 -08:00
Guo Xiang Tan
76f5a9afb3 Remove session to allow with_routing to be called twice.
Fixes: https://github.com/rails/rails/issues/16814
2014-11-05 23:38:02 +08:00
Xavier Noria
810b7914f3 Merge pull request #17440 from claudiob/remove-yet-another-redundant-to-s
Remove redundant `to_s` in interpolation
2014-10-30 19:47:36 +01:00
Aaron Patterson
c6f9518e24 Merge branch 'master-sec'
* master-sec:
  FileHandler should not be called for files outside the root
2014-10-30 11:39:46 -07:00
claudiob
64b09823e6 Remove redundant to_s in interpolation 2014-10-30 08:48:32 -07:00
Godfrey Chan
aa1fadd48f Deprecate the only_path option on *_path helpers.
In cases where this option is set to `true`, the option is redundant and can
be safely removed; otherwise, the corresponding `*_url` helper should be
used instead.

Fixes #17294.

See also #17363.

[Dan Olson, Godfrey Chan]
2014-10-28 09:43:33 -07:00
Rafael Mendonça França
d27efbfbf5 Merge pull request #17362 from bronzle/fix_debug_exceptions_app
Show the user’s application in the source window and select the correct ...
2014-10-26 22:04:43 -05:00
Xavier Noria
8d7cf75684 give a better error message for misspelled helpers
See comment in this patch for the rationale.

References #16468
2014-10-25 14:06:33 +02:00
Byron Bischoff
dbcbbcf2bc Show the user’s application in the source window and select the correct trace list, closes #17312 2014-10-23 09:53:43 -07:00
Accessd
20dcc0ab0a fix small typo in routing test 2014-10-21 19:46:29 +04:00
Accessd
2224bf7992 fix url generation error message 2014-10-21 12:10:48 +04:00
Nicolas Cavigneaux
3041bb2a94 Improve Journey compliance to RFC 3986
The scanner in Journey fails to recognize routes that use literals
from the sub-delims section of RFC 3986.

This commit enhance the compatibility of Journey with the RFC by
adding support of authorized delimiters to the scanner.

Fix #17212
2014-10-14 16:42:50 +02:00
Arthur Neves
707e2e8858 Add regression test for router was overwriting PATH_INFO
[related #17233]
2014-10-10 19:05:36 -04:00
Aaron Patterson
d1123f2056 FileHandler should not be called for files outside the root
FileHandler#matches? should return false for files that are outside the
"root" path.
2014-10-10 16:00:03 -07:00
Guo Xiang Tan
3cc25864e3 Allow authentication header to not have to specify 'token=' key.
Fixes: https://github.com/rails/rails/issues/17108.
2014-10-10 09:38:03 +08:00
Stefan Henzen
e86cadc257 Request#check_method no longer breaks when :en is not available locale
Request#check_method would use to_sentence(locale: :en), which breaks when
I18n.available_locales does not include :en and
I18n.enforce_available_locales is true (default).

Inlined to_sentence functionality to solve this.
2014-10-09 15:45:49 +02:00
Kasper Timm Hansen
f939904f23 Parse HTML as document fragment.
This is to match the changes in Rails Dom Testing rails/rails-dom-testing#20.
2014-09-29 21:41:52 +02:00
Erik Michaels-Ober
e2b49b203f Use Hash#each_key instead of Hash#keys.each
Hash#keys.each allocates an array of keys; Hash#each_key iterates through the
keys without allocating a new array. This is the reason why Hash#each_key
exists.
2014-09-29 17:27:10 +02:00
Rafael Mendonça França
4af5899e25 Revert "Merge pull request #16966 from why-el/symbolize-path-params"
This reverts commit 9d05d6de52871e57bfbf54a60de005e8a5f5b0e4, reversing
changes made to 0863c9248fd47a15e88e05ce4fcd80966684c0e3.

The change in the behaviour reported at #16958 doesn't exist since 4.0
and 4.1 works in the same way
2014-09-25 18:07:22 -03:00
Mohamed Wael Khobalatte
f10b38bbc8 Ensure named path params are symbols (Fixes #16958) 2014-09-25 17:40:26 -03:00
Godfrey Chan
391cfc2054 Fix actionpack test cases broken by #16888 2014-09-26 01:42:18 +09:00
Yuki Nishijima
75eaefcc2f Rescue Rack::Utils::ParameterTypeError instead of TypeError
As of rack/rack@167b648023, Rack raises
Rack::Utils::ParameterTypeError which inherits TypeError.

In terms of the behavior, Rescuing TypeError still works but this
method shouldn't rescue if TypeError is raised for other reasons.
2014-09-13 16:54:20 -07:00
Godfrey Chan
2b41343c34 Default to sorting user's test cases for now
Goals:

1. Default to :random for newly generated applications
2. Default to :sorted for existing applications with a warning
3. Only show the warning once
4. Only show the warning if the app actually uses AS::TestCase

Fixes #16769
2014-09-08 05:32:16 -07:00
Thiago Pradi
90c06717bc Removing unused fake models 2014-09-07 22:51:14 -03:00
Javan Makhmali
66f8997671 Add support for Rack::ContentLength middelware 2014-09-06 12:33:29 -04:00
Jeremy Kemper
2a78d6f561 Deprecate implicit AD::Response splatting and Array conversion 2014-09-06 07:05:59 -07:00
Rafael Mendonça França
67117f7c5d Add test to assert_recognizes with custom message 2014-09-05 16:47:00 -03:00
Rafael Mendonça França
3f720d580f Merge pull request #14911 from estsauver/14908
Propagate test messages through assert_routing helper, Fixes #14908
2014-09-05 16:43:14 -03:00
Matthew Draper
2f52f96988 Leave all our tests as order_dependent! for now
We're seeing too many failures to believe otherwise.

This reverts commits bc116a55ca3dd9f63a1f1ca7ade3623885adcc57,
cbde413df3839e06dd14e3c220e9800af91e83ab,
bf0a67931dd8e58f6f878b9510ae818ae1f29a3a, and
2440933fe2c27b27bcafcd9019717800db2641aa.
2014-09-02 23:55:34 +09:30
Xavier Noria
4c917dae9a Merge pull request #16644 from Agis-/drb-tests-actionpack-vagrant
Use system /tmp for temp files when testing actionpack
2014-08-30 09:49:13 +02:00
Aaron Patterson
6d86762fd8 Merge pull request #16637 from Agis-/redirect-with-constraint-route
Fix the router ignoring constraints when used together with a redirect route
2014-08-28 10:33:40 -07:00
schneems
0b1a87f73c Refactor out Dir.glob from ActionDispatch::Static
Dir.glob can be a security concern. The original use was to provide logic of fallback files. Example a request to `/` should render the file from `/public/index.html`. We can replace the dir glob with the specific logic it represents. The glob {,index,index.html} will look for the current path, then in the directory of the path with index file and then in the directory of the path with index.html. This PR replaces the glob logic by manually checking each potential match. Best case scenario this results in one less file API request, worst case, this has one more file API request.

Related to #16464

Update: added a test for when a file of a given name (`public/bar.html` and a directory `public/bar` both exist in the same root directory. Changed logic to accommodate this scenario.
2014-08-27 13:03:08 -05:00
Peter Suschlik
03e660e768 Use less iterations for KeyGenerator in tests
This commit improves performance of cookie tests:

Ruby  |   After  |   Before
----- | --------:| --------:
MRI   |    5.03s |     9.28s
JRuby |   25.45s |  1648.23s

Please note the improvement for JRuby.
2014-08-27 11:34:17 +02:00
Agis-
d78f3f0ec3 Don't ignore constraints in redirect routes
402c2af550
introduced a regression that caused any constraints added to redirect routes
to be ignored.

Fixes #16605
2014-08-25 00:18:25 +03:00
schneems
8e31fa3b72 Address comments on Gzip implementation
- don't mutate PATH_INFO in env, test
- test fallback content type matches Rack::File
- change assertion style
- make HTTP_ACCEPT_ENCODING comparison case insensitive
- return gzip path from method instead of true/false so we don't have to assume later
- don't allocate un-needed hash.

Original comments:

https://github.com/rails/rails/commit/
cfaaacd9763642e91761de54c90669a88d772e5a#commitcomment-7468728

cc @jeremy
2014-08-24 15:58:16 -05:00
Agis-
b7ab73a4e2 Use system /tmp when testing actionpack
c64bff2c87
added support and enabled parallel execution of the actionpack tests.

However it introduced c64bff2c87
since one cannot connect to a socket file that's inside a Vagrant synced folder
due to security restrictions, and DRb tries to.

Also rename the temporary files to make it obvious that they're rails-related,
since now they're placed outside the project's directory.

Fixes c64bff2c87
2014-08-22 22:03:41 +03:00
Guo Xiang Tan
9212042631 Improve router test.
We should assert that routes will not be recognized if the verbs do
not match.
2014-08-21 16:35:39 +08:00
Guo Xiang Tan
d3eb92d95a Avoid duplicating routes for HEAD requests.
Follow up to rails#15321

Instead of duplicating the routes, we will first match the HEAD request to
HEAD routes. If no match is found, we will then map the HEAD request to
GET routes.
2014-08-21 16:35:39 +08:00
schneems
cfaaacd976 Enable gzip compression by default
If someone is using ActionDispatch::Static to serve assets and makes it past the `match?` then the file exists on disk and it will be served. This PR adds in logic that checks to see if the file being served is already compressed (via gzip) and on disk, if it is it will be served as long as the client can handle gzip encoding. If not, then a non gzip file will be served.

This additional logic slows down an individual asset request but should speed up the consumer experience as compressed files are served and production applications should be delivered with a CDN. This PR allows a CDN to cache a gzip file by setting the `Vary` header appropriately. In net this should speed up a production application that are using Rails as an origin for a CDN. Non-asset request speed is not affected in this PR.
2014-08-20 22:33:06 -05:00
Jeremy Kemper
79d50ce310 Merge pull request #16570 from bradleybuda/breach-mitigation-mask-csrf-token
CSRF token mask from breach-mitigation-rails gem
2014-08-19 18:17:07 -07:00
Bradley Buda
69fc0e1b5e Auth token mask from breach-mitigation-rails gem
This merges in the code from the breach-mitigation-rails gem that masks
authenticity tokens on each request by XORing them with a random set of
bytes. The masking is used to make it impossible for an attacker to
steal a CSRF token from an SSL session by using techniques like the
BREACH attack.

The patch is pretty simple - I've copied over the [relevant
code](https://github.com/meldium/breach-mitigation-rails/blob/master/lib/breach_mitigation/masking_secrets.rb)
and updated the tests to pass, mostly by adjusting stubs and mocks.
2014-08-19 15:28:07 -07:00
Rafael Mendonça França
d59a24d543 Protect against error when parsing parameters with Bad Request
Related with #11795.
2014-08-19 15:36:05 -03:00