Created
August 23, 2016 00:00
-
-
Save mpenick/4b3395738886603a654055fdc6afc5fa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'net/http' | |
| require 'uri' | |
| require 'openssl' | |
| #OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options] |= OpenSSL::SSL::OP_NO_SSLv3 | |
| #OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options] |= OpenSSL::SSL::OP_NO_SSLv2 | |
| def path_for_url(url) | |
| path = | |
| if url.path.nil? || url.path.empty? | |
| '/' | |
| else | |
| url.path | |
| end | |
| if url.query | |
| path << '?' << url.query | |
| end | |
| path | |
| end | |
| url = URI.parse("https://academy.datastax.com/") | |
| #url = URI.parse("https://www.google.com") | |
| puts url.port | |
| req = Net::HTTP::Head.new(path_for_url(url)) | |
| http = Net::HTTP.new(url.host, url.port) | |
| http.use_ssl = true | |
| http.verify_mode = OpenSSL::SSL::VERIFY_NONE | |
| http.request(req) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment