It has been a long time since focusing exclusively on writing Ruby code. So much fun.
The last two years have been groovy only which is a great language but there is something pure and simple about Ruby that just takes your breath away.
Enough of the emotional stuff, why, on earth, is it so hard to disable SSL cert trust verification. Such a common problem, google is full of Rails ActionMailer solutions but of coarse that doesn't help the rest of us.
Ruby 1.8.7I approached the problem from Net:HTTP library makes it pretty easy. You just have to remember to require the correct classes and note that you are not disabling SSL just the trust verification part.
My actual goal was to access a WSDL, over SSL, with an untrusted cert. This was not so easy. Took me about 5 hours to work out this solution. Expensive.
I used the Soap4R gem and since performance is not an issue I figured the dynamic proxy from the WSDL parsing would be the way to go:
The problem was that there is no simple API to set the verify_mode of the connection so you have to root around in the code until you find where to monkey patch. This is what I came up with.
If someone has a cleaner solution I would love to hear it.
Upgrading to 1.9.3 broke my Monkey Patch as expected so here is the updated one that handles both for the time being: