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

**URL:** <https://www.ruby-forum.com/t/undefined-method-close-for-openssl-sslsocket/166119>\
**Category:** Ruby\
**Created:** [April 22, 2009, 1:56am UTC](https://www.ruby-forum.com/t/undefined-method-close-for-openssl-sslsocket/166119 "2009-04-22T01:56:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bwinborg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/51bf81/32.png) [@bwinborg](https://www.ruby-forum.com/u/bwinborg)\
**Post date:** [April 22, 2009, 1:56am UTC](https://www.ruby-forum.com/t/undefined-method-close-for-openssl-sslsocket/166119/1 "2009-04-22T01:56:38Z")

</div>

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:in`close’  
/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:in`do\_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:in`protect\_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:in`request’  
/data1/target\_copy/gems/httpclient-2.1.4/lib/httpclient.rb:591:in `post' /data1/target_copy/lib/soap/streamHandler.rb:238:in`send\_post’  
/data1/target\_copy/lib/soap/streamHandler.rb:172:in `send' /data1/target_copy/lib/soap/rpc/proxy.rb:179:in`route’  
/data1/target\_copy/lib/soap/rpc/proxy.rb:143:in `call' /data1/target_copy/lib/soap/rpc/driver.rb:181:in`call’  
(eval):6:in `list' /data1/target_copy/lib/sm-utils.rb:338:in`list\_targets’  
/data1/target\_copy/lib/sm-soap-utils.rb:111:in `list_targets' /data1/target_copy/lib/tc-utils.rb:465:in`get\_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

---

<div class="post-metadata">

**Author:** ![bwinborg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/51bf81/32.png) [@bwinborg](https://www.ruby-forum.com/u/bwinborg)\
**Post date:** [April 22, 2009, 11:13pm UTC](https://www.ruby-forum.com/t/undefined-method-close-for-openssl-sslsocket/166119/2 "2009-04-22T23:13:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bwinborg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/51bf81/32.png) [@bwinborg](https://www.ruby-forum.com/u/bwinborg)\
**Post date:** [April 23, 2009, 2:50am UTC](https://www.ruby-forum.com/t/undefined-method-close-for-openssl-sslsocket/166119/3 "2009-04-23T02:50:19Z")

</div>

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
