Note that there are some explanatory texts on larger screens.

plurals
  1. POOpenSSL trouble with Ruby 1.9.3
    text
    copied!<p>I am having a semi-serious problem with OpenSSL 1.0.1 + Ruby 1.9.3 on Ubuntu 12.04.</p> <p>All rubies are installed with rvm</p> <pre><code>require 'uri' require 'net/http' require 'net/https' endpoint = "https://secure.mmoagateway.com/api/transact.php" RUBY_184_POST_HEADERS = { "Content-Type" =&gt; "application/x-www-form-urlencoded" } body = "orderid=ae5dd847d9f31209cbffeeea076ed966&amp;orderdescription=Active+Merchant+Remote+Test+Purchase&amp;ccnumber=4111111111111111&amp;ccexp=0913&amp;cvv=123&amp;company=Widgets+Inc&amp;address1=1234+My+Street&amp;address2=Apt+1&amp;city=Ottawa&amp;state=ON&amp;zip=K1C2N6&amp;country=CA&amp;phone=%28555%29555-5555&amp;firstname=&amp;lastname=&amp;email=&amp;amount=1.00&amp;type=auth&amp;username=demo&amp;password=password" headers = {} endpoint = endpoint.is_a?(URI) ? endpoint : URI.parse(endpoint) http = Net::HTTP.new(endpoint.host, endpoint.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE http.set_debug_output(STDOUT) result = http.post(endpoint.request_uri, body, RUBY_184_POST_HEADERS.merge(headers)) puts(result) </code></pre> <p>On Ubuntu 12.04 + Ruby 1.9.3 + Openss 1.0.1 I get the following output:</p> <pre><code>% ruby test.rb opening connection to secure.mmoagateway.com... opened Conn close because of connect error Connection reset by peer - SSL_connect /usr/lib/ruby/1.9.1/net/http.rb:799:in `connect': Connection reset by peer - SSL_connect (Errno::ECONNRESET) from /usr/lib/ruby/1.9.1/net/http.rb:799:in `block in connect' from /usr/lib/ruby/1.9.1/timeout.rb:54:in `timeout' from /usr/lib/ruby/1.9.1/timeout.rb:99:in `timeout' from /usr/lib/ruby/1.9.1/net/http.rb:799:in `connect' from /usr/lib/ruby/1.9.1/net/http.rb:755:in `do_start' from /usr/lib/ruby/1.9.1/net/http.rb:744:in `start' from /usr/lib/ruby/1.9.1/net/http.rb:1284:in `request' from /usr/lib/ruby/1.9.1/net/http.rb:1307:in `send_entity' from /usr/lib/ruby/1.9.1/net/http.rb:1096:in `post' from test.rb:17:in `&lt;main&gt;' </code></pre> <p>With Ruby 1.8.7 I get the correct output:</p> <pre><code>$ ruby test.rb opening connection to secure.mmoagateway.com... opened &lt;- "POST /api/transact.php HTTP/1.1\r\nAccept: */*\r\nContent-Type: application/x-www-form-urlencoded\r\nConnection: close\r\nContent-Length: 347\r\nHost: secure.mmoagateway.com\r\n\r\n" &lt;- "orderid=ae5dd847d9f31209cbffeeea076ed966&amp;orderdescription=Active+Merchant+Remote+Test+Purchase&amp;ccnumber=4111111111111111&amp;ccexp=0913&amp;cvv=123&amp;company=Widgets+Inc&amp;address1=1234+My+Street&amp;address2=Apt+1&amp;city=Ottawa&amp;state=ON&amp;zip=K1C2N6&amp;country=CA&amp;phone=%28555%29555-5555&amp;firstname=&amp;lastname=&amp;email=&amp;amount=1.00&amp;type=auth&amp;username=demo&amp;password=password" -&gt; "HTTP/1.1 200 OK\r\n" -&gt; "Date: Wed, 04 Jul 2012 01:26:35 GMT\r\n" -&gt; "Server: Apache\r\n" -&gt; "Content-Length: 240\r\n" -&gt; "Connection: close\r\n" -&gt; "Content-Type: text/html\r\n" -&gt; "\r\n" reading 240 bytes... -&gt; "response=1&amp;responsetext=SUCCESS&amp;authcode=123456&amp;transactionid=1648894346&amp;avsresponse=N&amp;cvvresponse=N&amp;orderid=ae5dd847d9f31209cbffeeea076ed966&amp;type=auth&amp;response_code=100&amp;merchant_defined_field_6=&amp;merchant_defined_field_7=&amp;customer_vault_id=" read 240 bytes Conn close #&lt;Net::HTTPOK:0xb74175c8&gt; response=1&amp;responsetext=SUCCESS&amp;authcode=123456&amp;transactionid=1648894346&amp;avsresponse=N&amp;cvvresponse=N&amp;orderid=ae5dd847d9f31209cbffeeea076ed966&amp;type=auth&amp;response_code=100&amp;merchant_defined_field_6=&amp;merchant_defined_field_7=&amp;customer_vault_id= </code></pre> <p>I have the same issue in arch with 1.9.3 and 1.0.1.</p> <p>If I install 1.0.0e from oneiric on my 12.04 system it also works fine with ruby 1.9.3</p> <p>I think this may be related to ubuntu bug here: <a href="https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/965371" rel="noreferrer">https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/965371</a></p> <p>Although I downloaded the packages from Debian where they said it was fixed and had no luck.</p> <p>Has anyone else experienced a similar problem?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload