Commit Graph

15637 Commits

Author SHA1 Message Date
Rafael Mendonça França
696ccbc265
Remove deprecated poltergeist and webkit (capybara-webkit) driver registration for system testing 2023-03-03 00:38:23 +00:00
Rafael Mendonça França
1e70d0f5d3
Remove deprecated ability to assign a single value to config.action_dispatch.trusted_proxies 2023-03-03 00:38:22 +00:00
Rafael Mendonça França
689b277733
Remove deprecated behavior on Request#content_type 2023-03-03 00:38:21 +00:00
Rafael Mendonça França
787b81b620
Merge pull request #47488 from jkotchoff/rails-info-routes-layout-compaction
Line break long routes to prevent scrolling
2023-02-28 17:49:56 -05:00
Matthew Draper
629a32148c
Merge pull request #47477 from ioquatix/rack-3-static-lowercase-headers
Rack 3 static lowercase headers.
2023-02-26 20:33:54 +10:30
Matthew Draper
e06844f69b Expect Static to set lowercase values in Vary 2023-02-26 19:36:29 +10:30
Jason Kotchoff
b11131868f Line break long routes to prevent scrolling
Prevents horizontal scrolling on the rails/info/routes page when there
are long route names by introducing styled line breaks so that the table
will fit within the rendered width of the browser.

This is particularly relevant when there are a lot of nested namespaces
in a rails project and makes the page more readable, especially when
filtering with a search query.

The table headings have also been left-aligned so that they line up more
intuitively with the content and now that the table is no longer
horizontally scrolling, less space has been explicitly allocated for the
HTTP Verb column.
2023-02-24 05:16:30 +00:00
Nick Borromeo
92216ebb19 Create an ActionView::PathRegistry module
This is a refactor of the `Registry` module added in https://github.com/rails/rails/pull/47347. This is an attempt to
minimize the namespace conflcits that will happen when users will have a top level `Registry` module which can cause
incorrect behavior

