# Openssl-nonblock 0.1.0

**URL:** <https://www.ruby-forum.com/t/openssl-nonblock-0-1-0/159696>\
**Category:** Ruby\
**Created:** [February 7, 2009, 7:50am UTC](https://www.ruby-forum.com/t/openssl-nonblock-0-1-0/159696 "2009-02-07T07:50:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![murfhy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@murfhy](https://www.ruby-forum.com/u/murfhy)\
**Post date:** [February 7, 2009, 7:50am UTC](https://www.ruby-forum.com/t/openssl-nonblock-0-1-0/159696/1 "2009-02-07T07:50:43Z")

</div>

Hi folks,

I’ve seen various requests for non-blocking OpenSSL support. As a  
maintainer of a non-blocking event library this was crucial for the  
stuff I  
was doing. I developed a C extension which uses some pretty crazy hacks  
to  
patch non-blocking support into the existing OpenSSL C extension.

As this can benefit people who aren’t using my event library, I’ve gone  
ahead and rolled this functionality into its own gem, which works on  
1.8.6,  
1.8.7, and 1.9.1:

github: [GitHub - tarcieri/openssl-nonblock: Non-blocking I/O support for Ruby OpenSSL](http://github.com/tarcieri/openssl-nonblock/tree/master)  
rubyforge: [http://rubyforge.org/frs/shownotes.php?release\_id=31150](http://rubyforge.org/frs/shownotes.php?release_id=31150)

This gem adds an additional four methods to OpenSSL::SSL::SSLSocket:  
connect\_nonblock, accept\_nonblock, read\_nonblock, and write\_nonblock.  
It  
also adds an additional two exceptions: OpenSSL::SSL::ReadAgain and  
OpenSSL::SSL::WriteAgain to handle cases where the system isn’t ready to  
perform the given I/O request.

I’ve seen some patches for this on the 1.9 Redmine (e.g.  
[http://redmine.ruby-lang.org/issues/show/814](http://redmine.ruby-lang.org/issues/show/814)) but they aren’t  
comprehensive  
and don’t address connect\_nonblock and accept\_nonblock.

I hope these issues get addressed by ruby-core eventually, but with this  
gem  
you can have non-blocking SSL I/O today.

And if you’re interested in non-blocking I/O in general, you might want  
to  
check out my event framework:

[http://rev.rubyforge.org/](http://rev.rubyforge.org/)

Enjoy!

---

<div class="post-metadata">

**Author:** ![murfhy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@murfhy](https://www.ruby-forum.com/u/murfhy)\
**Post date:** [February 7, 2009, 8:29pm UTC](https://www.ruby-forum.com/t/openssl-nonblock-0-1-0/159696/2 "2009-02-07T20:29:52Z")

</div>

On Sat, Feb 07, 2009 at 03:49:33PM +0900, Tony A. wrote:

> [http://redmine.ruby-lang.org/issues/show/814](http://redmine.ruby-lang.org/issues/show/814)) but they aren’t comprehensive  
> and don’t address connect\_nonblock and accept\_nonblock.
> 
> I hope these issues get addressed by ruby-core eventually, but with this gem  
> you can have non-blocking SSL I/O today.

Have you submitted patches to ruby-core?

---

<div class="post-metadata">

**Author:** ![murfhy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@murfhy](https://www.ruby-forum.com/u/murfhy)\
**Post date:** [February 7, 2009, 9:06pm UTC](https://www.ruby-forum.com/t/openssl-nonblock-0-1-0/159696/3 "2009-02-07T21:06:27Z")

</div>

On Sat, Feb 7, 2009 at 12:28 PM, Aaron P.  
\<removed\_email\_address@domain.invalid

> wrote:

> Have you submitted patches to ruby-core?

Not as yet, I decided I’d go through the few hour process of releasing  
them  
as a gem before going through the multi-month process of getting them  
accepted into Ruby 1.9.2

---

<div class="post-metadata">

**Author:** ![murfhy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@murfhy](https://www.ruby-forum.com/u/murfhy)\
**Post date:** [February 8, 2009, 6:55am UTC](https://www.ruby-forum.com/t/openssl-nonblock-0-1-0/159696/4 "2009-02-08T06:55:02Z")

</div>

On Sun, Feb 08, 2009 at 05:05:00AM +0900, Tony A. wrote:

> On Sat, Feb 7, 2009 at 12:28 PM, Aaron P. \<removed\_email\_address@domain.invalid
> 
> > wrote:
> 
> > Have you submitted patches to ruby-core?
> 
> Not as yet, I decided I’d go through the few hour process of releasing them  
> as a gem before going through the multi-month process of getting them  
> accepted into Ruby 1.9.2

My OpenSSL patch was accepted in less than 24 hours…

[http://redmine.ruby-lang.org/issues/show/814](http://redmine.ruby-lang.org/issues/show/814)

Open Date was 12/03/08, closed 12/04/08

If you don’t want to do it, I don’t mind. I’d definitely like to see  
these in ruby-core. 🙂
