Ruby: Überprüfung, ob URI HTTPS?

Ich würde gerne prüfen, ob die URI müssen die SSL-Authentifizierung:

url = URI.parse("http://www.google.com")

# [some code]

if url.instance_of? URI::HTTPS
   http.use_ssl=true
   http.verify_mode = OpenSSL::SSL::VERIFY_NONE
end

Jedoch, diese wenigen Zeilen werfen die folgende Fehlermeldung..

/usr/lib/ruby/1.8/uri/common.rb:436:in `split': bad URI(is not URI?): HTTPS (URI::InvalidURIError)
    from /usr/lib/ruby/1.8/uri/common.rb:485:in `parse'
    from /usr/lib/ruby/1.8/uri/common.rb:608:in `URI'
    from links.rb:18

Warum ist es passiert?

InformationsquelleAutor Marco | 2010-02-06
Schreibe einen Kommentar