Created
August 11, 2014 17:11
-
-
Save anonymous/d230ca7e84c1293b9dab 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
#!/usr/bin/env ruby | |
# http://stackoverflow.com/questions/12836847/how-to-establish-a-ssl-enabled-tcp-ip-connection-in-ruby | |
require 'socket' | |
require 'openssl' | |
socket = TCPSocket.open('crew-access-data.ual.com', 34135) | |
ssl_context = OpenSSL::SSL::SSLContext.new | |
ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE | |
ssl_socket = OpenSSL::SSL::SSLSocket.new(socket, ssl_context) | |
ssl_socket.sync_close = true | |
ssl_socket.connect | |
# The above connect command produces the following: | |
#OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: sslv3 alert handshake failure | |
# from (irb):12:in `connect' | |
# from (irb):12 | |
# from /home/advorak/.rbenv/versions/2.1.2/bin/irb:11:in `<main>' | |
#..... | |
while line = ssl_socket.gets | |
p line | |
end | |
ssl_socket.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment