Commit c3f4edc38cfeb750c259a814d35f1360c4836765

Authored by Joenio Costa
Committed by Antonio Terceiro
1 parent 0a37bbec

ActionItem969: crash when viewing RSS feed under SSL(HTTPS)

app/controllers/application.rb
... ... @@ -67,6 +67,7 @@ class ApplicationController < ActionController::Base
67 67 def avoid_ssl
68 68 return true if (!request.ssl? || ENV['RAILS_ENV'] == 'development')
69 69 redirect_to(params.merge(:protocol => 'http://'))
  70 + false
70 71 end
71 72  
72 73 before_init_gettext :maybe_save_locale
... ...
test/functional/application_controller_test.rb
... ... @@ -412,4 +412,15 @@ class ApplicationControllerTest < Test::Unit::TestCase
412 412 assert_no_tag :tag => 'div', :attributes => {:id => 'block-' + b.id.to_s}
413 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 426 end
... ...