Skip to content

Instantly share code, notes, and snippets.

@matthauck
Created June 21, 2012 23:04
Show Gist options
  • Save matthauck/2969144 to your computer and use it in GitHub Desktop.
Save matthauck/2969144 to your computer and use it in GitHub Desktop.
Net::HTTP global ca hack
require 'net/http'
module Net
class HTTP
# Creates a new Net::HTTP object for the specified +address+.
# This method does not open the TCP connection.
def initialize(address, port = nil)
@address = address
@port = (port || HTTP.default_port)
@curr_http_version = HTTPVersion
@no_keepalive_server = false
@close_on_empty_response = false
@socket = nil
@started = false
@open_timeout = nil
@read_timeout = 60
@debug_output = nil
@use_ssl = false
@ssl_context = nil
@enable_post_connection_check = true
@compression = nil
@sspi_enabled = false
if defined?(SSL_ATTRIBUTES)
SSL_ATTRIBUTES.each do |name|
instance_variable_set "@#{name}", nil
end
end
if @ca_file.nil?
@ca_file = "/my/JDKs/cacerts.jks/converted/to/cacerts.pem"
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment