Skip to content

Instantly share code, notes, and snippets.

@mpenick
Created August 23, 2016 00:00
Show Gist options
  • Select an option

  • Save mpenick/4b3395738886603a654055fdc6afc5fa to your computer and use it in GitHub Desktop.

Select an option

Save mpenick/4b3395738886603a654055fdc6afc5fa to your computer and use it in GitHub Desktop.
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