Undefined method `close' for OpenSSL::SSL::SSLSocket


#1

I’m having a problem with 1.8.6 and soap4r that I don’t understand. I’m
running within Apache as a CGI. I developed this code on a Windows box
and it works fine, but I’ve moved the code to my production Linux
environment and I get this error:

undefined method `close’ for #OpenSSL::SSL::SSLSocket:0xb790c024

Fault Class: NoMethodError

/data1/target_copy/gems/httpclient-2.1.4/lib/httpclient/session.rb:271:in
close' /data1/target_copy/gems/httpclient-2.1.4/lib/httpclient/session.rb:554:inclose’
/data1/target_copy/gems/httpclient-2.1.4/lib/httpclient/session.rb:149:in
query' /data1/target_copy/gems/httpclient-2.1.4/lib/httpclient.rb:942:indo_get_block’
/data1/target_copy/gems/httpclient-2.1.4/lib/httpclient.rb:758:in
do_request' /data1/target_copy/gems/httpclient-2.1.4/lib/httpclient.rb:837:inprotect_keep_alive_disconnected’
/data1/target_copy/gems/httpclient-2.1.4/lib/httpclient.rb:757:in
do_request' /data1/target_copy/gems/httpclient-2.1.4/lib/httpclient.rb:663:inrequest’
/data1/target_copy/gems/httpclient-2.1.4/lib/httpclient.rb:591:in post' /data1/target_copy/lib/soap/streamHandler.rb:238:insend_post’
/data1/target_copy/lib/soap/streamHandler.rb:172:in send' /data1/target_copy/lib/soap/rpc/proxy.rb:179:inroute’
/data1/target_copy/lib/soap/rpc/proxy.rb:143:in call' /data1/target_copy/lib/soap/rpc/driver.rb:181:incall’
(eval):6:in list' /data1/target_copy/lib/sm-utils.rb:338:inlist_targets’
/data1/target_copy/lib/sm-soap-utils.rb:111:in list_targets' /data1/target_copy/lib/tc-utils.rb:465:inget_global_targets_hash’
/data1/target_copy/lib/tc-actions.rb:97:in `main’
/data1/target_copy/www/target_copy.cgi:121

Any suggestions about how I might resolve this problem would be greatly
appreciated.

Thanks,

Brad


#2

I’ve determined that “include Buffering” is somehow being ignored for
class SSLSocket in file openssl/ssl.rb. Can anyone suggest a reason why
that could be happening?

(My working Windows version is patchlevel 111 but my non-working Linux
version is patchlevel 111. Could this account for anything? I can’t find
release notes that describe the changes between the patchlevels.)

Brad Whitaker wrote:

I’m having a problem with 1.8.6 and soap4r that I don’t understand. I’m
running within Apache as a CGI. I developed this code on a Windows box
and it works fine, but I’ve moved the code to my production Linux
environment and I get this error:

undefined method `close’ for #OpenSSL::SSL::SSLSocket:0xb790c024


#3

I resolved my problem. My load paths were ‘reversed’, i.e. the machine
specific path “/ruby/lib/ruby/1.8/i686-linux” was located before the
non-machine specific path “/ruby/lib/ruby/1.8”. The httpclient gem has a
statement “require openssl” that is intended to open file “openssl.rb”
but was opening “openssl.so” instead because of the unusual order of my
load paths. The end result was that various modules (mixins) that are
‘included’ in OpenSSL::SSL::SSLSocket (e.g. Buffering) were not being
loaded and were not augmenting the SSLSocket class.

Brad Whitaker wrote:

I’ve determined that “include Buffering” is somehow being ignored for
class SSLSocket in file openssl/ssl.rb. Can anyone suggest a reason why
that could be happening?

(My working Windows version is patchlevel 111 but my non-working Linux
version is patchlevel 111. Could this account for anything? I can’t find
release notes that describe the changes between the patchlevels.)

Brad Whitaker wrote:

I’m having a problem with 1.8.6 and soap4r that I don’t understand. I’m
running within Apache as a CGI. I developed this code on a Windows box
and it works fine, but I’ve moved the code to my production Linux
environment and I get this error:

undefined method `close’ for #OpenSSL::SSL::SSLSocket:0xb790c024