Changeset 7724
- Timestamp:
- 10/03/07 05:47:41 (1 year ago)
- Files:
-
- trunk/actionpack/CHANGELOG (modified) (1 diff)
- trunk/actionpack/lib/action_controller/base.rb (modified) (1 diff)
- trunk/actionpack/lib/action_controller/integration.rb (modified) (1 diff)
- trunk/actionpack/lib/action_controller/routing.rb (modified) (5 diffs)
- trunk/actionpack/test/controller/resources_test.rb (modified) (1 diff)
- trunk/actionpack/test/controller/routing_test.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r7722 r7724 1 1 *SVN* 2 3 * Move ActionController::Routing.optimise_named_routes to ActionController::Base.optimise_named_routes. Now you can set it in the config. [Rick] 4 5 config.action_controller.optimise_named_routes = false 6 7 * ActionController::Routing::DynamicSegment#interpolation_chunk should call #to_s on all values before calling URI.escape. [Rick] 2 8 3 9 * Only accept session ids from cookies, prevents session fixation attacks. [bradediger] trunk/actionpack/lib/action_controller/base.rb
r7719 r7724 330 330 # Sets the token parameter name for RequestForgery. Calling #protect_from_forgery sets it to :authenticity_token by default 331 331 cattr_accessor :request_forgery_protection_token 332 332 333 # Indicates whether or not optimise the generated named 334 # route helper methods 335 cattr_accessor :optimise_named_routes 336 self.optimise_named_routes = true 337 333 338 # Controls whether request forgergy protection is turned on or not. Turned off by default only in test mode. 334 339 class_inheritable_accessor :allow_forgery_protection trunk/actionpack/lib/action_controller/integration.rb
r7719 r7724 77 77 # But we have to disable the optimisation code so that we can 78 78 # generate routes without @request being initialized 79 Routing.optimise_named_routes=false79 Base.optimise_named_routes=false 80 80 Routing::Routes.reload! 81 81 klass = class<<self; self; end trunk/actionpack/lib/action_controller/routing.rb
r7719 r7724 256 256 mattr_accessor :controller_paths 257 257 self.controller_paths = [] 258 259 # Indicates whether or not optimise the generated named260 # route helper methods261 mattr_accessor :optimise_named_routes262 self.optimise_named_routes = true263 258 264 259 # A helper module to hold URL related helpers. … … 343 338 # version of the named routes methods. 344 339 def optimise? 345 @optimise && ActionController:: Routing::optimise_named_routes340 @optimise && ActionController::Base::optimise_named_routes 346 341 end 347 342 … … 719 714 end 720 715 721 def interpolation_chunk(value_code = "#{local_name} .to_s")722 "\#{URI.escape(#{value_code} , ActionController::Routing::Segment::UNSAFE_PCHAR)}"716 def interpolation_chunk(value_code = "#{local_name}") 717 "\#{URI.escape(#{value_code}.to_s, ActionController::Routing::Segment::UNSAFE_PCHAR)}" 723 718 end 724 719 … … 777 772 778 773 # Don't URI.escape the controller name since it may contain slashes. 779 def interpolation_chunk(value_code = "#{local_name} .to_s")780 "\#{#{value_code} }"774 def interpolation_chunk(value_code = "#{local_name}") 775 "\#{#{value_code}.to_s}" 781 776 end 782 777 … … 800 795 UNSAFE_PCHAR = Regexp.new("[^#{URI::REGEXP::PATTERN::UNRESERVED}#{RESERVED_PCHAR}]", false, 'N').freeze 801 796 802 def interpolation_chunk(value_code = "#{local_name} .to_s")803 "\#{URI.escape(#{value_code} , ActionController::Routing::PathSegment::UNSAFE_PCHAR)}"797 def interpolation_chunk(value_code = "#{local_name}") 798 "\#{URI.escape(#{value_code}.to_s, ActionController::Routing::PathSegment::UNSAFE_PCHAR)}" 804 799 end 805 800 trunk/actionpack/test/controller/resources_test.rb
r7447 r7724 34 34 # optimisation. This could indicate user level problems 35 35 def setup 36 ActionController:: Routing.optimise_named_routes = false36 ActionController::Base.optimise_named_routes = false 37 37 end 38 38 39 39 def tear_down 40 ActionController:: Routing.optimise_named_routes = true40 ActionController::Base.optimise_named_routes = true 41 41 end 42 42 trunk/actionpack/test/controller/routing_test.rb
r7673 r7724 49 49 def setup 50 50 # These tests assume optimisation is on, so re-enable it. 51 ActionController:: Routing.optimise_named_routes = true51 ActionController::Base.optimise_named_routes = true 52 52 53 53 @rs = ::ActionController::Routing::RouteSet.new … … 853 853 end 854 854 855 def test_interpolation_chunk_should_accept_nil 856 a_value = nil 857 assert_equal '', eval(%("#{segment.interpolation_chunk('a_value')}")) 858 end 859 855 860 def test_value_regexp_should_be_nil_without_regexp 856 861 assert_equal nil, segment.value_regexp