Replace ActionView::ViewPaths::Registry with ActionView::PathRegistry
2023-02-23 16:53:57 -08:00
zzak
d2af670dba
Remove Copyright years (#47467)
* Remove Copyright years

* Basecamp is now 37signals... again

Co-authored-by: David Heinemeier Hansson <dhh@hey.com>

---------

Co-authored-by: David Heinemeier Hansson <dhh@hey.com>
2023-02-23 11:38:16 +01:00
Samuel Williams
152b6c9986
Prefer lowercase headers in ActionDispatch::Static.
`ActionDispatch::Static` uses mixed-case headers and merges them with
lower case headers. This produces duplicate headers. Prefer lowercase
headers to avoid this situation.
2023-02-23 20:24:17 +13:00
Gannon McGibbon
3f4a7734da Set ORIGINAL_FULLPATH header in controller tests
Since rails/rails#47296, nothing sets the fullpath early, so changing
the path of a request, and then calling original_fullpath returns the
updated fullpath. This is a controller testing specific bug as
integration tests and real requests always have this header set, so I
think controller tests should too.
2023-02-22 00:33:09 -06:00
John Hawthorn
28284fc186 Refactor into ViewPaths::Registry 2023-02-16 10:29:17 -08:00
Aaron Patterson
218ec10df8
Merge pull request #47092 from ioquatix/rack-3-streaming-body
Update `ActionDispatch::Response` to support streaming bodies.
2023-02-14 17:01:45 -08:00
Aaron Patterson
e89b2e4271
Merge pull request #47147 from ioquatix/rack-3-headers-name-normalization
Normalize usage of "Headers".
2023-02-14 17:01:05 -08:00
Yasuo Honda
f838a74212
Merge pull request #46866 from ghousemohamed/change-year-2022-to-2023 2023-02-13 13:15:43 +09:00
Pedro de Jesus
c426e46d76 Add body_stream.rewind before reading it on ActionPack::Request 2023-02-10 19:02:19 +00:00
Pedro de Jesus
75126b8dd4 Fix issue #46784 2023-02-10 17:27:49 +00:00
Carlos Antonio da Silva
643c2cbbff Fix changelog example in actionpack
`full_path` is actually `fullpath`, as described in the line above.
`filtered_path` exists only in the `request` object, not `response`.

[ci skip]
2023-02-09 09:08:17 -03:00
Rafael Mendonça França
aa3fc0fca2
Merge pull request #47296 from ritikesh/filtered_path
use filtered_path in action_controller event payloads instead of fullpath
2023-02-08 13:29:10 -05:00
Eileen M. Uchitelle
d86f75256b
Merge pull request #47310 from olefriis/fix-recognize-path-regression
Fix regression in ActionDispatch::Routing::RouteSet#recognize_path
2023-02-08 08:52:40 -05:00
Petrik
32aba689ef Use Example heading without semicolon [ci-skip]
Make headers more consistent as we almost never add semicolons to the
headers.
2023-02-08 12:08:37 +01:00
Ole Friis Østergaard
1d3edd1c84 Fix regression in ActionDispatch::Routing::RouteSet#recognize_path 2023-02-08 10:49:29 +00:00
Ritikesh G
c59ce2cf71
use filtered_path in action_controller event payloads instead of fullpath 2023-02-08 13:28:32 +05:30
zzak
b34e579636
RDoc should go next to the declared module 2023-02-08 15:12:58 +09:00
Koichi ITO
5726b1d1d7 Use RuboCop Performance 1.16.0
## Summary

This PR bumps RuboCop Performance to 1.16.0 and suppresses the following new offenses:

```console
% bundle exec rubocop
(snip)

Offenses:

actionpack/lib/action_dispatch/routing/mapper.rb:309:16:
C: [Correctable] Performance/StringInclude: Use String#include? instead of a regex match with literal-only pattern.
            if /#/.match?(to)
               ^^^^^^^^^^^^^^
actionpack/lib/action_dispatch/routing/mapper.rb:1643:18:
C: [Correctable] Performance/StringInclude: Use String#include? instead of a regex match with literal-only pattern.
              if /#/.match?(to)
                 ^^^^^^^^^^^^^^
actionpack/lib/action_dispatch/routing/route_set.rb:887:67:
C: [Correctable] Performance/StringInclude: Use String#include? instead of a regex match with literal-only pattern.
        path = Journey::Router::Utils.normalize_path(path) unless %r{://}.match?(path)
                                                                  ^^^^^^^^^^^^^^^^^^^^
actionpack/lib/action_dispatch/testing/assertions/routing.rb:86:12:
C: [Correctable] Performance/StringInclude: Use String#include? instead of a regex match with literal-only pattern.
        if %r{://}.match?(expected_path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
actionpack/lib/action_dispatch/testing/assertions/routing.rb:205:14:
C: [Correctable] Performance/StringInclude: Use String#include? instead of a regex match with literal-only pattern.
          if %r{://}.match?(path)
             ^^^^^^^^^^^^^^^^^^^^
actionpack/lib/action_dispatch/testing/integration.rb:235:12:
C: [Correctable] Performance/StringInclude: Use String#include? instead of a regex match with literal-only pattern.
        if %r{://}.match?(path)
           ^^^^^^^^^^^^^^^^^^^^
actiontext/bin/webpack:18:6:
C: [Correctable] Performance/StringInclude: Use String#include? instead of a regex match with literal-only pattern.
  if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 150))
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
actiontext/bin/webpack-dev-server:18:6:
C: [Correctable] Performance/StringInclude: Use String#include? instead of a regex match with literal-only pattern.
  if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 150))
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb:120:64:
C: [Correctable] Performance/StringInclude: Use String#include? instead of a regex match with literal-only pattern.
          elsif column.type == :uuid && value.is_a?(String) && /\(\)/.match?(value)
                                                               ^^^^^^^^^^^^^^^^^^^^
railties/lib/rails/commands/secrets/secrets_command.rb:28:12:
C: [Correctable] Performance/StringInclude: Use String#include? instead of a regex match with literal-only pattern.
        if /secrets\.yml\.enc/.match?(error.message)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

3088 files inspected, 10 offenses detected, 10 offenses autocorrectable
```

## Additional Information

This behavior change is based on:
https://github.com/rubocop/rubocop-performance/pull/332
2023-02-06 13:06:31 +09:00
Eileen M. Uchitelle
3cca0d5205
Merge pull request #47200 from skipkayhil/use-ad-deprecator-illegal-state
Use AD.deprecator for IllegalStateError
2023-01-31 08:48:59 -05:00
Eileen M. Uchitelle
77d4ce0ade
Merge pull request #47199 from skipkayhil/deprecate-missing-helper-error
Deprecate AbstractController MissingHelperError
2023-01-31 08:48:29 -05:00
Hartley McGuire
d1689ef8eb
Use AD.deprecator for IllegalStateError
Previously, ActionDispatch::IllegalStateError was deprecated using
Module#deprecate_constant in 0b4b4c6b96a41ef649f15e1a3df26e28ef95ff24.
This requires the -w flag to be used to actually see the deprecation
warning, and it can not be controlled using ActiveSupport::Deprecator
configuration.

This commit changes the deprecation to use #deprecate_constant from
ActiveSupport::Deprecation::DeprecatedConstantAccessor. This ensures
that the deprecation warning will be printed even without -w, and the
warning can be controlled by configuring ActionDispatch.deprecator
2023-01-31 03:16:20 -05:00
Hartley McGuire
ada584bcb8
Deprecate AbstractController MissingHelperError
This error used to be a wrapper for a LoadError raised when
require_dependency was used to load helpers for controllers.

Since Zeitwerk does not use require_dependency, the only usage of the
error was removed in 5b28a0e972da31da570ed24be505ef7958ab4b5e.
2023-01-31 02:49:21 -05:00
Hartley McGuire
89a905a798
Rm unused load_error core_ext in Action Controller
It was moved from action_controller/base/helpers.rb to its current
location in 28508d444e36dc8b5819f011f0a2398f44d8d3e3. At that time,
there were only two instances of is_missing being used: one in
action_controller/base/helpers and one in action_mailer/base/helpers.rb.

The action_mailer usage was moved to abstract_controller/helpers in
684c2dc20801b7fcc941ec9478d33d3bf7c74551, and the action_controller
usage moved in 0e063f435ce31a091d1097156172d551bd9d9d37. This last
usage was later removed in 5b28a0e972da31da570ed24be505ef7958ab4b5e,
leaving the require now unused.
2023-01-31 01:26:25 -05:00
Rafael Mendonça França
c8190750f9
Merge PR #47144 2023-01-30 22:53:09 +00:00
Rafael Mendonça França
fee1434734
Update CHANGELOG 2023-01-30 19:04:40 +00:00
zzak
2958f3952f
Merge pull request #47162 from stevenharman/document_exceptions_app_error_handling
Document exceptions app error handling
2023-01-29 16:34:15 +09:00
zzak
766564f78f Several fixes for AC::Streaming 2023-01-29 08:35:33 +09:00
zzak
f6f52c363b Add Passenger docs for ActionController::Streaming
Originally added in #20811

Co-authored-by: Aditya Kapoor <adityakapoor.mait@gmail.com>
2023-01-28 18:28:57 +09:00
Sean Doyle
ad79ed0e6b ActionDispatch::Testing::TestResponse#parsed_body parse HTML with Nokogiri
Prior to this commit, the only out-of-the-box parsing that
`ActionDispatch::Testing::TestResponse#parsed_body` supported was for
`application/json` requests. This meant that `response.body ==
response.parsed_body` for HTML requests.

```ruby
get "/posts"
response.content_type         # => "text/html; charset=utf-8"
response.parsed_body.class    # => Nokogiri::HTML5::Document
response.parsed_body.to_html  # => "<!DOCTYPE html>\n<html>\n..."
```

Using `parsed_body` for JSON requests supports `Hash#fetch`, `Hash#dig`,
and Ruby 3.2 destructuring assignment and pattern matching.

The introduction of [Nokogiri support for pattern
matching][nokogiri-pattern-matching] poses an opportunity to make assertions
about the structure of the HTML response.

On top of that, there is ongoing work to [introduce pattern matching
support in MiniTest][minitest-pattern-matching].

[nokogiri-pattern-matching]: https://github.com/sparklemotion/nokogiri/pull/2523
[minitest-pattern-matching]: https://github.com/minitest/minitest/pull/936
2023-01-27 23:52:21 -05:00
Michael Hadley
c22e20e79c Fix typo in assume_ssl configuration guide 2023-01-27 19:09:38 -08:00
Steven Harman
af1019cecd
Fix typo: missing end brackets 2023-01-27 12:53:57 -05:00
Samuel Williams
a3caa2b551
Normalize usage of "Headers". 2023-01-26 12:06:24 +13:00
Rafael Mendonça França
2cf8740e15
Merge pull request #47091 from ioquatix/rack-3-case-insensitive-headers
Use Rack's own headers classes where appropriate.
2023-01-25 17:22:47 -05:00
Joel Hawksley
2fc46f95a5
Tag HTTP::Request with route URI pattern (#47129)
In the GitHub RoR monolith, we output the route URI pattern
in an HTML meta tag in our application layout for analysis
purposes. However, our current implementation is quite manual.

This change adds an attribute to requests with the URI pattern
of the matched route.

Co-authored-by: Rafael Mendonça França <rafael@rubyonrails.org>
Co-authored-by: Kate Higa <khiga8@github.com>
2023-01-25 16:43:12 -05:00
Rafael Mendonça França
e572f23150
Merge pull request #47094 from zzak/rack-3-files-continued
Replace deprecated Rack::File with Rack::Files
2023-01-25 16:41:12 -05:00
David Heinemeier Hansson
8b8ac378a9 Trailing whitespace 2023-01-25 21:27:16 +01:00
Rafael Mendonça França
1b44989521
Merge PR #46594 2023-01-25 20:13:18 +00:00
David Heinemeier Hansson
1da6f8c68e
Allow use of SSL-terminating reserve proxy that doesn't set headers (#47139)
* Allow use of SSL-terminating reserve proxy that doesn't set headers

NGINX and other SSL-terminating reverse proxies can use HTTP headers to include forwarding information. If your stack includes SSL-termination through a network load balancer, that won't happen. You can use config.assume_ssl to address that.

* I hate these warts

* Document the new setting

* Add autoload for AssumeSSL

* Add CHANGELOG notice
2023-01-25 21:02:02 +01:00
Rafael Mendonça França
859b526c5b
Remove upper bound of rack
Allow users to install any version and try to see if Rails is compatible.
2023-01-25 15:25:49 +00:00
zzak
896c7faedf Use Gemfile to manage Rack version for dev 2023-01-25 12:24:19 +09:00
John Hawthorn
f6e36c90aa
Merge pull request #47087 from jhawthorn/cookie_domain
Fix cookie domain for `domain: all` on two letter single level TLD
2023-01-24 13:56:38 -08:00
John Hawthorn
941e0cd212 Fix cookie domain calculation for two letter tld 2023-01-23 16:37:16 -08:00
Ron Shinall
189e4108c5 Address Selenium :capabilities deprecation warning 2023-01-23 21:40:01 +00:00