actionpack 4.2.2 → 4.2.3.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionpack might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c1b9fd8b7fa33ccdadcb8ae1588c35d692339b13
4
- data.tar.gz: c5d0dd5f7d5dbf3350d5daba0df09d265f8d9204
3
+ metadata.gz: f657e8aa0b1e7d37a531dd67f65500889f60999c
4
+ data.tar.gz: 6804ce0b2869e278603ff9cbb63c0dcf1c587219
5
5
  SHA512:
6
- metadata.gz: 69275363448785182bbf4f5120f83cdeb856ac4569cce472b010c3b8b84f726dcf3e80a3b527961d7922baa64d6d2f89c165335740ef399e92accc09c8e22fae
7
- data.tar.gz: 75e1b804fb68e93e0def2b7ccd18c67084404c1a75f17d1c188db119646d5d67f06fc73bc571e59329c1126e6868e496e0e4ecb4983711067c150266774efb44
6
+ metadata.gz: b47635795e0d214430dd501e36f2e11c5aafcc285ae1232e7096936de3dd76ee64ccabab4971e5cdbc6e2404ac16d79795a8ef174e98a16809cb405eee8c2531
7
+ data.tar.gz: b38ecd9fc4064c2eb1649d93c22063a5709bfeb204616731c1b189477c685cdcfae3f6686eacd3a49a58d999eb10d9a8bef40d7da762ad558dee5330d2649280
@@ -1,9 +1,51 @@
1
+ ## Rails 4.2.3 (June 22, 2015) ##
2
+
3
+ * Fix rake routes not showing the right format when
4
+ nesting multiple routes.
5
+
6
+ See #18373.
7
+
8
+ *Ravil Bayramgalin*
9
+
10
+ * Fix regression where a gzip file response would have a Content-type,
11
+ even when it was a 304 status code.
12
+
13
+ See #19271.
14
+
15
+ *Kohei Suzuki*
16
+
17
+ * Fix handling of empty X_FORWARDED_HOST header in raw_host_with_port
18
+
19
+ Previously, an empty X_FORWARDED_HOST header would cause
20
+ Actiondispatch::Http:URL.raw_host_with_port to return nil, causing
21
+ Actiondispatch::Http:URL.host to raise a NoMethodError.
22
+
23
+ *Adam Forsyth*
24
+
25
+ * Fallback to `ENV['RAILS_RELATIVE_URL_ROOT']` in `url_for`.
26
+
27
+ Fixed an issue where the `RAILS_RELATIVE_URL_ROOT` environment variable is not
28
+ prepended to the path when `url_for` is called. If `SCRIPT_NAME` (used by Rack)
29
+ is set, it takes precedence.
30
+
31
+ Fixes #5122.
32
+
33
+ *Yasyf Mohamedali*
34
+
35
+ * Fix regression in functional tests. Responses should have default headers
36
+ assigned.
37
+
38
+ See #18423.
39
+
40
+ *Jeremy Kemper*, *Yves Senn*
41
+
42
+
1
43
  ## Rails 4.2.2 (June 16, 2015) ##
2
44
 
3
45
  * No Changes *
4
46
 
5
47
 
6
- ## Rails 4.2.1 (March 19, 2014) ##
48
+ ## Rails 4.2.1 (March 19, 2015) ##
7
49
 
8
50
  * Non-string authenticity tokens do not raise NoMethodError when decoding
9
51
  the masked token.
@@ -24,11 +24,13 @@ module ActionController
24
24
  end
25
25
  end
26
26
 
27
- # Raised when a supplied parameter is not expected.
27
+ # Raised when a supplied parameter is not expected and
28
+ # ActionController::Parameters.action_on_unpermitted_parameters
29
+ # is set to <tt>:raise</tt>.
28
30
  #
29
31
  # params = ActionController::Parameters.new(a: "123", b: "456")
30
32
  # params.permit(:c)
31
- # # => ActionController::UnpermittedParameters: found unexpected keys: a, b
33
+ # # => ActionController::UnpermittedParameters: found unpermitted parameters: a, b
32
34
  class UnpermittedParameters < IndexError
33
35
  attr_reader :params # :nodoc:
34
36
 
@@ -115,10 +115,11 @@ module ActionDispatch # :nodoc:
115
115
  # The underlying body, as a streamable object.
116
116
  attr_reader :stream
117
117
 
118
- def initialize(status = 200, header = {}, body = [])
118
+ def initialize(status = 200, header = {}, body = [], options = {})
119
119
  super()
120
120
 
121
- header = merge_default_headers(header, self.class.default_headers)
121
+ default_headers = options.fetch(:default_headers, self.class.default_headers)
122
+ header = merge_default_headers(header, default_headers)
122
123
 
123
124
  self.body, self.header, self.status = body, header, status
124
125
 
@@ -324,9 +325,7 @@ module ActionDispatch # :nodoc:
324
325
  end
325
326
 
326
327
  def merge_default_headers(original, default)
327
- return original unless default.respond_to?(:merge)
328
-
329
- default.merge(original)
328
+ default.respond_to?(:merge) ? default.merge(original) : original
330
329
  end
331
330
 
332
331
  def build_buffer(response, body)
@@ -184,7 +184,7 @@ module ActionDispatch
184
184
 
185
185
  # Returns the \host for this request, such as "example.com".
186
186
  def raw_host_with_port
187
- if forwarded = env["HTTP_X_FORWARDED_HOST"]
187
+ if forwarded = env["HTTP_X_FORWARDED_HOST"].presence
188
188
  forwarded.split(/,\s?/).last
189
189
  else
190
190
  env['HTTP_HOST'] || "#{env['SERVER_NAME'] || env['SERVER_ADDR']}:#{env['SERVER_PORT']}"
@@ -40,7 +40,7 @@ module ActionDispatch
40
40
  return [route.format(parameterized_parts), params]
41
41
  end
42
42
 
43
- message = "No route matches #{Hash[constraints.sort].inspect}"
43
+ message = "No route matches #{Hash[constraints.sort_by{|k,v| k.to_s}].inspect}"
44
44
  message << " missing required keys: #{missing_keys.sort.inspect}" unless missing_keys.empty?
45
45
 
46
46
  raise ActionController::UrlGenerationError, message
@@ -36,7 +36,7 @@ module ActionDispatch
36
36
 
37
37
  def requirements # :nodoc:
38
38
  # needed for rails `rake routes`
39
- path.requirements.merge(@defaults).delete_if { |_,v|
39
+ @defaults.merge(path.requirements).delete_if { |_,v|
40
40
  /.+?/ == v
41
41
  }
42
42
  end
@@ -121,7 +121,6 @@ module ActionDispatch
121
121
  end
122
122
 
123
123
  def match_head_routes(routes, req)
124
- routes.delete_if { |route| route.verb == // }
125
124
  head_routes = match_routes(routes, req)
126
125
 
127
126
  if head_routes.empty?
@@ -15,6 +15,10 @@ module ActionDispatch
15
15
  @simulator = nil
16
16
  end
17
17
 
18
+ def empty?
19
+ routes.empty?
20
+ end
21
+
18
22
  def length
19
23
  routes.length
20
24
  end
@@ -181,7 +181,7 @@ module ActionDispatch
181
181
  # to the Message{Encryptor,Verifier} allows us to handle the
182
182
  # (de)serialization step within the cookie jar, which gives us the
183
183
  # opportunity to detect and migrate legacy cookies.
184
- module VerifyAndUpgradeLegacySignedMessage
184
+ module VerifyAndUpgradeLegacySignedMessage # :nodoc:
185
185
  def initialize(*args)
186
186
  super
187
187
  @legacy_verifier = ActiveSupport::MessageVerifier.new(@options[:secret_token], serializer: ActiveSupport::MessageEncryptor::NullSerializer)
@@ -392,7 +392,7 @@ module ActionDispatch
392
392
  end
393
393
  end
394
394
 
395
- class JsonSerializer
395
+ class JsonSerializer # :nodoc:
396
396
  def self.load(value)
397
397
  ActiveSupport::JSON.decode(value)
398
398
  end
@@ -402,7 +402,7 @@ module ActionDispatch
402
402
  end
403
403
  end
404
404
 
405
- module SerializedCookieJars
405
+ module SerializedCookieJars # :nodoc:
406
406
  MARSHAL_SIGNATURE = "\x04\x08".freeze
407
407
 
408
408
  protected
@@ -29,7 +29,7 @@ module ActionDispatch
29
29
  }
30
30
 
31
31
  if match = paths.detect { |p|
32
- path = File.join(@root, p)
32
+ path = File.join(@root, p.force_encoding('UTF-8'))
33
33
  begin
34
34
  File.file?(path) && File.readable?(path)
35
35
  rescue SystemCallError
@@ -48,6 +48,9 @@ module ActionDispatch
48
48
  if gzip_path && gzip_encoding_accepted?(env)
49
49
  env['PATH_INFO'] = gzip_path
50
50
  status, headers, body = @file_server.call(env)
51
+ if status == 304
52
+ return [status, headers, body]
53
+ end
51
54
  headers['Content-Encoding'] = 'gzip'
52
55
  headers['Content-Type'] = content_type(path)
53
56
  else
@@ -40,6 +40,8 @@ module ActionDispatch
40
40
  ActionDispatch::Cookies::CookieJar.always_write_cookie = config.action_dispatch.always_write_cookie
41
41
 
42
42
  ActionDispatch.test_app = app
43
+
44
+ ActionDispatch::Routing::RouteSet.relative_url_root = app.config.relative_url_root
43
45
  end
44
46
  end
45
47
  end
@@ -291,7 +291,7 @@ module ActionDispatch
291
291
  when String
292
292
  ActiveSupport::Deprecation.warn(<<-MSG.squish)
293
293
  Defining a route where `to` is a controller without an action is deprecated.
294
- Please change `to: :#{to}` to `controller: :#{to}`.
294
+ Please change `to: '#{to}'` to `controller: '#{to}'`.
295
295
  MSG
296
296
 
297
297
  [to, nil]
@@ -21,6 +21,8 @@ module ActionDispatch
21
21
  # alias inspect to to_s.
22
22
  alias inspect to_s
23
23
 
24
+ mattr_accessor :relative_url_root
25
+
24
26
  class Dispatcher < Routing::Endpoint
25
27
  def initialize(defaults)
26
28
  @defaults = defaults
@@ -252,7 +254,7 @@ module ActionDispatch
252
254
  end
253
255
 
254
256
  def raise_generation_error(args, missing_keys)
255
- constraints = Hash[@route.requirements.merge(args).sort]
257
+ constraints = Hash[@route.requirements.merge(args).sort_by{|k,v| k.to_s}]
256
258
  message = "No route matches #{constraints.inspect}"
257
259
  message << " missing required keys: #{missing_keys.sort.inspect}"
258
260
 
@@ -768,7 +770,7 @@ module ActionDispatch
768
770
  end
769
771
 
770
772
  def find_script_name(options)
771
- options.delete(:script_name) || ''
773
+ options.delete(:script_name) || relative_url_root || ''
772
774
  end
773
775
 
774
776
  def path_for(options, route_name = nil)
@@ -12,7 +12,7 @@ module ActionDispatch
12
12
  include Rails::Dom::Testing::Assertions
13
13
 
14
14
  def html_document
15
- @html_document ||= if @response.content_type =~ /xml$/
15
+ @html_document ||= if @response.content_type === Mime::XML
16
16
  Nokogiri::XML::Document.parse(@response.body)
17
17
  else
18
18
  Nokogiri::HTML::Document.parse(@response.body)
@@ -299,7 +299,7 @@ module ActionDispatch
299
299
  @request_count += 1
300
300
  @request = ActionDispatch::Request.new(session.last_request.env)
301
301
  response = _mock_session.last_response
302
- @response = ActionDispatch::TestResponse.new(response.status, response.headers, response.body)
302
+ @response = ActionDispatch::TestResponse.from_response(response)
303
303
  @html_document = nil
304
304
  @url_options = nil
305
305
 
@@ -7,11 +7,7 @@ module ActionDispatch
7
7
  # See Response for more information on controller response objects.
8
8
  class TestResponse < Response
9
9
  def self.from_response(response)
10
- new.tap do |resp|
11
- resp.status = response.status
12
- resp.headers = response.headers
13
- resp.body = response.body
14
- end
10
+ new response.status, response.headers, response.body, default_headers: nil
15
11
  end
16
12
 
17
13
  # Was the response successful?
@@ -25,12 +21,5 @@ module ActionDispatch
25
21
 
26
22
  # Was there a server-side error?
27
23
  alias_method :error?, :server_error?
28
-
29
- def merge_default_headers(original, *args)
30
- # Default headers are already applied, no need to merge them a second time.
31
- # This makes sure that default headers, removed in controller actions, will
32
- # not be reapplied to the test response.
33
- original
34
- end
35
24
  end
36
25
  end
@@ -7,8 +7,8 @@ module ActionPack
7
7
  module VERSION
8
8
  MAJOR = 4
9
9
  MINOR = 2
10
- TINY = 2
11
- PRE = nil
10
+ TINY = 3
11
+ PRE = "rc1"
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
14
14
  end
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.2.2
4
+ version: 4.2.3.rc1
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: 2015-06-16 00:00:00.000000000 Z
11
+ date: 2015-06-22 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: 4.2.2
19
+ version: 4.2.3.rc1
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: 4.2.2
26
+ version: 4.2.3.rc1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rack
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -61,7 +61,7 @@ dependencies:
61
61
  version: '1.0'
62
62
  - - ">="
63
63
  - !ruby/object:Gem::Version
64
- version: 1.0.1
64
+ version: 1.0.2
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
@@ -71,7 +71,7 @@ dependencies:
71
71
  version: '1.0'
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
- version: 1.0.1
74
+ version: 1.0.2
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: rails-dom-testing
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -98,28 +98,28 @@ dependencies:
98
98
  requirements:
99
99
  - - '='
100
100
  - !ruby/object:Gem::Version
101
- version: 4.2.2
101
+ version: 4.2.3.rc1
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - '='
107
107
  - !ruby/object:Gem::Version
108
- version: 4.2.2
108
+ version: 4.2.3.rc1
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: activemodel
111
111
  requirement: !ruby/object:Gem::Requirement
112
112
  requirements:
113
113
  - - '='
114
114
  - !ruby/object:Gem::Version
115
- version: 4.2.2
115
+ version: 4.2.3.rc1
116
116
  type: :development
117
117
  prerelease: false
118
118
  version_requirements: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - '='
121
121
  - !ruby/object:Gem::Version
122
- version: 4.2.2
122
+ version: 4.2.3.rc1
123
123
  description: Web apps on Rails. Simple, battle-tested conventions for building and
124
124
  testing MVC web applications. Works with any Rack-compatible server.
125
125
  email: david@loudthinking.com
@@ -294,9 +294,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
294
294
  version: 1.9.3
295
295
  required_rubygems_version: !ruby/object:Gem::Requirement
296
296
  requirements:
297
- - - ">="
297
+ - - ">"
298
298
  - !ruby/object:Gem::Version
299
- version: '0'
299
+ version: 1.3.1
300
300
  requirements:
301
301
  - none
302
302
  rubyforge_project: