actionpack 1.13.2 → 1.13.3

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.

data/CHANGELOG CHANGED
@@ -1,3 +1,12 @@
1
+ *1.13.3* (March 12th, 2007)
2
+
3
+ * Apply [5709] to stable.
4
+
5
+ * session_enabled? works with session :off. #6680 [Catfish]
6
+
7
+ * Performance: patch cgi/session to require digest/md5 once rather than per #create_new_id. [Stefan Kaes]
8
+
9
+
1
10
  *1.13.2* (February 5th, 2007)
2
11
 
3
12
  * Add much-needed html-scanner tests. Fixed CDATA parsing bug. [Rick]
@@ -10,8 +19,6 @@
10
19
 
11
20
  * Add singleton resources from trunk [Rick Olson]
12
21
 
13
- * TestSession supports indifferent access so session['foo'] == session[:foo] in your tests. #7372 [julik, jean.helou]
14
-
15
22
  * select :multiple => true suffixes the attribute name with [] unless already suffixed. #6977 [nik.kakelin, ben, julik]
16
23
 
17
24
  * Improve routes documentation. #7095 [zackchandler]
data/Rakefile CHANGED
@@ -75,7 +75,7 @@ spec = Gem::Specification.new do |s|
75
75
  s.has_rdoc = true
76
76
  s.requirements << 'none'
77
77
 
78
- s.add_dependency('activesupport', '= 1.4.1' + PKG_BUILD)
78
+ s.add_dependency('activesupport', '= 1.4.2' + PKG_BUILD)
79
79
 
80
80
  s.require_path = 'lib'
81
81
  s.autorequire = 'action_controller'
@@ -144,11 +144,11 @@ end
144
144
 
145
145
  desc "Publish the release files to RubyForge."
146
146
  task :release => [ :package ] do
147
- `rubyforge login`
147
+ require 'rubyforge'
148
148
 
149
- for ext in %w( gem tgz zip )
150
- release_command = "rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}"
151
- puts release_command
152
- system(release_command)
153
- end
154
- end
149
+ packages = %w( gem tgz zip ).collect{ |ext| "pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" }
150
+
151
+ rubyforge = RubyForge.new
152
+ rubyforge.login
153
+ rubyforge.add_release(PKG_NAME, PKG_NAME, "REL #{PKG_VERSION}", *packages)
154
+ end
@@ -539,7 +539,7 @@ module ActionController #:nodoc:
539
539
  end
540
540
 
541
541
  def session_enabled?
542
- request.session_options[:disabled] != false
542
+ request.session_options && request.session_options[:disabled] != false
543
543
  end
544
544
 
545
545
  protected
@@ -0,0 +1,30 @@
1
+ # CGI::Session#create_new_id requires 'digest/md5' on every call. This makes
2
+ # sense when spawning processes per request, but is unnecessarily expensive
3
+ # when serving requests from a long-lived process.
4
+ #
5
+ # http://railsexpress.de/blog/articles/2005/11/22/speeding-up-the-creation-of-new-sessions
6
+ require 'cgi/session'
7
+ require 'digest/md5'
8
+
9
+ class CGI
10
+ class Session #:nodoc:
11
+ private
12
+ # Create a new session id.
13
+ #
14
+ # The session id is an MD5 hash based upon the time,
15
+ # a random number, and a constant string. This routine
16
+ # is used internally for automatically generated
17
+ # session ids.
18
+ def create_new_id
19
+ md5 = Digest::MD5::new
20
+ now = Time::now
21
+ md5.update(now.to_s)
22
+ md5.update(String(now.usec))
23
+ md5.update(String(rand(0)))
24
+ md5.update(String($$))
25
+ md5.update('foobar')
26
+ @new_session = true
27
+ md5.hexdigest
28
+ end
29
+ end
30
+ end
@@ -1,6 +1,7 @@
1
1
  require 'action_controller/cgi_ext/cgi_ext'
2
2
  require 'action_controller/cgi_ext/cookie_performance_fix'
3
3
  require 'action_controller/cgi_ext/raw_post_data_fix'
4
+ require 'action_controller/cgi_ext/session_performance_fix'
4
5
 
5
6
  module ActionController #:nodoc:
6
7
  class Base
@@ -344,10 +344,10 @@ module ActionController
344
344
  # the query string. (Never use keys from the recalled request when building the
345
345
  # query string.)
346
346
 
347
- method_decl = "def generate(#{args})\npath, hash = generate_raw(options, hash, expire_on)\nappend_query_string(path, hash, extra_keys(hash, expire_on))\nend"
347
+ method_decl = "def generate(#{args})\npath, hash = generate_raw(options, hash, expire_on)\nappend_query_string(path, hash, extra_keys(options))\nend"
348
348
  instance_eval method_decl, "generated code (#{__FILE__}:#{__LINE__})"
349
349
 
350
- method_decl = "def generate_extras(#{args})\npath, hash = generate_raw(options, hash, expire_on)\n[path, extra_keys(hash, expire_on)]\nend"
350
+ method_decl = "def generate_extras(#{args})\npath, hash = generate_raw(options, hash, expire_on)\n[path, extra_keys(options)]\nend"
351
351
  instance_eval method_decl, "generated code (#{__FILE__}:#{__LINE__})"
352
352
  raw_method
353
353
  end
@@ -1238,7 +1238,7 @@ module ActionController
1238
1238
  # drop the leading '/' on the controller name
1239
1239
  options[:controller] = options[:controller][1..-1] if options[:controller] && options[:controller][0] == ?/
1240
1240
  merged = recall.merge(options)
1241
-
1241
+
1242
1242
  if named_route
1243
1243
  path = named_route.generate(options, merged, expire_on)
1244
1244
  if path.nil?
@@ -288,11 +288,11 @@ module ActionController #:nodoc:
288
288
  end
289
289
 
290
290
  def [](key)
291
- data[key.to_s]
291
+ data[key]
292
292
  end
293
293
 
294
294
  def []=(key, value)
295
- data[key.to_s] = value
295
+ data[key] = value
296
296
  end
297
297
 
298
298
  def update
@@ -2,7 +2,7 @@ module ActionPack #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 13
5
- TINY = 2
5
+ TINY = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -1717,6 +1717,17 @@ class RouteSetTest < Test::Unit::TestCase
1717
1717
  )
1718
1718
  end
1719
1719
 
1720
+ def test_query_params_will_be_shown_when_recalled
1721
+ set.draw do |map|
1722
+ map.connect 'show_post/:parameter', :controller => 'post', :action => 'show'
1723
+ map.connect ':controller/:action/:id'
1724
+ end
1725
+ assert_equal '/post/edit?parameter=1', set.generate(
1726
+ {:action => 'edit', :parameter => 1},
1727
+ {:controller => 'post', :action => 'show', :parameter => 1}
1728
+ )
1729
+ end
1730
+
1720
1731
  end
1721
1732
 
1722
1733
  class RoutingTest < Test::Unit::TestCase
@@ -142,4 +142,15 @@ class SessionManagementTest < Test::Unit::TestCase
142
142
  get :tell
143
143
  assert_equal "does not have cached associations", @response.body
144
144
  end
145
+
146
+ def test_session_is_enabled
147
+ @controller = TestController.new
148
+ get :show
149
+ assert_nothing_raised do
150
+ assert_equal false, @controller.session_enabled?
151
+ end
152
+
153
+ get :tell
154
+ assert @controller.session_enabled?
155
+ end
145
156
  end
@@ -8,12 +8,6 @@ class TestTest < Test::Unit::TestCase
8
8
  render :text => 'ignore me'
9
9
  end
10
10
 
11
- def set_session
12
- session['string'] = 'A wonder'
13
- session[:symbol] = 'it works'
14
- render :text => 'Success'
15
- end
16
-
17
11
  def render_raw_post
18
12
  raise Test::Unit::AssertionFailedError, "#raw_post is blank" if request.raw_post.blank?
19
13
  render :text => request.raw_post
@@ -117,14 +111,6 @@ HTML
117
111
  assert_equal '>value<', flash['test']
118
112
  end
119
113
 
120
- def test_process_with_session
121
- process :set_session
122
- assert_equal 'A wonder', session['string'], "A value stored in the session should be available by string key"
123
- assert_equal 'A wonder', session[:string], "Test session hash should allow indifferent access"
124
- assert_equal 'it works', session['symbol'], "Test session hash should allow indifferent access"
125
- assert_equal 'it works', session[:symbol], "Test session hash should allow indifferent access"
126
- end
127
-
128
114
  def test_process_with_request_uri_with_no_params
129
115
  process :test_uri
130
116
  assert_equal "/test_test/test/test_uri", @response.body
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.0
2
+ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: actionpack
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.13.2
7
- date: 2007-02-05 00:00:00 -06:00
6
+ version: 1.13.3
7
+ date: 2007-03-13 00:00:00 -05:00
8
8
  summary: Web-flow and rendering framework putting the VC in MVC.
9
9
  require_paths:
10
10
  - lib
@@ -89,6 +89,7 @@ files:
89
89
  - lib/action_controller/cgi_ext/cgi_methods.rb
90
90
  - lib/action_controller/cgi_ext/cookie_performance_fix.rb
91
91
  - lib/action_controller/cgi_ext/raw_post_data_fix.rb
92
+ - lib/action_controller/cgi_ext/session_performance_fix.rb
92
93
  - lib/action_controller/macros/auto_complete.rb
93
94
  - lib/action_controller/macros/in_place_editing.rb
94
95
  - lib/action_controller/session/active_record_store.rb
@@ -375,5 +376,5 @@ dependencies:
375
376
  requirements:
376
377
  - - "="
377
378
  - !ruby/object:Gem::Version
378
- version: 1.4.1
379
+ version: 1.4.2
379
380
  version: