[Ruby] Problems with OpenSSL

ben wiseley wiseleyb at gmail.com
Wed Sep 6 07:07:31 PDT 2006


Sorry to bug the list but I'm really stumped on this one.

I'm using ActiveMerchant to do Authorize.net processing (currently
auth.netis in test mode... if that makes a difference).  Everything
works fine on my
windoz box (exact same code) but, on our staging box (which is running the
same version of Ruby 1.8.4 on a dedicated Debian:Sarge box) I'm getting
strange errors from the bowels of /lib/ruby/1.8/net/http.rb

I get two different errors... when doing this:
      uri   = URI.parse(url)
      http = Net::HTTP.new(uri.host, uri.port)
      http.verify_mode    = OpenSSL::SSL::VERIFY_NONE
      http.use_ssl        = true
      http.post(uri.path, data).body
I get this
OpenSSL::SSL::SSLError in CheckoutController#am_test

RAILS_ROOT: /var/www/webapps/staging/russell/current/config/..
Application Trace <http://rubyonrain.com/checkout/am_test#> | Framework
Trace <http://rubyonrain.com/checkout/am_test#> | Full
Trace<http://rubyonrain.com/checkout/am_test#>

/usr/local/lib/ruby/1.8/net/http.rb:588:in `connect'
/usr/local/lib/ruby/1.8/net/http.rb:588:in `connect'
/usr/local/lib/ruby/1.8/net/http.rb:555:in `do_start'
/usr/local/lib/ruby/1.8/net/http.rb:544:in `start'
/usr/local/lib/ruby/1.8/net/http.rb:1031:in `request'
/usr/local/lib/ruby/1.8/net/http.rb:840:in `post'
#{RAILS_ROOT}/lib/active_merchant/lib/posts_data.rb:18:in `ssl_post'
#{RAILS_ROOT}/lib/active_merchant/billing/gateways/authorized_net.rb:108:in
`commit'
#{RAILS_ROOT}/lib/active_merchant/billing/gateways/authorized_net.rb:67:in
`purchase'
#{RAILS_ROOT}/app/controllers/checkout_controller.rb:268:in `am_test'
/usr/local/bin/mongrel_rails:18

When using their code, unmodifed - (i.e. with the @ssl_strict test)
      uri   = URI.parse(url)
      http = Net::HTTP.new(uri.host, uri.port)
      http.verify_mode    = OpenSSL::SSL::VERIFY_NONE unless @ssl_strict
      http.use_ssl        = true
      http.post(uri.path, data).body
I get this
Errno::ENOENT in CheckoutController#am_test

No such file or directory

RAILS_ROOT: /var/www/webapps/staging/russell/current/config/..
Application Trace <http://rubyonrain.com/checkout/am_test#> | Framework
Trace <http://rubyonrain.com/checkout/am_test#> | Full
Trace<http://rubyonrain.com/checkout/am_test#>

/usr/local/lib/ruby/1.8/net/http.rb:588:in `connect'
/usr/local/lib/ruby/1.8/net/http.rb:588:in `connect'
/usr/local/lib/ruby/1.8/net/http.rb:555:in `do_start'
/usr/local/lib/ruby/1.8/net/http.rb:544:in `start'
/usr/local/lib/ruby/1.8/net/http.rb:1031:in `request'
/usr/local/lib/ruby/1.8/net/http.rb:840:in `post'
#{RAILS_ROOT}/lib/active_merchant/lib/posts_data.rb:18:in `ssl_post'
#{RAILS_ROOT}/lib/active_merchant/billing/gateways/authorized_net.rb:108:in
`commit'
#{RAILS_ROOT}/lib/active_merchant/billing/gateways/authorized_net.rb:67:in
`purchase'
#{RAILS_ROOT}/app/controllers/checkout_controller.rb:268:in `am_test'
/usr/local/bin/mongrel_rails:18


I tried replacing the uri.path with a static url ( http.post("
https://secure.authorize.net/gateway/transact.dll",data).body ) in case that
was the trouble but no luck.

Any ideas on this?

-ben


More information about the Ruby mailing list