-
-
Save dissolve/a6b9147f142cfb04812e to your computer and use it in GitHub Desktop.
GWG's SSL error testing in ruby
This file contains 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' | |
uris = [ | |
URI('https://www.google.com/'), #server with SSL | |
URI('https://david.shanske.com/'), #server with SNI (that isn't the default) | |
URI('https://ben.thatmustbe.me/') #server with SNI (that is the default) | |
] | |
connections = uris.map {|uri| Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https')} | |
requests = uris.map {|uri| Net::HTTP::Get.new uri} | |
0.upto(uris.length - 1) do |idx| | |
begin | |
connections[idx].request requests[idx] | |
puts "connect #{connections[idx].address} OK" | |
rescue => e | |
puts "Error on connection to #{connections[idx].address} before timeout: #{e.message}" | |
puts "Exiting as this does not prove anything" | |
exit | |
end | |
end | |
sleep 300 | |
0.upto(uris.length - 1) do |idx| | |
begin | |
connections[idx].request requests[idx] | |
puts "reconnect #{connections[idx].address} OK" | |
rescue => e | |
puts "Error on reconnection to #{connections[idx].address} after timeout: #{e.message}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment