# File lib/stella.rb, line 178 def canonical_uri(uri) return nil if uri.nil? if uri.kind_of?(URI) uri = Addressable::URI.parse uri.to_s elsif uri.kind_of?(String) uri &&= uri.to_s uri.strip! unless uri.frozen? uri = "http://#{uri}" unless uri.match(/^https?:\/\//) uri = Addressable::URI.parse(uri) end uri.scheme ||= 'http' uri.path = '/' if uri.path.to_s.empty? uri end