POST via https using http-access/httpclient
Project required periodic posting to HTTPS via http-access/httpclient.
The first issue was how to set the certficate to use. Safari does not export SSL certificates in a way useful to openssl. The .cer or .cert files give an exception of “OpenSSL::X509::StoreError”
To track that down I had to dig around the curl docs of all places - they have better documentation than http-access.
The way to do this is open with OS X keychain, export as .pem (base64 encoded version), and save .pem file in the config dir of rails.
This led to the next problem - the HTTPS server had a bum certificate, it was from a different host. I think their setup was done on the cheap. http-access kept failing with OpenSSL::SSL::SSLError - hostname not match.
The way to get around this is to set verify_mode = nil
require 'httpclient'
client = HTTPClient.new()
client.ssl_config.verify_mode = nil
http://ghouston.blogspot.com/2006/03/using-ssl-with-ruby-http-access2.html
http://curl.haxx.se/docs/faq.html#What_certificates_do_I_need_when
http://dev.ctor.org/svn/http-access2/trunk/lib/httpclient.rb
http://groups.google.co.uk/group/soap4r/browse_thread/thread/872f2f5c61ce20c6
0 comments
Kick things off by filling out the form below.
Leave a Comment