actionpack 7.1.5.2 → 8.1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +309 -524
  3. data/README.rdoc +1 -1
  4. data/lib/abstract_controller/asset_paths.rb +6 -2
  5. data/lib/abstract_controller/base.rb +104 -105
  6. data/lib/abstract_controller/caching/fragments.rb +50 -53
  7. data/lib/abstract_controller/caching.rb +8 -3
  8. data/lib/abstract_controller/callbacks.rb +70 -62
  9. data/lib/abstract_controller/collector.rb +7 -7
  10. data/lib/abstract_controller/deprecator.rb +2 -0
  11. data/lib/abstract_controller/error.rb +2 -0
  12. data/lib/abstract_controller/helpers.rb +71 -84
  13. data/lib/abstract_controller/logger.rb +4 -1
  14. data/lib/abstract_controller/railties/routes_helpers.rb +2 -0
  15. data/lib/abstract_controller/rendering.rb +13 -13
  16. data/lib/abstract_controller/translation.rb +12 -13
  17. data/lib/abstract_controller/url_for.rb +8 -6
  18. data/lib/abstract_controller.rb +2 -0
  19. data/lib/action_controller/api/api_rendering.rb +2 -0
  20. data/lib/action_controller/api.rb +76 -72
  21. data/lib/action_controller/base.rb +199 -126
  22. data/lib/action_controller/caching.rb +16 -14
  23. data/lib/action_controller/deprecator.rb +2 -0
  24. data/lib/action_controller/form_builder.rb +21 -18
  25. data/lib/action_controller/log_subscriber.rb +23 -2
  26. data/lib/action_controller/metal/allow_browser.rb +133 -0
  27. data/lib/action_controller/metal/basic_implicit_render.rb +2 -0
  28. data/lib/action_controller/metal/conditional_get.rb +217 -175
  29. data/lib/action_controller/metal/content_security_policy.rb +25 -24
  30. data/lib/action_controller/metal/cookies.rb +4 -2
  31. data/lib/action_controller/metal/data_streaming.rb +72 -63
  32. data/lib/action_controller/metal/default_headers.rb +5 -3
  33. data/lib/action_controller/metal/etag_with_flash.rb +3 -1
  34. data/lib/action_controller/metal/etag_with_template_digest.rb +17 -15
  35. data/lib/action_controller/metal/exceptions.rb +16 -9
  36. data/lib/action_controller/metal/flash.rb +13 -14
  37. data/lib/action_controller/metal/head.rb +15 -11
  38. data/lib/action_controller/metal/helpers.rb +63 -55
  39. data/lib/action_controller/metal/http_authentication.rb +209 -201
  40. data/lib/action_controller/metal/implicit_render.rb +17 -15
  41. data/lib/action_controller/metal/instrumentation.rb +16 -14
  42. data/lib/action_controller/metal/live.rb +177 -128
  43. data/lib/action_controller/metal/logging.rb +6 -4
  44. data/lib/action_controller/metal/mime_responds.rb +151 -142
  45. data/lib/action_controller/metal/parameter_encoding.rb +34 -32
  46. data/lib/action_controller/metal/params_wrapper.rb +57 -59
  47. data/lib/action_controller/metal/permissions_policy.rb +22 -12
  48. data/lib/action_controller/metal/rate_limiting.rb +92 -0
  49. data/lib/action_controller/metal/redirecting.rb +213 -94
  50. data/lib/action_controller/metal/renderers.rb +78 -57
  51. data/lib/action_controller/metal/rendering.rb +111 -77
  52. data/lib/action_controller/metal/request_forgery_protection.rb +182 -143
  53. data/lib/action_controller/metal/rescue.rb +20 -9
  54. data/lib/action_controller/metal/streaming.rb +118 -195
  55. data/lib/action_controller/metal/strong_parameters.rb +720 -530
  56. data/lib/action_controller/metal/testing.rb +2 -0
  57. data/lib/action_controller/metal/url_for.rb +17 -15
  58. data/lib/action_controller/metal.rb +86 -60
  59. data/lib/action_controller/railtie.rb +36 -15
  60. data/lib/action_controller/railties/helpers.rb +2 -0
  61. data/lib/action_controller/renderer.rb +41 -36
  62. data/lib/action_controller/structured_event_subscriber.rb +116 -0
  63. data/lib/action_controller/template_assertions.rb +4 -2
  64. data/lib/action_controller/test_case.rb +160 -131
  65. data/lib/action_controller.rb +5 -1
  66. data/lib/action_dispatch/constants.rb +8 -0
  67. data/lib/action_dispatch/deprecator.rb +2 -0
  68. data/lib/action_dispatch/http/cache.rb +163 -35
  69. data/lib/action_dispatch/http/content_disposition.rb +2 -0
  70. data/lib/action_dispatch/http/content_security_policy.rb +54 -39
  71. data/lib/action_dispatch/http/filter_parameters.rb +14 -8
  72. data/lib/action_dispatch/http/filter_redirect.rb +22 -1
  73. data/lib/action_dispatch/http/headers.rb +22 -22
  74. data/lib/action_dispatch/http/mime_negotiation.rb +89 -41
  75. data/lib/action_dispatch/http/mime_type.rb +25 -21
  76. data/lib/action_dispatch/http/mime_types.rb +3 -0
  77. data/lib/action_dispatch/http/param_builder.rb +187 -0
  78. data/lib/action_dispatch/http/param_error.rb +26 -0
  79. data/lib/action_dispatch/http/parameters.rb +14 -12
  80. data/lib/action_dispatch/http/permissions_policy.rb +25 -36
  81. data/lib/action_dispatch/http/query_parser.rb +55 -0
  82. data/lib/action_dispatch/http/rack_cache.rb +2 -0
  83. data/lib/action_dispatch/http/request.rb +141 -92
  84. data/lib/action_dispatch/http/response.rb +137 -77
  85. data/lib/action_dispatch/http/upload.rb +18 -16
  86. data/lib/action_dispatch/http/url.rb +187 -89
  87. data/lib/action_dispatch/journey/formatter.rb +21 -9
  88. data/lib/action_dispatch/journey/gtg/builder.rb +4 -3
  89. data/lib/action_dispatch/journey/gtg/simulator.rb +34 -11
  90. data/lib/action_dispatch/journey/gtg/transition_table.rb +47 -53
  91. data/lib/action_dispatch/journey/nfa/dot.rb +2 -0
  92. data/lib/action_dispatch/journey/nodes/node.rb +8 -6
  93. data/lib/action_dispatch/journey/parser.rb +99 -195
  94. data/lib/action_dispatch/journey/path/pattern.rb +4 -1
  95. data/lib/action_dispatch/journey/route.rb +54 -38
  96. data/lib/action_dispatch/journey/router/utils.rb +22 -27
  97. data/lib/action_dispatch/journey/router.rb +63 -83
  98. data/lib/action_dispatch/journey/routes.rb +11 -2
  99. data/lib/action_dispatch/journey/scanner.rb +46 -42
  100. data/lib/action_dispatch/journey/visitors.rb +57 -23
  101. data/lib/action_dispatch/journey/visualizer/fsm.js +4 -6
  102. data/lib/action_dispatch/journey.rb +2 -0
  103. data/lib/action_dispatch/log_subscriber.rb +7 -1
  104. data/lib/action_dispatch/middleware/actionable_exceptions.rb +2 -0
  105. data/lib/action_dispatch/middleware/assume_ssl.rb +8 -5
  106. data/lib/action_dispatch/middleware/callbacks.rb +3 -1
  107. data/lib/action_dispatch/middleware/cookies.rb +125 -106
  108. data/lib/action_dispatch/middleware/debug_exceptions.rb +37 -8
  109. data/lib/action_dispatch/middleware/debug_locks.rb +15 -13
  110. data/lib/action_dispatch/middleware/debug_view.rb +13 -5
  111. data/lib/action_dispatch/middleware/exception_wrapper.rb +18 -23
  112. data/lib/action_dispatch/middleware/executor.rb +19 -4
  113. data/lib/action_dispatch/middleware/flash.rb +63 -51
  114. data/lib/action_dispatch/middleware/host_authorization.rb +17 -15
  115. data/lib/action_dispatch/middleware/public_exceptions.rb +14 -12
  116. data/lib/action_dispatch/middleware/reloader.rb +5 -3
  117. data/lib/action_dispatch/middleware/remote_ip.rb +87 -77
  118. data/lib/action_dispatch/middleware/request_id.rb +16 -10
  119. data/lib/action_dispatch/middleware/server_timing.rb +4 -2
  120. data/lib/action_dispatch/middleware/session/abstract_store.rb +2 -0
  121. data/lib/action_dispatch/middleware/session/cache_store.rb +30 -8
  122. data/lib/action_dispatch/middleware/session/cookie_store.rb +27 -26
  123. data/lib/action_dispatch/middleware/session/mem_cache_store.rb +7 -3
  124. data/lib/action_dispatch/middleware/show_exceptions.rb +16 -16
  125. data/lib/action_dispatch/middleware/ssl.rb +53 -40
  126. data/lib/action_dispatch/middleware/stack.rb +11 -10
  127. data/lib/action_dispatch/middleware/static.rb +33 -31
  128. data/lib/action_dispatch/middleware/templates/rescues/_copy_button.html.erb +1 -0
  129. data/lib/action_dispatch/middleware/templates/rescues/_source.html.erb +3 -5
  130. data/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb +9 -5
  131. data/lib/action_dispatch/middleware/templates/rescues/blocked_host.html.erb +1 -0
  132. data/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb +1 -0
  133. data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb +4 -0
  134. data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb +3 -0
  135. data/lib/action_dispatch/middleware/templates/rescues/layout.erb +50 -0
  136. data/lib/action_dispatch/middleware/templates/rescues/missing_exact_template.html.erb +1 -0
  137. data/lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb +1 -0
  138. data/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb +1 -0
  139. data/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +1 -0
  140. data/lib/action_dispatch/middleware/templates/rescues/unknown_action.html.erb +1 -0
  141. data/lib/action_dispatch/middleware/templates/routes/_table.html.erb +1 -1
  142. data/lib/action_dispatch/railtie.rb +23 -3
  143. data/lib/action_dispatch/request/session.rb +24 -21
  144. data/lib/action_dispatch/request/utils.rb +11 -3
  145. data/lib/action_dispatch/routing/endpoint.rb +2 -0
  146. data/lib/action_dispatch/routing/inspector.rb +85 -60
  147. data/lib/action_dispatch/routing/mapper.rb +1031 -851
  148. data/lib/action_dispatch/routing/polymorphic_routes.rb +69 -62
  149. data/lib/action_dispatch/routing/redirection.rb +47 -39
  150. data/lib/action_dispatch/routing/route_set.rb +79 -56
  151. data/lib/action_dispatch/routing/routes_proxy.rb +7 -4
  152. data/lib/action_dispatch/routing/url_for.rb +130 -125
  153. data/lib/action_dispatch/routing.rb +150 -148
  154. data/lib/action_dispatch/structured_event_subscriber.rb +20 -0
  155. data/lib/action_dispatch/system_test_case.rb +91 -81
  156. data/lib/action_dispatch/system_testing/browser.rb +16 -23
  157. data/lib/action_dispatch/system_testing/driver.rb +2 -0
  158. data/lib/action_dispatch/system_testing/server.rb +2 -0
  159. data/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb +34 -23
  160. data/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb +2 -0
  161. data/lib/action_dispatch/testing/assertion_response.rb +9 -7
  162. data/lib/action_dispatch/testing/assertions/response.rb +52 -25
  163. data/lib/action_dispatch/testing/assertions/routing.rb +168 -87
  164. data/lib/action_dispatch/testing/assertions.rb +2 -0
  165. data/lib/action_dispatch/testing/integration.rb +233 -223
  166. data/lib/action_dispatch/testing/request_encoder.rb +11 -9
  167. data/lib/action_dispatch/testing/test_helpers/page_dump_helper.rb +35 -0
  168. data/lib/action_dispatch/testing/test_process.rb +11 -8
  169. data/lib/action_dispatch/testing/test_request.rb +3 -1
  170. data/lib/action_dispatch/testing/test_response.rb +27 -26
  171. data/lib/action_dispatch.rb +36 -32
  172. data/lib/action_pack/gem_version.rb +6 -4
  173. data/lib/action_pack/version.rb +3 -1
  174. data/lib/action_pack.rb +17 -16
  175. metadata +35 -28
  176. data/lib/action_dispatch/journey/parser.y +0 -50
  177. data/lib/action_dispatch/journey/parser_extras.rb +0 -31
@@ -1,6 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :markup: markdown
4
+
3
5
  require "nokogiri"
6
+ require "action_dispatch/http/mime_type"
4
7
 
5
8
  module ActionDispatch
6
9
  class RequestEncoder # :nodoc:
@@ -13,9 +16,9 @@ module ActionDispatch
13
16
 
14
17
  @encoders = { identity: IdentityEncoder.new }
15
18
 
16
- attr_reader :response_parser
19
+ attr_reader :response_parser, :content_type
17
20
 
18
- def initialize(mime_name, param_encoder, response_parser)
21
+ def initialize(mime_name, param_encoder, response_parser, content_type)
19
22
  @mime = Mime[mime_name]
20
23
 
21
24
  unless @mime
@@ -25,10 +28,7 @@ module ActionDispatch
25
28
 
26
29
  @response_parser = response_parser || -> body { body }
27
30
  @param_encoder = param_encoder || :"to_#{@mime.symbol}".to_proc
28
- end
29
-
30
- def content_type
31
- @mime.to_s
31
+ @content_type = content_type || @mime.to_s
32
32
  end
33
33
 
34
34
  def accept_header
@@ -48,11 +48,13 @@ module ActionDispatch
48
48
  @encoders[name] || @encoders[:identity]
49
49
  end
50
50
 
51
- def self.register_encoder(mime_name, param_encoder: nil, response_parser: nil)
52
- @encoders[mime_name] = new(mime_name, param_encoder, response_parser)
51
+ def self.register_encoder(mime_name, param_encoder: nil, response_parser: nil, content_type: nil)
52
+ @encoders[mime_name] = new(mime_name, param_encoder, response_parser, content_type)
53
53
  end
54
54
 
55
- register_encoder :html, response_parser: -> body { Rails::Dom::Testing.html_document.parse(body) }
55
+ register_encoder :html, response_parser: -> body { Rails::Dom::Testing.html_document.parse(body) },
56
+ param_encoder: -> param { param },
57
+ content_type: Mime[:url_encoded_form].to_s
56
58
  register_encoder :json, response_parser: -> body { JSON.parse(body, object_class: ActiveSupport::HashWithIndifferentAccess) }
57
59
  end
58
60
  end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActionDispatch
4
+ module TestHelpers
5
+ module PageDumpHelper
6
+ class InvalidResponse < StandardError; end
7
+
8
+ # Saves the content of response body to a file and tries to open it in your browser.
9
+ # Launchy must be present in your Gemfile for the page to open automatically.
10
+ def save_and_open_page(path = html_dump_default_path)
11
+ save_page(path).tap { |s_path| open_file(s_path) }
12
+ end
13
+
14
+ private
15
+ def save_page(path = html_dump_default_path)
16
+ raise InvalidResponse.new("Response is a redirection!") if response.redirection?
17
+ path = Pathname.new(path)
18
+ path.dirname.mkpath
19
+ File.write(path, response.body)
20
+ path
21
+ end
22
+
23
+ def open_file(path)
24
+ require "launchy"
25
+ Launchy.open(path)
26
+ rescue LoadError
27
+ warn "File saved to #{path}.\nPlease install the launchy gem to open the file automatically."
28
+ end
29
+
30
+ def html_dump_default_path
31
+ Rails.root.join("tmp/html_dump", "#{method_name}_#{DateTime.current.to_i}.html").to_s
32
+ end
33
+ end
34
+ end
35
+ end
@@ -1,21 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :markup: markdown
4
+
3
5
  require "action_dispatch/middleware/cookies"
4
6
  require "action_dispatch/middleware/flash"
5
7
 
6
8
  module ActionDispatch
7
9
  module TestProcess
8
10
  module FixtureFile
9
- # Shortcut for <tt>Rack::Test::UploadedFile.new(File.join(ActionDispatch::IntegrationTest.file_fixture_path, path), type)</tt>:
11
+ # Shortcut for
12
+ # `Rack::Test::UploadedFile.new(File.join(ActionDispatch::IntegrationTest.file_fixture_path, path), type)`:
10
13
  #
11
- # post :change_avatar, params: { avatar: file_fixture_upload('david.png', 'image/png') }
14
+ # post :change_avatar, params: { avatar: file_fixture_upload('david.png', 'image/png') }
12
15
  #
13
- # Default fixture files location is <tt>test/fixtures/files</tt>.
16
+ # Default fixture files location is `test/fixtures/files`.
14
17
  #
15
- # To upload binary files on Windows, pass <tt>:binary</tt> as the last parameter.
16
- # This will not affect other platforms:
18
+ # To upload binary files on Windows, pass `:binary` as the last parameter. This
19
+ # will not affect other platforms:
17
20
  #
18
- # post :change_avatar, params: { avatar: file_fixture_upload('david.png', 'image/png', :binary) }
21
+ # post :change_avatar, params: { avatar: file_fixture_upload('david.png', 'image/png', :binary) }
19
22
  def file_fixture_upload(path, mime_type = nil, binary = false)
20
23
  if self.class.file_fixture_path && !File.exist?(path)
21
24
  path = file_fixture(path)
@@ -30,8 +33,8 @@ module ActionDispatch
30
33
 
31
34
  def assigns(key = nil)
32
35
  raise NoMethodError,
33
- "assigns has been extracted to a gem. To continue using it,
34
- add `gem 'rails-controller-testing'` to your Gemfile."
36
+ 'assigns has been extracted to a gem. To continue using it,
37
+ add `gem "rails-controller-testing"` to your Gemfile.'
35
38
  end
36
39
 
37
40
  def session
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :markup: markdown
4
+
3
5
  require "active_support/core_ext/hash/indifferent_access"
4
6
  require "rack/utils"
5
7
 
@@ -11,7 +13,7 @@ module ActionDispatch
11
13
  "HTTP_USER_AGENT" => "Rails Testing".b,
12
14
  )
13
15
 
14
- # Create a new test request with default +env+ values.
16
+ # Create a new test request with default `env` values.
15
17
  def self.create(env = {})
16
18
  env = Rails.application.env_config.merge(env) if defined?(Rails.application) && Rails.application
17
19
  env["rack.request.cookie_hash"] ||= {}.with_indifferent_access
@@ -1,12 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :markup: markdown
4
+
3
5
  require "action_dispatch/testing/request_encoder"
4
6
 
5
7
  module ActionDispatch
6
- # Integration test methods such as Integration::RequestHelpers#get
7
- # and Integration::RequestHelpers#post return objects of class
8
- # TestResponse, which represent the HTTP response results of the requested
9
- # controller actions.
8
+ # Integration test methods such as Integration::RequestHelpers#get and
9
+ # Integration::RequestHelpers#post return objects of class TestResponse, which
10
+ # represent the HTTP response results of the requested controller actions.
10
11
  #
11
12
  # See Response for more information on controller response objects.
12
13
  class TestResponse < Response
@@ -17,35 +18,35 @@ module ActionDispatch
17
18
  # Returns a parsed body depending on the response MIME type. When a parser
18
19
  # corresponding to the MIME type is not found, it returns the raw body.
19
20
  #
20
- # ==== Examples
21
- # get "/posts"
22
- # response.content_type # => "text/html; charset=utf-8"
23
- # response.parsed_body.class # => Nokogiri::HTML5::Document
24
- # response.parsed_body.to_html # => "<!DOCTYPE html>\n<html>\n..."
21
+ # #### Examples
22
+ # get "/posts"
23
+ # response.content_type # => "text/html; charset=utf-8"
24
+ # response.parsed_body.class # => Nokogiri::HTML5::Document
25
+ # response.parsed_body.to_html # => "<!DOCTYPE html>\n<html>\n..."
25
26
  #
26
- # assert_pattern { response.parsed_body.at("main") => { content: "Hello, world" } }
27
+ # assert_pattern { response.parsed_body.at("main") => { content: "Hello, world" } }
27
28
  #
28
- # response.parsed_body.at("main") => {name:, content:}
29
- # assert_equal "main", name
30
- # assert_equal "Some main content", content
29
+ # response.parsed_body.at("main") => {name:, content:}
30
+ # assert_equal "main", name
31
+ # assert_equal "Some main content", content
31
32
  #
32
- # get "/posts.json"
33
- # response.content_type # => "application/json; charset=utf-8"
34
- # response.parsed_body.class # => Array
35
- # response.parsed_body # => [{"id"=>42, "title"=>"Title"},...
33
+ # get "/posts.json"
34
+ # response.content_type # => "application/json; charset=utf-8"
35
+ # response.parsed_body.class # => Array
36
+ # response.parsed_body # => [{"id"=>42, "title"=>"Title"},...
36
37
  #
37
- # assert_pattern { response.parsed_body => [{ id: 42 }] }
38
+ # assert_pattern { response.parsed_body => [{ id: 42 }] }
38
39
  #
39
- # get "/posts/42.json"
40
- # response.content_type # => "application/json; charset=utf-8"
41
- # response.parsed_body.class # => ActiveSupport::HashWithIndifferentAccess
42
- # response.parsed_body # => {"id"=>42, "title"=>"Title"}
40
+ # get "/posts/42.json"
41
+ # response.content_type # => "application/json; charset=utf-8"
42
+ # response.parsed_body.class # => ActiveSupport::HashWithIndifferentAccess
43
+ # response.parsed_body # => {"id"=>42, "title"=>"Title"}
43
44
  #
44
- # assert_pattern { response.parsed_body => [{ title: /title/i }] }
45
+ # assert_pattern { response.parsed_body => [{ title: /title/i }] }
45
46
  #
46
- # response.parsed_body => {id:, title:}
47
- # assert_equal 42, id
48
- # assert_equal "Title", title
47
+ # response.parsed_body => {id:, title:}
48
+ # assert_equal 42, id
49
+ # assert_equal "Title", title
49
50
  def parsed_body
50
51
  @parsed_body ||= response_parser.call(body)
51
52
  end
@@ -3,67 +3,63 @@
3
3
  #--
4
4
  # Copyright (c) David Heinemeier Hansson
5
5
  #
6
- # Permission is hereby granted, free of charge, to any person obtaining
7
- # a copy of this software and associated documentation files (the
8
- # "Software"), to deal in the Software without restriction, including
9
- # without limitation the rights to use, copy, modify, merge, publish,
10
- # distribute, sublicense, and/or sell copies of the Software, and to
11
- # permit persons to whom the Software is furnished to do so, subject to
12
- # the following conditions:
6
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ # of this software and associated documentation files (the "Software"), to deal
8
+ # in the Software without restriction, including without limitation the rights
9
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ # copies of the Software, and to permit persons to whom the Software is
11
+ # furnished to do so, subject to the following conditions:
13
12
  #
14
- # The above copyright notice and this permission notice shall be
15
- # included in all copies or substantial portions of the Software.
13
+ # The above copyright notice and this permission notice shall be included in all
14
+ # copies or substantial portions of the Software.
16
15
  #
17
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
- # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
- # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ # SOFTWARE.
24
23
  #++
25
24
 
25
+ # :markup: markdown
26
+
26
27
  require "active_support"
27
28
  require "active_support/rails"
28
29
  require "active_support/core_ext/module/attribute_accessors"
29
30
 
30
31
  require "action_pack"
31
32
  require "rack"
32
- require "uri"
33
33
  require "action_dispatch/deprecator"
34
34
 
35
35
  module Rack # :nodoc:
36
36
  autoload :Test, "rack/test"
37
37
  end
38
38
 
39
- # = Action Dispatch
39
+ # # Action Dispatch
40
40
  #
41
41
  # Action Dispatch is a module of Action Pack.
42
42
  #
43
- # Action Dispatch parses information about the web request, handles
44
- # routing as defined by the user, and does advanced processing related to HTTP
45
- # such as MIME-type negotiation, decoding parameters in POST, PATCH, or PUT
46
- # bodies, handling HTTP caching logic, cookies and sessions.
43
+ # Action Dispatch parses information about the web request, handles routing as
44
+ # defined by the user, and does advanced processing related to HTTP such as
45
+ # MIME-type negotiation, decoding parameters in POST, PATCH, or PUT bodies,
46
+ # handling HTTP caching logic, cookies and sessions.
47
47
  module ActionDispatch
48
- include ActiveSupport::Deprecation::DeprecatedConstantAccessor
49
48
  extend ActiveSupport::Autoload
50
49
 
51
- class DeprecatedIllegalStateError < StandardError
52
- end
53
- deprecate_constant "IllegalStateError", "ActionDispatch::DeprecatedIllegalStateError",
54
- message: "ActionDispatch::IllegalStateError is deprecated without replacement.",
55
- deprecator: ActionDispatch.deprecator
56
-
57
- RFC2396_PARSER = defined?(URI::RFC2396_PARSER) ? URI::RFC2396_PARSER : URI::RFC2396_Parser.new
58
- private_constant :RFC2396_PARSER
59
-
60
50
  class MissingController < NameError
61
51
  end
62
52
 
63
53
  eager_autoload do
64
54
  autoload_under "http" do
65
55
  autoload :ContentSecurityPolicy
56
+ autoload :InvalidParameterError, "action_dispatch/http/param_error"
57
+ autoload :ParamBuilder
58
+ autoload :ParamError
59
+ autoload :ParameterTypeError, "action_dispatch/http/param_error"
60
+ autoload :ParamsTooDeepError, "action_dispatch/http/param_error"
66
61
  autoload :PermissionsPolicy
62
+ autoload :QueryParser
67
63
  autoload :Request
68
64
  autoload :Response
69
65
  end
@@ -142,6 +138,14 @@ module ActionDispatch
142
138
 
143
139
  autoload :SystemTestCase, "action_dispatch/system_test_case"
144
140
 
141
+ ##
142
+ # :singleton-method:
143
+ #
144
+ # Specifies if the methods calling redirects in controllers and routes should
145
+ # be logged below their relevant log lines. Defaults to false.
146
+ singleton_class.attr_accessor :verbose_redirect_logs
147
+ self.verbose_redirect_logs = false
148
+
145
149
  def eager_load!
146
150
  super
147
151
  Routing.eager_load!
@@ -1,16 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :markup: markdown
4
+
3
5
  module ActionPack
4
- # Returns the currently loaded version of Action Pack as a +Gem::Version+.
6
+ # Returns the currently loaded version of Action Pack as a `Gem::Version`.
5
7
  def self.gem_version
6
8
  Gem::Version.new VERSION::STRING
7
9
  end
8
10
 
9
11
  module VERSION
10
- MAJOR = 7
12
+ MAJOR = 8
11
13
  MINOR = 1
12
- TINY = 5
13
- PRE = "2"
14
+ TINY = 2
15
+ PRE = "1"
14
16
 
15
17
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
18
  end
@@ -1,9 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :markup: markdown
4
+
3
5
  require_relative "gem_version"
4
6
 
5
7
  module ActionPack
6
- # Returns the currently loaded version of Action Pack as a +Gem::Version+.
8
+ # Returns the currently loaded version of Action Pack as a `Gem::Version`.
7
9
  def self.version
8
10
  gem_version
9
11
  end
data/lib/action_pack.rb CHANGED
@@ -3,24 +3,25 @@
3
3
  #--
4
4
  # Copyright (c) David Heinemeier Hansson
5
5
  #
6
- # Permission is hereby granted, free of charge, to any person obtaining
7
- # a copy of this software and associated documentation files (the
8
- # "Software"), to deal in the Software without restriction, including
9
- # without limitation the rights to use, copy, modify, merge, publish,
10
- # distribute, sublicense, and/or sell copies of the Software, and to
11
- # permit persons to whom the Software is furnished to do so, subject to
12
- # the following conditions:
6
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ # of this software and associated documentation files (the "Software"), to deal
8
+ # in the Software without restriction, including without limitation the rights
9
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ # copies of the Software, and to permit persons to whom the Software is
11
+ # furnished to do so, subject to the following conditions:
13
12
  #
14
- # The above copyright notice and this permission notice shall be
15
- # included in all copies or substantial portions of the Software.
13
+ # The above copyright notice and this permission notice shall be included in all
14
+ # copies or substantial portions of the Software.
16
15
  #
17
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
- # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
- # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ # SOFTWARE.
24
23
  #++
25
24
 
25
+ # :markup: markdown
26
+
26
27
  require "action_pack/version"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.5.2
4
+ version: 8.1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 7.1.5.2
18
+ version: 8.1.2.1
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 7.1.5.2
25
+ version: 8.1.2.1
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: nokogiri
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -37,20 +37,6 @@ dependencies:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: 1.8.5
40
- - !ruby/object:Gem::Dependency
41
- name: racc
42
- requirement: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: '0'
47
- type: :runtime
48
- prerelease: false
49
- version_requirements: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
40
  - !ruby/object:Gem::Dependency
55
41
  name: rack
56
42
  requirement: !ruby/object:Gem::Requirement
@@ -121,34 +107,48 @@ dependencies:
121
107
  - - "~>"
122
108
  - !ruby/object:Gem::Version
123
109
  version: '2.2'
110
+ - !ruby/object:Gem::Dependency
111
+ name: useragent
112
+ requirement: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '0.16'
117
+ type: :runtime
118
+ prerelease: false
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '0.16'
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: actionview
126
126
  requirement: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - '='
129
129
  - !ruby/object:Gem::Version
130
- version: 7.1.5.2
130
+ version: 8.1.2.1
131
131
  type: :runtime
132
132
  prerelease: false
133
133
  version_requirements: !ruby/object:Gem::Requirement
134
134
  requirements:
135
135
  - - '='
136
136
  - !ruby/object:Gem::Version
137
- version: 7.1.5.2
137
+ version: 8.1.2.1
138
138
  - !ruby/object:Gem::Dependency
139
139
  name: activemodel
140
140
  requirement: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - '='
143
143
  - !ruby/object:Gem::Version
144
- version: 7.1.5.2
144
+ version: 8.1.2.1
145
145
  type: :development
146
146
  prerelease: false
147
147
  version_requirements: !ruby/object:Gem::Requirement
148
148
  requirements:
149
149
  - - '='
150
150
  - !ruby/object:Gem::Version
151
- version: 7.1.5.2
151
+ version: 8.1.2.1
152
152
  description: Web apps on Rails. Simple, battle-tested conventions for building and
153
153
  testing MVC web applications. Works with any Rack-compatible server.
154
154
  email: david@loudthinking.com
@@ -183,6 +183,7 @@ files:
183
183
  - lib/action_controller/form_builder.rb
184
184
  - lib/action_controller/log_subscriber.rb
185
185
  - lib/action_controller/metal.rb
186
+ - lib/action_controller/metal/allow_browser.rb
186
187
  - lib/action_controller/metal/basic_implicit_render.rb
187
188
  - lib/action_controller/metal/conditional_get.rb
188
189
  - lib/action_controller/metal/content_security_policy.rb
@@ -204,6 +205,7 @@ files:
204
205
  - lib/action_controller/metal/parameter_encoding.rb
205
206
  - lib/action_controller/metal/params_wrapper.rb
206
207
  - lib/action_controller/metal/permissions_policy.rb
208
+ - lib/action_controller/metal/rate_limiting.rb
207
209
  - lib/action_controller/metal/redirecting.rb
208
210
  - lib/action_controller/metal/renderers.rb
209
211
  - lib/action_controller/metal/rendering.rb
@@ -216,6 +218,7 @@ files:
216
218
  - lib/action_controller/railtie.rb
217
219
  - lib/action_controller/railties/helpers.rb
218
220
  - lib/action_controller/renderer.rb
221
+ - lib/action_controller/structured_event_subscriber.rb
219
222
  - lib/action_controller/template_assertions.rb
220
223
  - lib/action_controller/test_case.rb
221
224
  - lib/action_dispatch.rb
@@ -230,8 +233,11 @@ files:
230
233
  - lib/action_dispatch/http/mime_negotiation.rb
231
234
  - lib/action_dispatch/http/mime_type.rb
232
235
  - lib/action_dispatch/http/mime_types.rb
236
+ - lib/action_dispatch/http/param_builder.rb
237
+ - lib/action_dispatch/http/param_error.rb
233
238
  - lib/action_dispatch/http/parameters.rb
234
239
  - lib/action_dispatch/http/permissions_policy.rb
240
+ - lib/action_dispatch/http/query_parser.rb
235
241
  - lib/action_dispatch/http/rack_cache.rb
236
242
  - lib/action_dispatch/http/request.rb
237
243
  - lib/action_dispatch/http/response.rb
@@ -245,8 +251,6 @@ files:
245
251
  - lib/action_dispatch/journey/nfa/dot.rb
246
252
  - lib/action_dispatch/journey/nodes/node.rb
247
253
  - lib/action_dispatch/journey/parser.rb
248
- - lib/action_dispatch/journey/parser.y
249
- - lib/action_dispatch/journey/parser_extras.rb
250
254
  - lib/action_dispatch/journey/path/pattern.rb
251
255
  - lib/action_dispatch/journey/route.rb
252
256
  - lib/action_dispatch/journey/router.rb
@@ -284,6 +288,7 @@ files:
284
288
  - lib/action_dispatch/middleware/static.rb
285
289
  - lib/action_dispatch/middleware/templates/rescues/_actions.html.erb
286
290
  - lib/action_dispatch/middleware/templates/rescues/_actions.text.erb
291
+ - lib/action_dispatch/middleware/templates/rescues/_copy_button.html.erb
287
292
  - lib/action_dispatch/middleware/templates/rescues/_message_and_suggestions.html.erb
288
293
  - lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
289
294
  - lib/action_dispatch/middleware/templates/rescues/_request_and_response.text.erb
@@ -322,6 +327,7 @@ files:
322
327
  - lib/action_dispatch/routing/route_set.rb
323
328
  - lib/action_dispatch/routing/routes_proxy.rb
324
329
  - lib/action_dispatch/routing/url_for.rb
330
+ - lib/action_dispatch/structured_event_subscriber.rb
325
331
  - lib/action_dispatch/system_test_case.rb
326
332
  - lib/action_dispatch/system_testing/browser.rb
327
333
  - lib/action_dispatch/system_testing/driver.rb
@@ -334,6 +340,7 @@ files:
334
340
  - lib/action_dispatch/testing/assertions/routing.rb
335
341
  - lib/action_dispatch/testing/integration.rb
336
342
  - lib/action_dispatch/testing/request_encoder.rb
343
+ - lib/action_dispatch/testing/test_helpers/page_dump_helper.rb
337
344
  - lib/action_dispatch/testing/test_process.rb
338
345
  - lib/action_dispatch/testing/test_request.rb
339
346
  - lib/action_dispatch/testing/test_response.rb
@@ -345,10 +352,10 @@ licenses:
345
352
  - MIT
346
353
  metadata:
347
354
  bug_tracker_uri: https://github.com/rails/rails/issues
348
- changelog_uri: https://github.com/rails/rails/blob/v7.1.5.2/actionpack/CHANGELOG.md
349
- documentation_uri: https://api.rubyonrails.org/v7.1.5.2/
355
+ changelog_uri: https://github.com/rails/rails/blob/v8.1.2.1/actionpack/CHANGELOG.md
356
+ documentation_uri: https://api.rubyonrails.org/v8.1.2.1/
350
357
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
351
- source_code_uri: https://github.com/rails/rails/tree/v7.1.5.2/actionpack
358
+ source_code_uri: https://github.com/rails/rails/tree/v8.1.2.1/actionpack
352
359
  rubygems_mfa_required: 'true'
353
360
  rdoc_options: []
354
361
  require_paths:
@@ -357,7 +364,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
357
364
  requirements:
358
365
  - - ">="
359
366
  - !ruby/object:Gem::Version
360
- version: 2.7.0
367
+ version: 3.2.0
361
368
  required_rubygems_version: !ruby/object:Gem::Requirement
362
369
  requirements:
363
370
  - - ">="
@@ -365,7 +372,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
365
372
  version: '0'
366
373
  requirements:
367
374
  - none
368
- rubygems_version: 3.6.9
375
+ rubygems_version: 4.0.6
369
376
  specification_version: 4
370
377
  summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).
371
378
  test_files: []
@@ -1,50 +0,0 @@
1
- class ActionDispatch::Journey::Parser
2
- options no_result_var
3
- token SLASH LITERAL SYMBOL LPAREN RPAREN DOT STAR OR
4
-
5
- rule
6
- expressions
7
- : expression expressions { Cat.new(val.first, val.last) }
8
- | expression { val.first }
9
- | or
10
- ;
11
- expression
12
- : terminal
13
- | group
14
- | star
15
- ;
16
- group
17
- : LPAREN expressions RPAREN { Group.new(val[1]) }
18
- ;
19
- or
20
- : expression OR expression { Or.new([val.first, val.last]) }
21
- | expression OR or { Or.new([val.first, val.last]) }
22
- ;
23
- star
24
- : STAR { Star.new(Symbol.new(val.last, Symbol::GREEDY_EXP)) }
25
- ;
26
- terminal
27
- : symbol
28
- | literal
29
- | slash
30
- | dot
31
- ;
32
- slash
33
- : SLASH { Slash.new(val.first) }
34
- ;
35
- symbol
36
- : SYMBOL { Symbol.new(val.first) }
37
- ;
38
- literal
39
- : LITERAL { Literal.new(val.first) }
40
- ;
41
- dot
42
- : DOT { Dot.new(val.first) }
43
- ;
44
-
45
- end
46
-
47
- ---- header
48
- # :stopdoc:
49
-
50
- require "action_dispatch/journey/parser_extras"