lib/ssl_requirement.rb in bcurren-ssl_requirement-1.0.4 vs lib/ssl_requirement.rb in bcurren-ssl_requirement-1.0.6
- old
+ new
@@ -19,16 +19,12 @@
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
module SslRequirement
- mattr_reader :ssl_host
+ mattr_accessor :ssl_host, :non_ssl_host
- def self.ssl_host=(host)
- @@ssl_host = host
- end
-
def self.included(controller)
controller.extend(ClassMethods)
controller.before_filter(:ensure_proper_protocol)
end
@@ -80,10 +76,10 @@
if ssl_required? && !request.ssl?
redirect_to "https://" + (ssl_host || request.host) + request.request_uri
flash.keep
return false
elsif request.ssl? && !ssl_required?
- redirect_to "http://" + request.host + request.request_uri
+ redirect_to "http://" + (non_ssl_host || request.host) + request.request_uri
flash.keep
return false
end
end
end