From ef30cc22df7f482e4968aba6a0cd3a185ebcd278 Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Sun, 5 Sep 2010 15:24:15 -0500 Subject: [PATCH] Update to Rails 2.3.9 and itextomml 1.3.27 --- test/unit/page_renderer_test.rb | 4 +- .../lib/form_tag_helper_extensions.rb | 2 +- vendor/rails/actionmailer/CHANGELOG | 5 +- vendor/rails/actionmailer/Rakefile | 2 +- .../actionmailer/lib/action_mailer/base.rb | 2 +- .../actionmailer/lib/action_mailer/helpers.rb | 2 +- .../actionmailer/lib/action_mailer/version.rb | 2 +- vendor/rails/actionpack/CHANGELOG | 5 + vendor/rails/actionpack/Rakefile | 2 +- .../action_controller/caching/fragments.rb | 2 +- .../lib/action_controller/integration.rb | 21 +- .../lib/action_controller/request.rb | 4 +- .../lib/action_controller/rescue.rb | 4 +- .../lib/action_controller/resources.rb | 2 +- .../lib/action_controller/routing.rb | 2 +- .../lib/action_controller/routing/route.rb | 6 +- .../session/abstract_store.rb | 206 +++++++++++----- .../action_controller/session/cookie_store.rb | 67 +++-- .../session/mem_cache_store.rb | 9 + .../lib/action_controller/test_process.rb | 2 +- .../lib/action_controller/url_rewriter.rb | 10 +- .../actionpack/lib/action_pack/version.rb | 2 +- .../lib/action_view/helpers/form_helper.rb | 6 +- .../helpers/form_options_helper.rb | 2 +- .../action_view/helpers/form_tag_helper.rb | 2 +- .../action_view/helpers/prototype_helper.rb | 6 +- .../lib/action_view/helpers/text_helper.rb | 44 ++-- .../actionpack/lib/action_view/locale/en.yml | 28 +-- .../actionpack/lib/action_view/template.rb | 4 +- vendor/rails/actionpack/test/abstract_unit.rb | 17 ++ .../activerecord/active_record_store_test.rb | 77 ++++-- .../test/controller/integration_test.rb | 26 ++ .../request/multipart_params_parsing_test.rb | 15 ++ .../actionpack/test/controller/rescue_test.rb | 11 +- .../controller/session/cookie_store_test.rb | 82 ++++++- .../session/mem_cache_store_test.rb | 67 ++++- .../test/controller/url_rewriter_test.rb | 12 +- .../session_autoload_test/foo.rb | 10 + .../test/template/form_helper_test.rb | 17 ++ .../test/template/form_options_helper_test.rb | 4 + .../test/template/text_helper_test.rb | 65 +++-- vendor/rails/activerecord/CHANGELOG | 5 +- vendor/rails/activerecord/Rakefile | 2 +- .../activerecord/examples/performance.rb | 2 + .../lib/active_record/association_preload.rb | 14 +- .../lib/active_record/associations.rb | 2 +- .../associations/association_collection.rb | 37 ++- .../lib/active_record/attribute_methods.rb | 4 - .../lib/active_record/autosave_association.rb | 4 +- .../activerecord/lib/active_record/base.rb | 44 ++-- .../abstract/connection_specification.rb | 2 +- .../abstract/schema_statements.rb | 1 + .../connection_adapters/abstract_adapter.rb | 6 + .../connection_adapters/mysql_adapter.rb | 2 + .../connection_adapters/sqlite3_adapter.rb | 2 +- .../connection_adapters/sqlite_adapter.rb | 3 +- .../activerecord/lib/active_record/dirty.rb | 2 +- .../lib/active_record/locale/en.yml | 22 +- .../lib/active_record/locking/optimistic.rb | 1 + .../lib/active_record/migration.rb | 2 +- .../lib/active_record/named_scope.rb | 23 +- .../lib/active_record/nested_attributes.rb | 19 +- .../lib/active_record/serialization.rb | 2 +- .../lib/active_record/session_store.rb | 10 +- .../lib/active_record/validations.rb | 24 +- .../activerecord/lib/active_record/version.rb | 2 +- .../activerecord/test/cases/adapter_test.rb | 15 +- .../eager_load_nested_include_test.rb | 14 +- .../eager_load_nested_polymorphic_include.rb | 19 ++ .../test/cases/associations/eager_test.rb | 7 + .../has_many_associations_test.rb | 71 +++++- .../test/cases/associations_test.rb | 29 +++ .../activerecord/test/cases/base_test.rb | 104 +++----- .../test/cases/connection_test_mysql.rb | 1 + .../test/cases/counter_cache_test.rb | 84 +++++++ .../activerecord/test/cases/locking_test.rb | 3 +- .../activerecord/test/cases/migration_test.rb | 4 + .../test/cases/named_scope_test.rb | 7 +- .../test/cases/nested_attributes_test.rb | 63 +++-- .../test/cases/reflection_test.rb | 10 +- .../activerecord/test/cases/sp_test_mysql.rb | 16 ++ .../test/cases/transactions_test.rb | 23 +- .../test/cases/validations_i18n_test.rb | 24 +- .../test/cases/validations_test.rb | 72 +++--- .../test/fixtures/polymorphic_designs.yml | 19 ++ .../test/fixtures/polymorphic_prices.yml | 19 ++ .../rails/activerecord/test/fixtures/tees.yml | 4 + .../rails/activerecord/test/fixtures/ties.yml | 4 + .../rails/activerecord/test/models/author.rb | 2 + .../activerecord/test/models/event_author.rb | 3 + .../rails/activerecord/test/models/pirate.rb | 4 +- .../test/models/polymorphic_design.rb | 3 + .../test/models/polymorphic_price.rb | 3 + vendor/rails/activerecord/test/models/post.rb | 2 + vendor/rails/activerecord/test/models/tee.rb | 4 + vendor/rails/activerecord/test/models/tie.rb | 4 + .../test/schema/mysql_specific_schema.rb | 7 + .../rails/activerecord/test/schema/schema.rb | 16 ++ vendor/rails/activeresource/CHANGELOG | 5 +- vendor/rails/activeresource/Rakefile | 2 +- .../lib/active_resource/http_mock.rb | 113 ++++++++- .../lib/active_resource/version.rb | 2 +- .../activeresource/test/http_mock_test.rb | 155 ++++++++++++ vendor/rails/activesupport/CHANGELOG | 11 + .../active_support/core_ext/array/grouping.rb | 2 +- .../core_ext/array/random_access.rb | 28 ++- .../lib/active_support/core_ext/class.rb | 1 + .../core_ext/class/attribute.rb | 67 +++++ .../lib/active_support/core_ext/enumerable.rb | 2 +- .../core_ext/kernel/singleton_class.rb | 13 + .../core_ext/module/remove_method.rb | 6 + .../active_support/core_ext/object/misc.rb | 3 + .../core_ext/range/blockless_step.rb | 2 +- .../core_ext/string/output_safety.rb | 11 - .../lib/active_support/dependencies.rb | 50 +++- .../lib/active_support/deprecation.rb | 7 + .../lib/active_support/json/backends/yajl.rb | 2 +- .../lib/active_support/ordered_hash.rb | 6 + .../lib/active_support/testing/performance.rb | 2 +- .../lib/active_support/values/time_zone.rb | 6 +- .../lib/active_support/vendor.rb | 4 +- .../i18n-0.3.7/i18n/backend/active_record.rb | 66 ----- .../vendor/i18n-0.3.7/i18n/backend/fast.rb | 69 ------ .../vendor/i18n-0.3.7/i18n/backend/helpers.rb | 68 ------ .../vendor/i18n-0.3.7/i18n/backend/links.rb | 34 --- .../vendor/i18n-0.3.7/i18n/backend/simple.rb | 22 -- .../i18n-0.3.7/i18n/core_ext/hash/except.rb | 8 - .../i18n-0.3.7/i18n/core_ext/hash/slice.rb | 8 - .../i18n/core_ext/object/meta_class.rb | 5 - .../vendor/i18n-0.3.7/i18n/helpers.rb | 5 - .../vendor/i18n-0.3.7/i18n/version.rb | 3 - .../vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n.rb | 197 +++++++-------- .../i18n/backend.rb | 9 +- .../i18n-0.4.1/i18n/backend/active_record.rb | 61 +++++ .../i18n/backend/active_record/missing.rb | 10 +- .../i18n/backend/active_record/store_procs.rb | 0 .../i18n/backend/active_record/translation.rb | 11 +- .../i18n/backend/base.rb | 139 +++++------ .../i18n/backend/cache.rb | 1 + .../i18n/backend/cascade.rb | 1 - .../i18n/backend/chain.rb | 4 +- .../i18n/backend/cldr.rb | 0 .../i18n/backend/fallbacks.rb | 0 .../vendor/i18n-0.4.1/i18n/backend/flatten.rb | 113 +++++++++ .../i18n/backend/gettext.rb | 0 .../i18n/backend/interpolation_compiler.rb | 12 +- .../i18n-0.4.1/i18n/backend/key_value.rb | 102 ++++++++ .../vendor/i18n-0.4.1/i18n/backend/memoize.rb | 48 ++++ .../i18n/backend/metadata.rb | 18 +- .../i18n/backend/pluralization.rb | 0 .../vendor/i18n-0.4.1/i18n/backend/simple.rb | 87 +++++++ .../i18n-0.4.1/i18n/backend/transliterator.rb | 98 ++++++++ .../vendor/i18n-0.4.1/i18n/config.rb | 84 +++++++ .../vendor/i18n-0.4.1/i18n/core_ext/hash.rb | 29 +++ .../i18n/core_ext/string/interpolate.rb | 7 +- .../i18n/exceptions.rb | 0 .../i18n/gettext.rb | 2 + .../i18n/gettext/helpers.rb} | 4 +- .../i18n/gettext/po_parser.rb | 0 .../{i18n-0.3.7 => i18n-0.4.1}/i18n/locale.rb | 0 .../i18n/locale/fallbacks.rb | 0 .../i18n/locale/tag.rb | 0 .../i18n/locale/tag/parents.rb | 0 .../i18n/locale/tag/rfc4646.rb | 0 .../i18n/locale/tag/simple.rb | 0 .../vendor/i18n-0.4.1/i18n/version.rb | 3 + .../lib/active_support/version.rb | 2 +- .../lib/active_support/whiny_nil.rb | 2 +- .../activesupport/test/callbacks_test.rb | 2 +- .../test/core_ext/array_ext_test.rb | 32 ++- .../class/delegating_attributes_test.rb | 8 +- .../test/core_ext/string_ext_test.rb | 27 +- .../activesupport/test/dependencies_test.rb | 43 ++-- .../test/deprecation/proxy_wrappers_test.rb | 22 ++ .../activesupport/test/ordered_hash_test.rb | 12 + .../activesupport/test/safe_buffer_test.rb | 4 +- .../activesupport/test/time_zone_test.rb | 5 + vendor/rails/ci/geminstaller.yml | 2 + vendor/rails/railties/CHANGELOG | 9 +- vendor/rails/railties/Rakefile | 13 +- .../railties/builtin/rails_info/rails/info.rb | 2 +- vendor/rails/railties/environments/boot.rb | 8 +- .../railties/environments/environment.rb | 2 +- vendor/rails/railties/guides/rails_guides.rb | 37 +-- .../railties/guides/rails_guides/generator.rb | 230 +++++++++++++----- .../railties/guides/rails_guides/indexer.rb | 35 ++- .../guides/rails_guides/levenshtein.rb | 31 +++ .../{credits.erb.textile => credits.html.erb} | 8 +- .../{index.erb.textile => index.html.erb} | 25 +- .../railties/guides/source/plugins.textile | 2 +- .../railties/guides/source/security.textile | 2 +- vendor/rails/railties/lib/initializer.rb | 64 +++-- vendor/rails/railties/lib/rails/plugin.rb | 2 +- .../rails/railties/lib/rails/plugin/loader.rb | 6 +- vendor/rails/railties/lib/rails/version.rb | 2 +- .../migration/migration_generator.rb | 2 +- .../plugin/templates/test_helper.rb | 3 +- .../generators/rails_template_runner_test.rb | 6 +- .../rails/railties/test/initializer_test.rb | 24 +- .../rails/railties/test/plugin_loader_test.rb | 12 +- 200 files changed, 3065 insertions(+), 1204 deletions(-) create mode 100644 vendor/rails/actionpack/test/fixtures/session_autoload_test/session_autoload_test/foo.rb create mode 100644 vendor/rails/activerecord/test/cases/associations/eager_load_nested_polymorphic_include.rb create mode 100755 vendor/rails/activerecord/test/cases/counter_cache_test.rb create mode 100644 vendor/rails/activerecord/test/cases/sp_test_mysql.rb create mode 100644 vendor/rails/activerecord/test/fixtures/polymorphic_designs.yml create mode 100644 vendor/rails/activerecord/test/fixtures/polymorphic_prices.yml create mode 100644 vendor/rails/activerecord/test/fixtures/tees.yml create mode 100644 vendor/rails/activerecord/test/fixtures/ties.yml create mode 100644 vendor/rails/activerecord/test/models/polymorphic_design.rb create mode 100644 vendor/rails/activerecord/test/models/polymorphic_price.rb create mode 100644 vendor/rails/activerecord/test/models/tee.rb create mode 100644 vendor/rails/activerecord/test/models/tie.rb create mode 100644 vendor/rails/activeresource/test/http_mock_test.rb create mode 100644 vendor/rails/activesupport/lib/active_support/core_ext/class/attribute.rb create mode 100644 vendor/rails/activesupport/lib/active_support/core_ext/kernel/singleton_class.rb create mode 100644 vendor/rails/activesupport/lib/active_support/core_ext/module/remove_method.rb delete mode 100644 vendor/rails/activesupport/lib/active_support/vendor/i18n-0.3.7/i18n/backend/active_record.rb delete mode 100644 vendor/rails/activesupport/lib/active_support/vendor/i18n-0.3.7/i18n/backend/fast.rb delete mode 100644 vendor/rails/activesupport/lib/active_support/vendor/i18n-0.3.7/i18n/backend/helpers.rb delete mode 100644 vendor/rails/activesupport/lib/active_support/vendor/i18n-0.3.7/i18n/backend/links.rb delete mode 100644 vendor/rails/activesupport/lib/active_support/vendor/i18n-0.3.7/i18n/backend/simple.rb delete mode 100644 vendor/rails/activesupport/lib/active_support/vendor/i18n-0.3.7/i18n/core_ext/hash/except.rb delete mode 100644 vendor/rails/activesupport/lib/active_support/vendor/i18n-0.3.7/i18n/core_ext/hash/slice.rb delete mode 100644 vendor/rails/activesupport/lib/active_support/vendor/i18n-0.3.7/i18n/core_ext/object/meta_class.rb delete mode 100644 vendor/rails/activesupport/lib/active_support/vendor/i18n-0.3.7/i18n/helpers.rb delete mode 100644 vendor/rails/activesupport/lib/active_support/vendor/i18n-0.3.7/i18n/version.rb rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n.rb (73%) mode change 100644 => 100755 rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/backend.rb (75%) create mode 100644 vendor/rails/activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/active_record.rb rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/backend/active_record/missing.rb (92%) rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/backend/active_record/store_procs.rb (100%) rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/backend/active_record/translation.rb (89%) rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/backend/base.rb (61%) rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/backend/cache.rb (97%) rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/backend/cascade.rb (98%) rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/backend/chain.rb (98%) rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/backend/cldr.rb (100%) rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/backend/fallbacks.rb (100%) create mode 100644 vendor/rails/activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/flatten.rb rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/backend/gettext.rb (100%) rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/backend/interpolation_compiler.rb (87%) create mode 100644 vendor/rails/activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/key_value.rb create mode 100644 vendor/rails/activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/memoize.rb rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/backend/metadata.rb (81%) rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/backend/pluralization.rb (100%) create mode 100644 vendor/rails/activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/simple.rb create mode 100644 vendor/rails/activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/transliterator.rb create mode 100644 vendor/rails/activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/config.rb create mode 100644 vendor/rails/activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/core_ext/hash.rb rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/core_ext/string/interpolate.rb (97%) rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/exceptions.rb (100%) rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/gettext.rb (93%) rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7/i18n/helpers/gettext.rb => i18n-0.4.1/i18n/gettext/helpers.rb} (98%) rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/gettext/po_parser.rb (100%) rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/locale.rb (100%) rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/locale/fallbacks.rb (100%) rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/locale/tag.rb (100%) rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/locale/tag/parents.rb (100%) rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/locale/tag/rfc4646.rb (100%) rename vendor/rails/activesupport/lib/active_support/vendor/{i18n-0.3.7 => i18n-0.4.1}/i18n/locale/tag/simple.rb (100%) create mode 100644 vendor/rails/activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/version.rb create mode 100644 vendor/rails/activesupport/test/deprecation/proxy_wrappers_test.rb create mode 100644 vendor/rails/railties/guides/rails_guides/levenshtein.rb rename vendor/rails/railties/guides/source/{credits.erb.textile => credits.html.erb} (86%) rename vendor/rails/railties/guides/source/{index.erb.textile => index.html.erb} (84%) diff --git a/test/unit/page_renderer_test.rb b/test/unit/page_renderer_test.rb index 5e4d79f0..5931a53b 100644 --- a/test/unit/page_renderer_test.rb +++ b/test/unit/page_renderer_test.rb @@ -229,9 +229,9 @@ END_THM assert_markup_parsed_as( %{

equation A\342\253\275BA\342\200\246\342\253\275B

}, - "equation $A\\sslash B$") + "equation $A\\dots\\sslash B$") assert_markup_parsed_as( %{

boxed equation 1.1.0') s.require_path = 'lib' diff --git a/vendor/rails/actionpack/lib/action_controller/caching/fragments.rb b/vendor/rails/actionpack/lib/action_controller/caching/fragments.rb index eefb6497..56ccc4ad 100644 --- a/vendor/rails/actionpack/lib/action_controller/caching/fragments.rb +++ b/vendor/rails/actionpack/lib/action_controller/caching/fragments.rb @@ -65,8 +65,8 @@ module ActionController #:nodoc: def read_fragment(key, options = nil) return unless cache_configured? + key = fragment_cache_key(key) self.class.benchmark "Cached fragment hit: #{key}" do - key = fragment_cache_key(key) result = cache_store.read(key, options) result.respond_to?(:html_safe) ? result.html_safe : result end diff --git a/vendor/rails/actionpack/lib/action_controller/integration.rb b/vendor/rails/actionpack/lib/action_controller/integration.rb index 241b2c26..1447f012 100644 --- a/vendor/rails/actionpack/lib/action_controller/integration.rb +++ b/vendor/rails/actionpack/lib/action_controller/integration.rb @@ -414,15 +414,25 @@ module ActionController end def multipart_requestify(params, first=true) - returning Hash.new do |p| + Array.new.tap do |p| params.each do |key, value| k = first ? key.to_s : "[#{key.to_s}]" if Hash === value multipart_requestify(value, false).each do |subkey, subvalue| - p[k + subkey] = subvalue + p << [k + subkey, subvalue] + end + elsif Array === value + value.each do |element| + if Hash === element || Array === element + multipart_requestify(element, false).each do |subkey, subvalue| + p << ["#{k}[]#{subkey}", subvalue] + end + else + p << ["#{k}[]", element] + end end else - p[k] = value + p << [k, value] end end end @@ -453,6 +463,7 @@ EOF end end.join("")+"--#{boundary}--\r" end + end # A module used to extend ActionController::Base, so that integration tests @@ -500,7 +511,7 @@ EOF reset! unless @integration_session # reset the html_document variable, but only for new get/post calls @html_document = nil unless %w(cookies assigns).include?(method) - returning @integration_session.__send__(method, *args) do + @integration_session.__send__(method, *args).tap do copy_session_variables! end end @@ -556,7 +567,7 @@ EOF def method_missing(sym, *args, &block) reset! unless @integration_session if @integration_session.respond_to?(sym) - returning @integration_session.__send__(sym, *args, &block) do + @integration_session.__send__(sym, *args, &block).tap do copy_session_variables! end else diff --git a/vendor/rails/actionpack/lib/action_controller/request.rb b/vendor/rails/actionpack/lib/action_controller/request.rb index 1c3c1c83..98c5e8ce 100755 --- a/vendor/rails/actionpack/lib/action_controller/request.rb +++ b/vendor/rails/actionpack/lib/action_controller/request.rb @@ -446,8 +446,8 @@ EOM end def reset_session - @env['rack.session.options'].delete(:id) - @env['rack.session'] = {} + session.destroy if session + self.session = {} end def session_options diff --git a/vendor/rails/actionpack/lib/action_controller/rescue.rb b/vendor/rails/actionpack/lib/action_controller/rescue.rb index 58bbf0cc..81bf2c16 100644 --- a/vendor/rails/actionpack/lib/action_controller/rescue.rb +++ b/vendor/rails/actionpack/lib/action_controller/rescue.rb @@ -15,7 +15,7 @@ module ActionController #:nodoc: # behavior is achieved by overriding the rescue_action_in_public # and rescue_action_locally methods. module Rescue - LOCALHOST = ['127.0.0.1', '::1'].freeze + LOCALHOST = [/^127\.0\.0\.\d{1,3}$/, /^::1$/, /^0:0:0:0:0:0:0:1(%.*)?$/].freeze DEFAULT_RESCUE_RESPONSE = :internal_server_error DEFAULT_RESCUE_RESPONSES = { @@ -122,7 +122,7 @@ module ActionController #:nodoc: # method if you wish to redefine the meaning of a local request to # include remote IP addresses or other criteria. def local_request? #:doc: - LOCALHOST.any?{ |local_ip| request.remote_addr == local_ip && request.remote_ip == local_ip } + LOCALHOST.any?{ |local_ip| request.remote_addr =~ local_ip && request.remote_ip =~ local_ip } end # Render detailed diagnostics for unhandled exceptions rescued from diff --git a/vendor/rails/actionpack/lib/action_controller/resources.rb b/vendor/rails/actionpack/lib/action_controller/resources.rb index 8c2080e5..9348ed96 100644 --- a/vendor/rails/actionpack/lib/action_controller/resources.rb +++ b/vendor/rails/actionpack/lib/action_controller/resources.rb @@ -659,7 +659,7 @@ module ActionController end def add_conditions_for(conditions, method) - returning({:conditions => conditions.dup}) do |options| + ({:conditions => conditions.dup}).tap do |options| options[:conditions][:method] = method unless method == :any end end diff --git a/vendor/rails/actionpack/lib/action_controller/routing.rb b/vendor/rails/actionpack/lib/action_controller/routing.rb index f9b0c4bb..652fa2f5 100644 --- a/vendor/rails/actionpack/lib/action_controller/routing.rb +++ b/vendor/rails/actionpack/lib/action_controller/routing.rb @@ -377,7 +377,7 @@ module ActionController ActiveSupport::Inflector.module_eval do # Ensures that routes are reloaded when Rails inflections are updated. def inflections_with_route_reloading(&block) - returning(inflections_without_route_reloading(&block)) { + (inflections_without_route_reloading(&block)).tap { ActionController::Routing::Routes.reload! if block_given? } end diff --git a/vendor/rails/actionpack/lib/action_controller/routing/route.rb b/vendor/rails/actionpack/lib/action_controller/routing/route.rb index e2077eda..69e8f57e 100644 --- a/vendor/rails/actionpack/lib/action_controller/routing/route.rb +++ b/vendor/rails/actionpack/lib/action_controller/routing/route.rb @@ -65,7 +65,7 @@ module ActionController # map.connect '/page/:id', :controller => 'pages', :action => 'show', :id => /\d+/ # def parameter_shell - @parameter_shell ||= returning({}) do |shell| + @parameter_shell ||= {}.tap do |shell| requirements.each do |key, requirement| shell[key] = requirement unless requirement.is_a? Regexp end @@ -76,7 +76,7 @@ module ActionController # includes keys that appear inside the path, and keys that have requirements # placed upon them. def significant_keys - @significant_keys ||= returning([]) do |sk| + @significant_keys ||= [].tap do |sk| segments.each { |segment| sk << segment.key if segment.respond_to? :key } sk.concat requirements.keys sk.uniq! @@ -86,7 +86,7 @@ module ActionController # Return a hash of key/value pairs representing the keys in the route that # have defaults, or which are specified by non-regexp requirements. def defaults - @defaults ||= returning({}) do |hash| + @defaults ||= {}.tap do |hash| segments.each do |segment| next unless segment.respond_to? :default hash[segment.key] = segment.default unless segment.default.nil? diff --git a/vendor/rails/actionpack/lib/action_controller/session/abstract_store.rb b/vendor/rails/actionpack/lib/action_controller/session/abstract_store.rb index 7a20557f..11cb6c27 100644 --- a/vendor/rails/actionpack/lib/action_controller/session/abstract_store.rb +++ b/vendor/rails/actionpack/lib/action_controller/session/abstract_store.rb @@ -2,13 +2,42 @@ require 'rack/utils' module ActionController module Session - class AbstractStore + class AbstractStore ENV_SESSION_KEY = 'rack.session'.freeze ENV_SESSION_OPTIONS_KEY = 'rack.session.options'.freeze HTTP_COOKIE = 'HTTP_COOKIE'.freeze SET_COOKIE = 'Set-Cookie'.freeze + # thin wrapper around Hash that allows us to lazily + # load session id into session_options + class OptionsHash < Hash + def initialize(by, env, default_options) + @by = by + @env = env + @session_id_loaded = false + merge!(default_options) + end + + def [](key) + if key == :id + load_session_id! unless super(:id) || has_session_id? + end + super(key) + end + + private + + def has_session_id? + @session_id_loaded + end + + def load_session_id! + self[:id] = @by.send(:extract_session_id, @env) + @session_id_loaded = true + end + end + class SessionHash < Hash def initialize(by, env) super() @@ -25,21 +54,42 @@ module ActionController end def [](key) - load! unless @loaded + load_for_read! + super + end + + def has_key?(key) + load_for_read! super end def []=(key, value) - load! unless @loaded + load_for_write! + super + end + + def clear + load_for_write! super end def to_hash + load_for_read! h = {}.replace(self) h.delete_if { |k,v| v.nil? } h end + def update(hash) + load_for_write! + super + end + + def delete(key) + load_for_write! + super + end + def data ActiveSupport::Deprecation.warn( "ActionController::Session::AbstractStore::SessionHash#data " + @@ -48,40 +98,43 @@ module ActionController end def inspect - load! unless @loaded + load_for_read! super end + def exists? + return @exists if instance_variable_defined?(:@exists) + @exists = @by.send(:exists?, @env) + end + + def loaded? + @loaded + end + + def destroy + clear + @by.send(:destroy, @env) if @by + @env[ENV_SESSION_OPTIONS_KEY][:id] = nil if @env && @env[ENV_SESSION_OPTIONS_KEY] + @loaded = false + end + private - def loaded? - @loaded + + def load_for_read! + load! if !loaded? && exists? + end + + def load_for_write! + load! unless loaded? end def load! - stale_session_check! do - id, session = @by.send(:load_session, @env) - (@env[ENV_SESSION_OPTIONS_KEY] ||= {})[:id] = id - replace(session) - @loaded = true - end + id, session = @by.send(:load_session, @env) + @env[ENV_SESSION_OPTIONS_KEY][:id] = id + replace(session) + @loaded = true end - def stale_session_check! - yield - rescue ArgumentError => argument_error - if argument_error.message =~ %r{undefined class/module ([\w:]*\w)} - begin - # Note that the regexp does not allow $1 to end with a ':' - $1.constantize - rescue LoadError, NameError => const_error - raise ActionController::SessionRestoreError, "Session contains objects whose class definition isn\\'t available.\nRemember to require the classes for all objects kept in the session.\n(Original exception: \#{const_error.message} [\#{const_error.class}])\n" - end - - retry - else - raise - end - end end DEFAULT_OPTIONS = { @@ -120,18 +173,14 @@ module ActionController end def call(env) - session = SessionHash.new(self, env) - - env[ENV_SESSION_KEY] = session - env[ENV_SESSION_OPTIONS_KEY] = @default_options.dup - + prepare!(env) response = @app.call(env) session_data = env[ENV_SESSION_KEY] options = env[ENV_SESSION_OPTIONS_KEY] - if !session_data.is_a?(AbstractStore::SessionHash) || session_data.send(:loaded?) || options[:expire_after] - session_data.send(:load!) if session_data.is_a?(AbstractStore::SessionHash) && !session_data.send(:loaded?) + if !session_data.is_a?(AbstractStore::SessionHash) || session_data.loaded? || options[:expire_after] + session_data.send(:load!) if session_data.is_a?(AbstractStore::SessionHash) && !session_data.loaded? sid = options[:id] || generate_sid @@ -139,21 +188,23 @@ module ActionController return response end - cookie = Rack::Utils.escape(@key) + '=' + Rack::Utils.escape(sid) - cookie << "; domain=#{options[:domain]}" if options[:domain] - cookie << "; path=#{options[:path]}" if options[:path] - if options[:expire_after] - expiry = Time.now + options[:expire_after] - cookie << "; expires=#{expiry.httpdate}" - end - cookie << "; Secure" if options[:secure] - cookie << "; HttpOnly" if options[:httponly] + if (env["rack.request.cookie_hash"] && env["rack.request.cookie_hash"][@key] != sid) || options[:expire_after] + cookie = Rack::Utils.escape(@key) + '=' + Rack::Utils.escape(sid) + cookie << "; domain=#{options[:domain]}" if options[:domain] + cookie << "; path=#{options[:path]}" if options[:path] + if options[:expire_after] + expiry = Time.now + options[:expire_after] + cookie << "; expires=#{expiry.httpdate}" + end + cookie << "; Secure" if options[:secure] + cookie << "; HttpOnly" if options[:httponly] - headers = response[1] - unless headers[SET_COOKIE].blank? - headers[SET_COOKIE] << "\n#{cookie}" - else - headers[SET_COOKIE] = cookie + headers = response[1] + unless headers[SET_COOKIE].blank? + headers[SET_COOKIE] << "\n#{cookie}" + else + headers[SET_COOKIE] = cookie + end end end @@ -161,18 +212,39 @@ module ActionController end private + + def prepare!(env) + env[ENV_SESSION_KEY] = SessionHash.new(self, env) + env[ENV_SESSION_OPTIONS_KEY] = OptionsHash.new(self, env, @default_options) + end + def generate_sid ActiveSupport::SecureRandom.hex(16) end def load_session(env) - request = Rack::Request.new(env) - sid = request.cookies[@key] - unless @cookie_only - sid ||= request.params[@key] + stale_session_check! do + sid = current_session_id(env) + sid, session = get_session(env, sid) + [sid, session] end - sid, session = get_session(env, sid) - [sid, session] + end + + def extract_session_id(env) + stale_session_check! do + request = Rack::Request.new(env) + sid = request.cookies[@key] + sid ||= request.params[@key] unless @cookie_only + sid + end + end + + def current_session_id(env) + env[ENV_SESSION_OPTIONS_KEY][:id] + end + + def exists?(env) + current_session_id(env).present? end def get_session(env, sid) @@ -182,6 +254,30 @@ module ActionController def set_session(env, sid, session_data) raise '#set_session needs to be implemented.' end + + def destroy(env) + raise '#destroy needs to be implemented.' + end + + module SessionUtils + private + def stale_session_check! + yield + rescue ArgumentError => argument_error + if argument_error.message =~ %r{undefined class/module ([\w:]*\w)} + begin + # Note that the regexp does not allow $1 to end with a ':' + $1.constantize + rescue LoadError, NameError => const_error + raise ActionController::SessionRestoreError, "Session contains objects whose class definition isn\\'t available.\nRemember to require the classes for all objects kept in the session.\n(Original exception: \#{const_error.message} [\#{const_error.class}])\n" + end + retry + else + raise + end + end + end + include SessionUtils end end end diff --git a/vendor/rails/actionpack/lib/action_controller/session/cookie_store.rb b/vendor/rails/actionpack/lib/action_controller/session/cookie_store.rb index 3d21e812..313307c9 100644 --- a/vendor/rails/actionpack/lib/action_controller/session/cookie_store.rb +++ b/vendor/rails/actionpack/lib/action_controller/session/cookie_store.rb @@ -36,6 +36,8 @@ module ActionController # # Note that changing digest or secret invalidates all existing sessions! class CookieStore + include AbstractStore::SessionUtils + # Cookies can typically store 4096 bytes. MAX = 4096 SECRET_MIN_LENGTH = 30 # characters @@ -93,20 +95,20 @@ module ActionController end def call(env) - env[ENV_SESSION_KEY] = AbstractStore::SessionHash.new(self, env) - env[ENV_SESSION_OPTIONS_KEY] = @default_options.dup - + prepare!(env) + status, headers, body = @app.call(env) session_data = env[ENV_SESSION_KEY] options = env[ENV_SESSION_OPTIONS_KEY] - if !session_data.is_a?(AbstractStore::SessionHash) || session_data.send(:loaded?) || options[:expire_after] - session_data.send(:load!) if session_data.is_a?(AbstractStore::SessionHash) && !session_data.send(:loaded?) + if !session_data.is_a?(AbstractStore::SessionHash) || session_data.loaded? || options[:expire_after] + session_data.send(:load!) if session_data.is_a?(AbstractStore::SessionHash) && !session_data.loaded? + + persistent_session_id!(session_data) session_data = marshal(session_data.to_hash) raise CookieOverflow if session_data.size > MAX - cookie = Hash.new cookie[:value] = session_data unless options[:expire_after].nil? @@ -114,17 +116,20 @@ module ActionController end cookie = build_cookie(@key, cookie.merge(options)) - unless headers[HTTP_SET_COOKIE].blank? - headers[HTTP_SET_COOKIE] << "\n#{cookie}" - else - headers[HTTP_SET_COOKIE] = cookie - end + headers[HTTP_SET_COOKIE] = [] if headers[HTTP_SET_COOKIE].blank? + headers[HTTP_SET_COOKIE] << cookie end [status, headers, body] end private + + def prepare!(env) + env[ENV_SESSION_KEY] = AbstractStore::SessionHash.new(self, env) + env[ENV_SESSION_OPTIONS_KEY] = AbstractStore::OptionsHash.new(self, env, @default_options) + end + # Should be in Rack::Utils soon def build_cookie(key, value) case value @@ -146,20 +151,46 @@ module ActionController end def load_session(env) - request = Rack::Request.new(env) - session_data = request.cookies[@key] - data = unmarshal(session_data) || persistent_session_id!({}) + data = unpacked_cookie_data(env) + data = persistent_session_id!(data) [data[:session_id], data] end + + def extract_session_id(env) + if data = unpacked_cookie_data(env) + persistent_session_id!(data) unless data.empty? + data[:session_id] + else + nil + end + end + + def current_session_id(env) + env[ENV_SESSION_OPTIONS_KEY][:id] + end + + def exists?(env) + current_session_id(env).present? + end + + def unpacked_cookie_data(env) + env["action_dispatch.request.unsigned_session_cookie"] ||= begin + stale_session_check! do + request = Rack::Request.new(env) + session_data = request.cookies[@key] + unmarshal(session_data) || {} + end + end + end # Marshal a session hash into safe cookie data. Include an integrity hash. def marshal(session) - @verifier.generate(persistent_session_id!(session)) + @verifier.generate(session) end # Unmarshal cookie data to a hash and verify its integrity. def unmarshal(cookie) - persistent_session_id!(@verifier.verify(cookie)) if cookie + @verifier.verify(cookie) if cookie rescue ActiveSupport::MessageVerifier::InvalidSignature nil end @@ -207,6 +238,10 @@ module ActionController ActiveSupport::SecureRandom.hex(16) end + def destroy(env) + # session data is stored on client; nothing to do here + end + def persistent_session_id!(data) (data ||= {}).merge!(inject_persistent_session_id(data)) end diff --git a/vendor/rails/actionpack/lib/action_controller/session/mem_cache_store.rb b/vendor/rails/actionpack/lib/action_controller/session/mem_cache_store.rb index f745715a..402681cd 100644 --- a/vendor/rails/actionpack/lib/action_controller/session/mem_cache_store.rb +++ b/vendor/rails/actionpack/lib/action_controller/session/mem_cache_store.rb @@ -43,6 +43,15 @@ begin rescue MemCache::MemCacheError, Errno::ECONNREFUSED return false end + + def destroy(env) + if sid = current_session_id(env) + @pool.delete(sid) + end + rescue MemCache::MemCacheError, Errno::ECONNREFUSED + false + end + end end end diff --git a/vendor/rails/actionpack/lib/action_controller/test_process.rb b/vendor/rails/actionpack/lib/action_controller/test_process.rb index fd9f90b1..db264987 100644 --- a/vendor/rails/actionpack/lib/action_controller/test_process.rb +++ b/vendor/rails/actionpack/lib/action_controller/test_process.rb @@ -450,7 +450,7 @@ module ActionController #:nodoc: def xml_http_request(request_method, action, parameters = nil, session = nil, flash = nil) @request.env['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest' @request.env['HTTP_ACCEPT'] = [Mime::JS, Mime::HTML, Mime::XML, 'text/xml', Mime::ALL].join(', ') - returning __send__(request_method, action, parameters, session, flash) do + __send__(request_method, action, parameters, session, flash).tap do @request.env.delete 'HTTP_X_REQUESTED_WITH' @request.env.delete 'HTTP_ACCEPT' end diff --git a/vendor/rails/actionpack/lib/action_controller/url_rewriter.rb b/vendor/rails/actionpack/lib/action_controller/url_rewriter.rb index 13194bcc..552c2ae9 100644 --- a/vendor/rails/actionpack/lib/action_controller/url_rewriter.rb +++ b/vendor/rails/actionpack/lib/action_controller/url_rewriter.rb @@ -92,6 +92,14 @@ module ActionController # end # end module UrlWriter + RESERVED_PCHAR = ':@&=+$,;%' + SAFE_PCHAR = "#{URI::REGEXP::PATTERN::UNRESERVED}#{RESERVED_PCHAR}" + if RUBY_VERSION >= '1.9' + UNSAFE_PCHAR = Regexp.new("[^#{SAFE_PCHAR}]", false).freeze + else + UNSAFE_PCHAR = Regexp.new("[^#{SAFE_PCHAR}]", false, 'N').freeze + end + def self.included(base) #:nodoc: ActionController::Routing::Routes.install_helpers(base) base.mattr_accessor :default_url_options @@ -142,7 +150,7 @@ module ActionController end trailing_slash = options.delete(:trailing_slash) if options.key?(:trailing_slash) url << ActionController::Base.relative_url_root.to_s unless options[:skip_relative_url_root] - anchor = "##{CGI.escape options.delete(:anchor).to_param.to_s}" if options[:anchor] + anchor = "##{URI.escape(options.delete(:anchor).to_param.to_s, UNSAFE_PCHAR)}" if options[:anchor] generated = Routing::Routes.generate(options, {}) url << (trailing_slash ? generated.sub(/\?|\z/) { "/" + $& } : generated) url << anchor if anchor diff --git a/vendor/rails/actionpack/lib/action_pack/version.rb b/vendor/rails/actionpack/lib/action_pack/version.rb index a464dda7..3064148f 100644 --- a/vendor/rails/actionpack/lib/action_pack/version.rb +++ b/vendor/rails/actionpack/lib/action_pack/version.rb @@ -2,7 +2,7 @@ module ActionPack #:nodoc: module VERSION #:nodoc: MAJOR = 2 MINOR = 3 - TINY = 8 + TINY = 9 STRING = [MAJOR, MINOR, TINY].join('.') end diff --git a/vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb b/vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb index 38c44a2d..c1b2ebe2 100644 --- a/vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb +++ b/vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb @@ -877,9 +877,9 @@ module ActionView def value_before_type_cast(object, method_name) unless object.nil? - object.respond_to?(method_name + "_before_type_cast") ? - object.send(method_name + "_before_type_cast") : - object.send(method_name) + object.respond_to?(method_name) ? + object.send(method_name) : + object.send(method_name + "_before_type_cast") end end diff --git a/vendor/rails/actionpack/lib/action_view/helpers/form_options_helper.rb b/vendor/rails/actionpack/lib/action_view/helpers/form_options_helper.rb index 6d5acf17..d9d985a5 100644 --- a/vendor/rails/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/vendor/rails/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -481,7 +481,7 @@ module ActionView end zone_options += options_for_select(convert_zones[zones], selected) - zone_options + zone_options.html_safe end private diff --git a/vendor/rails/actionpack/lib/action_view/helpers/form_tag_helper.rb b/vendor/rails/actionpack/lib/action_view/helpers/form_tag_helper.rb index ac62ba58..42fc66f8 100644 --- a/vendor/rails/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/vendor/rails/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -440,7 +440,7 @@ module ActionView private def html_options_for_form(url_for_options, options, *parameters_for_url) - returning options.stringify_keys do |html_options| + options.stringify_keys.tap do |html_options| html_options["enctype"] = "multipart/form-data" if html_options.delete("multipart") html_options["action"] = url_for(url_for_options, *parameters_for_url) end diff --git a/vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb b/vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb index 4016683e..3b3278fb 100644 --- a/vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb +++ b/vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb @@ -653,7 +653,7 @@ module ActionView #