actionpack 7.2.1.1 → 8.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +86 -115
- data/lib/action_controller/api.rb +1 -0
- data/lib/action_controller/metal/conditional_get.rb +6 -3
- data/lib/action_controller/metal/http_authentication.rb +6 -3
- data/lib/action_controller/metal/instrumentation.rb +1 -2
- data/lib/action_controller/metal/live.rb +19 -8
- data/lib/action_controller/metal/rate_limiting.rb +13 -4
- data/lib/action_controller/metal/renderers.rb +2 -1
- data/lib/action_controller/metal/streaming.rb +5 -84
- data/lib/action_controller/metal/strong_parameters.rb +274 -73
- data/lib/action_controller/railtie.rb +1 -1
- data/lib/action_controller/test_case.rb +4 -3
- data/lib/action_dispatch/http/cache.rb +27 -10
- data/lib/action_dispatch/http/content_security_policy.rb +1 -0
- data/lib/action_dispatch/http/filter_parameters.rb +4 -9
- data/lib/action_dispatch/http/filter_redirect.rb +2 -9
- data/lib/action_dispatch/http/permissions_policy.rb +2 -0
- data/lib/action_dispatch/http/request.rb +4 -2
- data/lib/action_dispatch/journey/parser.rb +99 -196
- data/lib/action_dispatch/journey/scanner.rb +40 -42
- data/lib/action_dispatch/middleware/cookies.rb +4 -2
- data/lib/action_dispatch/middleware/debug_exceptions.rb +16 -3
- data/lib/action_dispatch/middleware/remote_ip.rb +5 -6
- data/lib/action_dispatch/middleware/request_id.rb +2 -1
- data/lib/action_dispatch/middleware/ssl.rb +14 -4
- data/lib/action_dispatch/railtie.rb +2 -0
- data/lib/action_dispatch/routing/inspector.rb +1 -1
- data/lib/action_dispatch/routing/mapper.rb +26 -17
- data/lib/action_dispatch/routing/route_set.rb +18 -6
- data/lib/action_dispatch/system_testing/browser.rb +12 -21
- data/lib/action_pack/gem_version.rb +4 -4
- metadata +12 -34
- data/lib/action_dispatch/journey/parser.y +0 -50
- data/lib/action_dispatch/journey/parser_extras.rb +0 -33
@@ -470,7 +470,6 @@ module ActionDispatch
|
|
470
470
|
# When a pattern points to an internal route, the route's `:action` and
|
471
471
|
# `:controller` should be set in options or hash shorthand. Examples:
|
472
472
|
#
|
473
|
-
# match 'photos/:id' => 'photos#show', via: :get
|
474
473
|
# match 'photos/:id', to: 'photos#show', via: :get
|
475
474
|
# match 'photos/:id', controller: 'photos', action: 'show', via: :get
|
476
475
|
#
|
@@ -614,10 +613,6 @@ module ActionDispatch
|
|
614
613
|
#
|
615
614
|
# mount SomeRackApp, at: "some_route"
|
616
615
|
#
|
617
|
-
# Alternatively:
|
618
|
-
#
|
619
|
-
# mount(SomeRackApp => "some_route")
|
620
|
-
#
|
621
616
|
# For options, see `match`, as `mount` uses it internally.
|
622
617
|
#
|
623
618
|
# All mounted applications come with routing helpers to access them. These are
|
@@ -625,7 +620,7 @@ module ActionDispatch
|
|
625
620
|
# `some_rack_app_path` or `some_rack_app_url`. To customize this helper's name,
|
626
621
|
# use the `:as` option:
|
627
622
|
#
|
628
|
-
# mount(SomeRackApp
|
623
|
+
# mount(SomeRackApp, at: "some_route", as: "exciting")
|
629
624
|
#
|
630
625
|
# This will generate the `exciting_path` and `exciting_url` helpers which can be
|
631
626
|
# used to navigate to this mounted app.
|
@@ -773,6 +768,16 @@ module ActionDispatch
|
|
773
768
|
map_method(:options, args, &block)
|
774
769
|
end
|
775
770
|
|
771
|
+
# Define a route that recognizes HTTP CONNECT (and GET) requests. More
|
772
|
+
# specifically this recognizes HTTP/1 protocol upgrade requests and HTTP/2
|
773
|
+
# CONNECT requests with the protocol pseudo header. For supported arguments,
|
774
|
+
# see [match](rdoc-ref:Base#match)
|
775
|
+
#
|
776
|
+
# connect 'live', to: 'live#index'
|
777
|
+
def connect(*args, &block)
|
778
|
+
map_method([:get, :connect], args, &block)
|
779
|
+
end
|
780
|
+
|
776
781
|
private
|
777
782
|
def map_method(method, args, &block)
|
778
783
|
options = args.extract_options!
|
@@ -1048,6 +1053,7 @@ module ActionDispatch
|
|
1048
1053
|
end
|
1049
1054
|
|
1050
1055
|
# Allows you to set default parameters for a route, such as this:
|
1056
|
+
#
|
1051
1057
|
# defaults id: 'home' do
|
1052
1058
|
# match 'scoped_pages/(:id)', to: 'pages#show'
|
1053
1059
|
# end
|
@@ -1672,7 +1678,6 @@ module ActionDispatch
|
|
1672
1678
|
# Matches a URL pattern to one or more routes. For more information, see
|
1673
1679
|
# [match](rdoc-ref:Base#match).
|
1674
1680
|
#
|
1675
|
-
# match 'path' => 'controller#action', via: :patch
|
1676
1681
|
# match 'path', to: 'controller#action', via: :post
|
1677
1682
|
# match 'path', 'otherpath', on: :member, via: :get
|
1678
1683
|
def match(path, *rest, &block)
|
@@ -1934,6 +1939,11 @@ module ActionDispatch
|
|
1934
1939
|
end
|
1935
1940
|
|
1936
1941
|
def map_match(paths, options)
|
1942
|
+
ActionDispatch.deprecator.warn(<<-MSG.squish) if paths.count > 1
|
1943
|
+
Mapping a route with multiple paths is deprecated and
|
1944
|
+
will be removed in Rails 8.1. Please use multiple method calls instead.
|
1945
|
+
MSG
|
1946
|
+
|
1937
1947
|
if (on = options[:on]) && !VALID_ON_OPTIONS.include?(on)
|
1938
1948
|
raise ArgumentError, "Unknown scope #{on.inspect} given to :on"
|
1939
1949
|
end
|
@@ -2024,7 +2034,7 @@ module ActionDispatch
|
|
2024
2034
|
name_for_action(options.delete(:as), action)
|
2025
2035
|
end
|
2026
2036
|
|
2027
|
-
path = Mapping.normalize_path URI::
|
2037
|
+
path = Mapping.normalize_path URI::RFC2396_PARSER.escape(path), formatted
|
2028
2038
|
ast = Journey::Parser.parse path
|
2029
2039
|
|
2030
2040
|
mapping = Mapping.build(@scope, @set, ast, controller, default_action, to, via, formatted, options_constraints, anchor, options)
|
@@ -2266,9 +2276,9 @@ module ActionDispatch
|
|
2266
2276
|
|
2267
2277
|
attr_reader :parent, :scope_level
|
2268
2278
|
|
2269
|
-
def initialize(hash, parent =
|
2270
|
-
@hash = hash
|
2279
|
+
def initialize(hash, parent = ROOT, scope_level = nil)
|
2271
2280
|
@parent = parent
|
2281
|
+
@hash = parent ? parent.frame.merge(hash) : hash
|
2272
2282
|
@scope_level = scope_level
|
2273
2283
|
end
|
2274
2284
|
|
@@ -2281,7 +2291,7 @@ module ActionDispatch
|
|
2281
2291
|
end
|
2282
2292
|
|
2283
2293
|
def root?
|
2284
|
-
@parent
|
2294
|
+
@parent == ROOT
|
2285
2295
|
end
|
2286
2296
|
|
2287
2297
|
def resources?
|
@@ -2326,23 +2336,22 @@ module ActionDispatch
|
|
2326
2336
|
end
|
2327
2337
|
|
2328
2338
|
def [](key)
|
2329
|
-
|
2330
|
-
scope && scope.frame[key]
|
2339
|
+
frame[key]
|
2331
2340
|
end
|
2332
2341
|
|
2342
|
+
def frame; @hash; end
|
2343
|
+
|
2333
2344
|
include Enumerable
|
2334
2345
|
|
2335
2346
|
def each
|
2336
2347
|
node = self
|
2337
|
-
until node.equal?
|
2348
|
+
until node.equal? ROOT
|
2338
2349
|
yield node
|
2339
2350
|
node = node.parent
|
2340
2351
|
end
|
2341
2352
|
end
|
2342
2353
|
|
2343
|
-
|
2344
|
-
|
2345
|
-
NULL = Scope.new(nil, nil)
|
2354
|
+
ROOT = Scope.new({}, nil)
|
2346
2355
|
end
|
2347
2356
|
|
2348
2357
|
def initialize(set) # :nodoc:
|
@@ -351,7 +351,7 @@ module ActionDispatch
|
|
351
351
|
PATH = ->(options) { ActionDispatch::Http::URL.path_for(options) }
|
352
352
|
UNKNOWN = ->(options) { ActionDispatch::Http::URL.url_for(options) }
|
353
353
|
|
354
|
-
attr_accessor :formatter, :set, :named_routes, :
|
354
|
+
attr_accessor :formatter, :set, :named_routes, :router
|
355
355
|
attr_accessor :disable_clear_and_finalize, :resources_path_names
|
356
356
|
attr_accessor :default_url_options, :draw_paths
|
357
357
|
attr_reader :env_key, :polymorphic_mappings
|
@@ -363,7 +363,7 @@ module ActionDispatch
|
|
363
363
|
end
|
364
364
|
|
365
365
|
def self.new_with_config(config)
|
366
|
-
route_set_config = DEFAULT_CONFIG
|
366
|
+
route_set_config = DEFAULT_CONFIG.dup
|
367
367
|
|
368
368
|
# engines apparently don't have this set
|
369
369
|
if config.respond_to? :relative_url_root
|
@@ -374,14 +374,18 @@ module ActionDispatch
|
|
374
374
|
route_set_config.api_only = config.api_only
|
375
375
|
end
|
376
376
|
|
377
|
+
if config.respond_to? :default_scope
|
378
|
+
route_set_config.default_scope = config.default_scope
|
379
|
+
end
|
380
|
+
|
377
381
|
new route_set_config
|
378
382
|
end
|
379
383
|
|
380
|
-
Config = Struct.new :relative_url_root, :api_only
|
384
|
+
Config = Struct.new :relative_url_root, :api_only, :default_scope
|
381
385
|
|
382
|
-
DEFAULT_CONFIG = Config.new(nil, false)
|
386
|
+
DEFAULT_CONFIG = Config.new(nil, false, nil)
|
383
387
|
|
384
|
-
def initialize(config = DEFAULT_CONFIG)
|
388
|
+
def initialize(config = DEFAULT_CONFIG.dup)
|
385
389
|
self.named_routes = NamedRouteCollection.new
|
386
390
|
self.resources_path_names = self.class.default_resources_path_names
|
387
391
|
self.default_url_options = {}
|
@@ -416,6 +420,14 @@ module ActionDispatch
|
|
416
420
|
@config.api_only
|
417
421
|
end
|
418
422
|
|
423
|
+
def default_scope
|
424
|
+
@config.default_scope
|
425
|
+
end
|
426
|
+
|
427
|
+
def default_scope=(new_default_scope)
|
428
|
+
@config.default_scope = new_default_scope
|
429
|
+
end
|
430
|
+
|
419
431
|
def request_class
|
420
432
|
ActionDispatch::Request
|
421
433
|
end
|
@@ -917,7 +929,7 @@ module ActionDispatch
|
|
917
929
|
params.each do |key, value|
|
918
930
|
if value.is_a?(String)
|
919
931
|
value = value.dup.force_encoding(Encoding::BINARY)
|
920
|
-
params[key] = URI::
|
932
|
+
params[key] = URI::RFC2396_PARSER.unescape(value)
|
921
933
|
end
|
922
934
|
end
|
923
935
|
req.path_parameters = params
|
@@ -9,7 +9,6 @@ module ActionDispatch
|
|
9
9
|
|
10
10
|
def initialize(name)
|
11
11
|
@name = name
|
12
|
-
set_default_options
|
13
12
|
end
|
14
13
|
|
15
14
|
def type
|
@@ -27,9 +26,9 @@ module ActionDispatch
|
|
27
26
|
@options ||=
|
28
27
|
case type
|
29
28
|
when :chrome
|
30
|
-
|
29
|
+
default_chrome_options
|
31
30
|
when :firefox
|
32
|
-
|
31
|
+
default_firefox_options
|
33
32
|
end
|
34
33
|
end
|
35
34
|
|
@@ -49,26 +48,18 @@ module ActionDispatch
|
|
49
48
|
end
|
50
49
|
|
51
50
|
private
|
52
|
-
def
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
end
|
51
|
+
def default_chrome_options
|
52
|
+
options = ::Selenium::WebDriver::Chrome::Options.new
|
53
|
+
options.add_argument("--disable-search-engine-choice-screen")
|
54
|
+
options.add_argument("--headless") if name == :headless_chrome
|
55
|
+
options.add_argument("--disable-gpu") if Gem.win_platform?
|
56
|
+
options
|
59
57
|
end
|
60
58
|
|
61
|
-
def
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def set_headless_firefox_browser_options
|
69
|
-
configure do |capabilities|
|
70
|
-
capabilities.add_argument("-headless")
|
71
|
-
end
|
59
|
+
def default_firefox_options
|
60
|
+
options = ::Selenium::WebDriver::Firefox::Options.new
|
61
|
+
options.add_argument("-headless") if name == :headless_firefox
|
62
|
+
options
|
72
63
|
end
|
73
64
|
|
74
65
|
def resolve_driver_path(namespace)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actionpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 8.0.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 8.0.0.beta1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 8.0.0.beta1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: nokogiri
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.8.5
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: racc
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: rack
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,9 +45,6 @@ dependencies:
|
|
59
45
|
- - ">="
|
60
46
|
- !ruby/object:Gem::Version
|
61
47
|
version: 2.2.4
|
62
|
-
- - "<"
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
version: '3.2'
|
65
48
|
type: :runtime
|
66
49
|
prerelease: false
|
67
50
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -69,9 +52,6 @@ dependencies:
|
|
69
52
|
- - ">="
|
70
53
|
- !ruby/object:Gem::Version
|
71
54
|
version: 2.2.4
|
72
|
-
- - "<"
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: '3.2'
|
75
55
|
- !ruby/object:Gem::Dependency
|
76
56
|
name: rack-session
|
77
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,28 +128,28 @@ dependencies:
|
|
148
128
|
requirements:
|
149
129
|
- - '='
|
150
130
|
- !ruby/object:Gem::Version
|
151
|
-
version:
|
131
|
+
version: 8.0.0.beta1
|
152
132
|
type: :runtime
|
153
133
|
prerelease: false
|
154
134
|
version_requirements: !ruby/object:Gem::Requirement
|
155
135
|
requirements:
|
156
136
|
- - '='
|
157
137
|
- !ruby/object:Gem::Version
|
158
|
-
version:
|
138
|
+
version: 8.0.0.beta1
|
159
139
|
- !ruby/object:Gem::Dependency
|
160
140
|
name: activemodel
|
161
141
|
requirement: !ruby/object:Gem::Requirement
|
162
142
|
requirements:
|
163
143
|
- - '='
|
164
144
|
- !ruby/object:Gem::Version
|
165
|
-
version:
|
145
|
+
version: 8.0.0.beta1
|
166
146
|
type: :development
|
167
147
|
prerelease: false
|
168
148
|
version_requirements: !ruby/object:Gem::Requirement
|
169
149
|
requirements:
|
170
150
|
- - '='
|
171
151
|
- !ruby/object:Gem::Version
|
172
|
-
version:
|
152
|
+
version: 8.0.0.beta1
|
173
153
|
description: Web apps on Rails. Simple, battle-tested conventions for building and
|
174
154
|
testing MVC web applications. Works with any Rack-compatible server.
|
175
155
|
email: david@loudthinking.com
|
@@ -268,8 +248,6 @@ files:
|
|
268
248
|
- lib/action_dispatch/journey/nfa/dot.rb
|
269
249
|
- lib/action_dispatch/journey/nodes/node.rb
|
270
250
|
- lib/action_dispatch/journey/parser.rb
|
271
|
-
- lib/action_dispatch/journey/parser.y
|
272
|
-
- lib/action_dispatch/journey/parser_extras.rb
|
273
251
|
- lib/action_dispatch/journey/path/pattern.rb
|
274
252
|
- lib/action_dispatch/journey/route.rb
|
275
253
|
- lib/action_dispatch/journey/router.rb
|
@@ -369,10 +347,10 @@ licenses:
|
|
369
347
|
- MIT
|
370
348
|
metadata:
|
371
349
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
372
|
-
changelog_uri: https://github.com/rails/rails/blob/
|
373
|
-
documentation_uri: https://api.rubyonrails.org/
|
350
|
+
changelog_uri: https://github.com/rails/rails/blob/v8.0.0.beta1/actionpack/CHANGELOG.md
|
351
|
+
documentation_uri: https://api.rubyonrails.org/v8.0.0.beta1/
|
374
352
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
375
|
-
source_code_uri: https://github.com/rails/rails/tree/
|
353
|
+
source_code_uri: https://github.com/rails/rails/tree/v8.0.0.beta1/actionpack
|
376
354
|
rubygems_mfa_required: 'true'
|
377
355
|
post_install_message:
|
378
356
|
rdoc_options: []
|
@@ -382,7 +360,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
382
360
|
requirements:
|
383
361
|
- - ">="
|
384
362
|
- !ruby/object:Gem::Version
|
385
|
-
version: 3.
|
363
|
+
version: 3.2.0
|
386
364
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
387
365
|
requirements:
|
388
366
|
- - ">="
|
@@ -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"
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# :markup: markdown
|
4
|
-
|
5
|
-
require "action_dispatch/journey/scanner"
|
6
|
-
require "action_dispatch/journey/nodes/node"
|
7
|
-
|
8
|
-
module ActionDispatch
|
9
|
-
# :stopdoc:
|
10
|
-
module Journey
|
11
|
-
class Parser < Racc::Parser
|
12
|
-
include Journey::Nodes
|
13
|
-
|
14
|
-
def self.parse(string)
|
15
|
-
new.parse string
|
16
|
-
end
|
17
|
-
|
18
|
-
def initialize
|
19
|
-
@scanner = Scanner.new
|
20
|
-
end
|
21
|
-
|
22
|
-
def parse(string)
|
23
|
-
@scanner.scan_setup(string)
|
24
|
-
do_parse
|
25
|
-
end
|
26
|
-
|
27
|
-
def next_token
|
28
|
-
@scanner.next_token
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
# :startdoc:
|
33
|
-
end
|