Commit 62419e2b7c1e021079eb41328039425654a95d4f
1 parent
783dcf1e
Exists in
master
and in
27 other branches
noosfero_caching: fix HTTP caching with Rails 3
Showing
2 changed files
with
7 additions
and
9 deletions
Show diff stats
config/application.rb
| ... | ... | @@ -111,9 +111,7 @@ module Noosfero |
| 111 | 111 | # Make sure the secret is at least 30 characters and all random, |
| 112 | 112 | # no regular words or you'll be exposed to dictionary attacks. |
| 113 | 113 | config.secret_token = noosfero_session_secret |
| 114 | - config.action_dispatch.session = { | |
| 115 | - :key => '_noosfero_session', | |
| 116 | - } | |
| 114 | + config.session_store :cookie_store, :key => '_noosfero_session' | |
| 117 | 115 | |
| 118 | 116 | config.time_zone = File.read('/etc/timezone').split("\n").first |
| 119 | 117 | config.active_record.default_timezone = :local | ... | ... |
vendor/plugins/noosfero_caching/init.rb
| ... | ... | @@ -49,11 +49,11 @@ module NoosferoHttpCaching |
| 49 | 49 | |
| 50 | 50 | # filter off all cookies except for plugin-provided ones that are |
| 51 | 51 | # path-specific (i.e path != "/"). |
| 52 | - def remove_unwanted_cookies(cookie_list) | |
| 53 | - return nil if cookie_list.nil? | |
| 54 | - cookie_list.select do |c| | |
| 52 | + def remove_unwanted_cookies(set_cookie) | |
| 53 | + return nil if set_cookie.nil? | |
| 54 | + set_cookie.split(/\s*,\s*/).select do |c| | |
| 55 | 55 | c =~ /^_noosfero_plugin_\w+=/ && c =~ /path=\/\w+/ |
| 56 | - end | |
| 56 | + end.join(', ') | |
| 57 | 57 | end |
| 58 | 58 | |
| 59 | 59 | end |
| ... | ... | @@ -61,7 +61,7 @@ module NoosferoHttpCaching |
| 61 | 61 | end |
| 62 | 62 | |
| 63 | 63 | unless Rails.env.development? |
| 64 | - middleware = Rails.application.config.middleware | |
| 64 | + middleware = Noosfero::Application.config.middleware | |
| 65 | 65 | ActionController::Base.send(:include, NoosferoHttpCaching) |
| 66 | - middleware.use NoosferoHttpCaching::Middleware | |
| 66 | + middleware.insert_before ::ActionDispatch::Cookies, NoosferoHttpCaching::Middleware | |
| 67 | 67 | end | ... | ... |