Commit c3f4edc38cfeb750c259a814d35f1360c4836765
Committed by
Antonio Terceiro
1 parent
0a37bbec
Exists in
master
and in
29 other branches
ActionItem969: crash when viewing RSS feed under SSL(HTTPS)
Showing
2 changed files
with
12 additions
and
0 deletions
Show diff stats
app/controllers/application.rb
@@ -67,6 +67,7 @@ class ApplicationController < ActionController::Base | @@ -67,6 +67,7 @@ class ApplicationController < ActionController::Base | ||
67 | def avoid_ssl | 67 | def avoid_ssl |
68 | return true if (!request.ssl? || ENV['RAILS_ENV'] == 'development') | 68 | return true if (!request.ssl? || ENV['RAILS_ENV'] == 'development') |
69 | redirect_to(params.merge(:protocol => 'http://')) | 69 | redirect_to(params.merge(:protocol => 'http://')) |
70 | + false | ||
70 | end | 71 | end |
71 | 72 | ||
72 | before_init_gettext :maybe_save_locale | 73 | before_init_gettext :maybe_save_locale |
test/functional/application_controller_test.rb
@@ -412,4 +412,15 @@ class ApplicationControllerTest < Test::Unit::TestCase | @@ -412,4 +412,15 @@ class ApplicationControllerTest < Test::Unit::TestCase | ||
412 | assert_no_tag :tag => 'div', :attributes => {:id => 'block-' + b.id.to_s} | 412 | assert_no_tag :tag => 'div', :attributes => {:id => 'block-' + b.id.to_s} |
413 | end | 413 | end |
414 | 414 | ||
415 | + should 'return false when not avoid ssl' do | ||
416 | + req = mock | ||
417 | + req.stubs(:ssl?).returns(true) | ||
418 | + | ||
419 | + @controller.expects(:request).returns(req) | ||
420 | + @controller.stubs(:params).returns({}) | ||
421 | + @controller.stubs(:redirect_to) | ||
422 | + | ||
423 | + assert_equal false, @controller.avoid_ssl | ||
424 | + end | ||
425 | + | ||
415 | end | 426 | end |