Created
February 3, 2012 08:22
-
-
Save eoftedal/1728927 to your computer and use it in GitHub Desktop.
Test tool needs to support Self-signed cert for non-prod environments. But the first request is horribly slow... (15 seconds) Does not happen in curl or wget
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
def preflight(uri) | |
#For some reason this speeds up connect on windows | |
require 'socket' | |
context = OpenSSL::SSL::SSLContext.new | |
tcp_client = TCPSocket.new uri.host, uri.port | |
ssl_client = OpenSSL::SSL::SSLSocket.new tcp_client, context | |
ssl_client.connect | |
end | |
preflight(uri) | |
http = Net::HTTP.new(uri.host, uri.port) | |
http.use_ssl =(uri.scheme == 'https') | |
http.verify_mode = OpenSSL::SSL::VERIFY_NONE | |
resp = http.post(uri.path, data, headers) |
Actually it's not related to self-signed at all, just https
preflight works
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Might be a windows issue