Skip to content

Commit 6335f5d

Browse files
committed
Merge branch 'master' into bodyparts
2 parents 70e3dfb + dc88847 commit 6335f5d

File tree

104 files changed

+2238
-1203
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+2238
-1203
lines changed

actionmailer/CHANGELOG

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
*2.3.1 [RC2] (March 5, 2009)*
1+
*2.3.2 [Final] (March 15, 2009)*
22

33
* Fixed that ActionMailer should send correctly formatted Return-Path in MAIL FROM for SMTP #1842 [Matt Jones]
44

5-
6-
*2.3.0 [RC1] (February 1st, 2009)*
7-
85
* Fixed RFC-2045 quoted-printable bug #1421 [squadette]
96

107
* Fixed that no body charset would be set when there are attachments present #740 [Paweł Kondzior]

actionmailer/Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ spec = Gem::Specification.new do |s|
5555
s.rubyforge_project = "actionmailer"
5656
s.homepage = "http://www.rubyonrails.org"
5757

58-
s.add_dependency('actionpack', '= 2.3.1' + PKG_BUILD)
58+
s.add_dependency('actionpack', '= 2.3.2' + PKG_BUILD)
5959

6060
s.has_rdoc = true
6161
s.requirements << 'none'

actionmailer/lib/action_mailer/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module ActionMailer
22
module VERSION #:nodoc:
33
MAJOR = 2
44
MINOR = 3
5-
TINY = 1
5+
TINY = 2
66

77
STRING = [MAJOR, MINOR, TINY].join('.')
88
end

actionpack/CHANGELOG

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*2.3.1 [RC2] (March 5, 2009)*
1+
*2.3.2 [Final] (March 15, 2009)*
22

33
* Fixed that redirection would just log the options, not the final url (which lead to "Redirected to #<Post:0x23150b8>") [DHH]
44

@@ -14,9 +14,6 @@
1414

1515
* Added localized rescue template when I18n.locale is set (ex: public/404.da.html) #1835 [José Valim]
1616

17-
18-
*2.3.0 [RC1] (February 1st, 2009)*
19-
2017
* Make the form_for and fields_for helpers support the new Active Record nested update options. #1202 [Eloy Duran]
2118

2219
<% form_for @person do |person_form| %>

actionpack/Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ spec = Gem::Specification.new do |s|
8080
s.has_rdoc = true
8181
s.requirements << 'none'
8282

83-
s.add_dependency('activesupport', '= 2.3.1' + PKG_BUILD)
83+
s.add_dependency('activesupport', '= 2.3.2' + PKG_BUILD)
8484

8585
s.require_path = 'lib'
8686
s.autorequire = 'action_controller'

actionpack/lib/action_controller/integration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
module ActionController
66
module Integration #:nodoc:
77
# An integration Session instance represents a set of requests and responses
8-
# performed sequentially by some virtual user. Becase you can instantiate
8+
# performed sequentially by some virtual user. Because you can instantiate
99
# multiple sessions and run them side-by-side, you can also mimic (to some
1010
# limited extent) multiple simultaneous users interacting with your system.
1111
#

actionpack/lib/action_controller/resources.rb

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ def map_member_actions(map, resource)
630630
action_path = resource.options[:path_names][action] if resource.options[:path_names].is_a?(Hash)
631631
action_path ||= Base.resources_path_names[action] || action
632632

633-
map_resource_routes(map, resource, action, "#{resource.member_path}#{resource.action_separator}#{action_path}", "#{action}_#{resource.shallow_name_prefix}#{resource.singular}", m)
633+
map_resource_routes(map, resource, action, "#{resource.member_path}#{resource.action_separator}#{action_path}", "#{action}_#{resource.shallow_name_prefix}#{resource.singular}", m, { :force_id => true })
634634
end
635635
end
636636
end
@@ -641,9 +641,9 @@ def map_member_actions(map, resource)
641641
map_resource_routes(map, resource, :destroy, resource.member_path, route_path)
642642
end
643643

644-
def map_resource_routes(map, resource, action, route_path, route_name = nil, method = nil)
644+
def map_resource_routes(map, resource, action, route_path, route_name = nil, method = nil, resource_options = {} )
645645
if resource.has_action?(action)
646-
action_options = action_options_for(action, resource, method)
646+
action_options = action_options_for(action, resource, method, resource_options)
647647
formatted_route_path = "#{route_path}.:format"
648648

649649
if route_name && @set.named_routes[route_name.to_sym].nil?
@@ -660,22 +660,18 @@ def add_conditions_for(conditions, method)
660660
end
661661
end
662662

663-
def action_options_for(action, resource, method = nil)
663+
def action_options_for(action, resource, method = nil, resource_options = {})
664664
default_options = { :action => action.to_s }
665665
require_id = !resource.kind_of?(SingletonResource)
666+
force_id = resource_options[:force_id] && !resource.kind_of?(SingletonResource)
666667

667668
case default_options[:action]
668669
when "index", "new"; default_options.merge(add_conditions_for(resource.conditions, method || :get)).merge(resource.requirements)
669670
when "create"; default_options.merge(add_conditions_for(resource.conditions, method || :post)).merge(resource.requirements)
670671
when "show", "edit"; default_options.merge(add_conditions_for(resource.conditions, method || :get)).merge(resource.requirements(require_id))
671672
when "update"; default_options.merge(add_conditions_for(resource.conditions, method || :put)).merge(resource.requirements(require_id))
672673
when "destroy"; default_options.merge(add_conditions_for(resource.conditions, method || :delete)).merge(resource.requirements(require_id))
673-
else
674-
if method.nil? || resource.member_methods.nil? || resource.member_methods[method.to_sym].nil?
675-
default_options.merge(add_conditions_for(resource.conditions, method)).merge(resource.requirements)
676-
else
677-
resource.member_methods[method.to_sym].include?(action) ? default_options.merge(add_conditions_for(resource.conditions, method)).merge(resource.requirements(require_id)) : default_options.merge(add_conditions_for(resource.conditions, method)).merge(resource.requirements)
678-
end
674+
else default_options.merge(add_conditions_for(resource.conditions, method)).merge(resource.requirements(force_id))
679675
end
680676
end
681677
end

actionpack/lib/action_controller/vendor/rack-1.0/rack.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ def self.version
2323

2424
# Return the Rack release as a dotted string.
2525
def self.release
26-
"0.4"
26+
"1.0 bundled"
2727
end
2828

2929
autoload :Builder, "rack/builder"
3030
autoload :Cascade, "rack/cascade"
31+
autoload :Chunked, "rack/chunked"
3132
autoload :CommonLogger, "rack/commonlogger"
3233
autoload :ConditionalGet, "rack/conditionalget"
3334
autoload :ContentLength, "rack/content_length"
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
require 'rack/utils'
2+
3+
module Rack
4+
5+
# Middleware that applies chunked transfer encoding to response bodies
6+
# when the response does not include a Content-Length header.
7+
class Chunked
8+
include Rack::Utils
9+
10+
def initialize(app)
11+
@app = app
12+
end
13+
14+
def call(env)
15+
status, headers, body = @app.call(env)
16+
headers = HeaderHash.new(headers)
17+
18+
if env['HTTP_VERSION'] == 'HTTP/1.0' ||
19+
STATUS_WITH_NO_ENTITY_BODY.include?(status) ||
20+
headers['Content-Length'] ||
21+
headers['Transfer-Encoding']
22+
[status, headers.to_hash, body]
23+
else
24+
dup.chunk(status, headers, body)
25+
end
26+
end
27+
28+
def chunk(status, headers, body)
29+
@body = body
30+
headers.delete('Content-Length')
31+
headers['Transfer-Encoding'] = 'chunked'
32+
[status, headers.to_hash, self]
33+
end
34+
35+
def each
36+
term = "\r\n"
37+
@body.each do |chunk|
38+
size = bytesize(chunk)
39+
next if size == 0
40+
yield [size.to_s(16), term, chunk, term].join
41+
end
42+
yield ["0", term, "", term].join
43+
end
44+
45+
def close
46+
@body.close if @body.respond_to?(:close)
47+
end
48+
end
49+
end

actionpack/lib/action_controller/vendor/rack-1.0/rack/file.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def serving
6060
body = self
6161
else
6262
body = [F.read(@path)]
63-
size = body.first.size
63+
size = Utils.bytesize(body.first)
6464
end
6565

6666
[200, {

actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/cgi.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require 'rack/content_length'
2+
13
module Rack
24
module Handler
35
class CGI
@@ -6,6 +8,8 @@ def self.run(app, options=nil)
68
end
79

810
def self.serve(app)
11+
app = ContentLength.new(app)
12+
913
env = ENV.to_hash
1014
env.delete "HTTP_CONTENT_LENGTH"
1115

actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/fastcgi.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require 'fcgi'
22
require 'socket'
3+
require 'rack/content_length'
34

45
module Rack
56
module Handler
@@ -29,6 +30,8 @@ def read(*args)
2930
end
3031

3132
def self.serve(request, app)
33+
app = Rack::ContentLength.new(app)
34+
3235
env = request.env
3336
env.delete "HTTP_CONTENT_LENGTH"
3437

actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/lsws.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require 'lsapi'
2-
#require 'cgi'
2+
require 'rack/content_length'
3+
34
module Rack
45
module Handler
56
class LSWS
@@ -9,6 +10,8 @@ def self.run(app, options=nil)
910
end
1011
end
1112
def self.serve(app)
13+
app = Rack::ContentLength.new(app)
14+
1215
env = ENV.to_hash
1316
env.delete "HTTP_CONTENT_LENGTH"
1417
env["SCRIPT_NAME"] = "" if env["SCRIPT_NAME"] == "/"

actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/mongrel.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
require 'mongrel'
22
require 'stringio'
3+
require 'rack/content_length'
4+
require 'rack/chunked'
35

46
module Rack
57
module Handler
@@ -33,7 +35,7 @@ def self.run(app, options={})
3335
end
3436

3537
def initialize(app)
36-
@app = app
38+
@app = Rack::Chunked.new(Rack::ContentLength.new(app))
3739
end
3840

3941
def process(request, response)

actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/scgi.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
require 'scgi'
22
require 'stringio'
3+
require 'rack/content_length'
4+
require 'rack/chunked'
35

46
module Rack
57
module Handler
@@ -14,7 +16,7 @@ def self.run(app, options=nil)
1416
end
1517

1618
def initialize(settings = {})
17-
@app = settings[:app]
19+
@app = Rack::Chunked.new(Rack::ContentLength.new(settings[:app]))
1820
@log = Object.new
1921
def @log.info(*args); end
2022
def @log.error(*args); end

actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/thin.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
require "thin"
2+
require "rack/content_length"
3+
require "rack/chunked"
24

35
module Rack
46
module Handler
57
class Thin
68
def self.run(app, options={})
9+
app = Rack::Chunked.new(Rack::ContentLength.new(app))
710
server = ::Thin::Server.new(options[:Host] || '0.0.0.0',
811
options[:Port] || 8080,
912
app)

actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/webrick.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require 'webrick'
22
require 'stringio'
3+
require 'rack/content_length'
34

45
module Rack
56
module Handler
@@ -14,7 +15,7 @@ def self.run(app, options={})
1415

1516
def initialize(server, app)
1617
super server
17-
@app = app
18+
@app = Rack::ContentLength.new(app)
1819
end
1920

2021
def service(req, res)

actionpack/lib/action_controller/vendor/rack-1.0/rack/lint.rb

Lines changed: 19 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -374,59 +374,43 @@ def check_content_type(status, headers)
374374

375375
## === The Content-Length
376376
def check_content_length(status, headers, env)
377-
chunked_response = false
378-
headers.each { |key, value|
379-
if key.downcase == 'transfer-encoding'
380-
chunked_response = value.downcase != 'identity'
381-
end
382-
}
383-
384377
headers.each { |key, value|
385378
if key.downcase == 'content-length'
386-
## There must be a <tt>Content-Length</tt>, except when the
387-
## +Status+ is 1xx, 204 or 304, in which case there must be none
388-
## given.
379+
## There must not be a <tt>Content-Length</tt> header when the
380+
## +Status+ is 1xx, 204 or 304.
389381
assert("Content-Length header found in #{status} response, not allowed") {
390382
not Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.include? status.to_i
391383
}
392384

393-
assert('Content-Length header should not be used if body is chunked') {
394-
not chunked_response
395-
}
396-
397385
bytes = 0
398386
string_body = true
399387

400-
@body.each { |part|
401-
unless part.kind_of?(String)
402-
string_body = false
403-
break
404-
end
388+
if @body.respond_to?(:to_ary)
389+
@body.each { |part|
390+
unless part.kind_of?(String)
391+
string_body = false
392+
break
393+
end
405394

406-
bytes += Rack::Utils.bytesize(part)
407-
}
408-
409-
if env["REQUEST_METHOD"] == "HEAD"
410-
assert("Response body was given for HEAD request, but should be empty") {
411-
bytes == 0
395+
bytes += Rack::Utils.bytesize(part)
412396
}
413-
else
414-
if string_body
415-
assert("Content-Length header was #{value}, but should be #{bytes}") {
416-
value == bytes.to_s
397+
398+
if env["REQUEST_METHOD"] == "HEAD"
399+
assert("Response body was given for HEAD request, but should be empty") {
400+
bytes == 0
417401
}
402+
else
403+
if string_body
404+
assert("Content-Length header was #{value}, but should be #{bytes}") {
405+
value == bytes.to_s
406+
}
407+
end
418408
end
419409
end
420410

421411
return
422412
end
423413
}
424-
425-
if [ String, Array ].include?(@body.class) && !chunked_response
426-
assert('No Content-Length header found') {
427-
Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.include? status.to_i
428-
}
429-
end
430414
end
431415

432416
## === The Body

actionpack/lib/action_controller/vendor/rack-1.0/rack/urlmap.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ module Rack
1212
# first, since they are most specific.
1313

1414
class URLMap
15-
def initialize(map)
15+
def initialize(map = {})
16+
remap(map)
17+
end
18+
19+
def remap(map)
1620
@mapping = map.map { |location, app|
1721
if location =~ %r{\Ahttps?://(.*?)(/.*)}
1822
host, location = $1, $2

actionpack/lib/action_controller/vendor/rack-1.0/rack/utils.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ def self.parse_multipart(env)
372372
data = body
373373
end
374374

375-
Utils.normalize_params(params, name, data)
375+
Utils.normalize_params(params, name, data) unless data.nil?
376376

377377
break if buf.empty? || content_length == -1
378378
}

0 commit comments

Comments
 (0)