Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tarcieri/openssl-nonblock
Non-blocking I/O support for Ruby OpenSSL
https://github.com/tarcieri/openssl-nonblock
Last synced: about 1 month ago
JSON representation
Non-blocking I/O support for Ruby OpenSSL
- Host: GitHub
- URL: https://github.com/tarcieri/openssl-nonblock
- Owner: tarcieri
- License: other
- Created: 2009-02-06T21:22:08.000Z (almost 16 years ago)
- Default Branch: master
- Last Pushed: 2009-12-16T06:49:20.000Z (almost 15 years ago)
- Last Synced: 2024-05-01T23:13:26.320Z (7 months ago)
- Language: C
- Homepage: http://rev.rubyforge.org/
- Size: 122 KB
- Stars: 15
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.textile
- Changelog: CHANGES
- License: LICENSE
Awesome Lists containing this project
README
h1. openssl-nonblock
Ruby 1.9.2 added non-blocking counterparts to its core OpenSSL methods,
including connect_nonblock, read_nonblock, etc. However, there's no reason
you can't have these methods today on any recent version of Ruby.With a bit of crazy C hackery, this module will patch existing versions of
Ruby, including 1.8.6, 1.8.7, and 1.9.1 to include non-blocking SSL support.h2. Installation
openssl-nonblock is installable as a gem. Just run:
gem install openssl-nonblock
to install it.
Alternatively, you may build it from the git repo. Run:
rake gem
to build a gem in the package directory, then:
gem install pkg/openssl-nonblock-X.Y.Z.gem
to install it.
h2. Usage
Once the openssl-nonblock gem has been installed, use:
require 'openssl/nonblock'
to include non-blocking SSL support in your program. This will also pull in
the 'openssl' library if you haven't required it already.h2. Additional methods
The openssl-nonblock gem adds four new methods to the OpenSSL::SSL::SSLSocket
class. These methods are:* connect_nonblock: connect to an SSL server
* accept_nonblock: accept an SSL connection
* read_nonblock(length): read up to the given length, but don't block
* write_nonblock(data): write as much of the given data as possible without blockingh2. Exceptions
openssl-nonblock raises one of two exceptions when it would otherwise need to
block. These exceptions are raised from any of the nonblocking methods that
openssl-nonblock adds and need to be properly handled:* IO::WaitReadable: this means OpenSSL needs to read more data to complete the
given request. You should wait until the underlying IO object becomes
readable again before retrying the request.
* IO::WaitWritable similar to above, except OpenSSL is trying to write data to
the IO object, and the IO object is not presently writable. You should wait
until the object becomes writable again before retrying the request.h2. Problems?
openssl-nonblock is a subcomponent of Rev, an event library for Ruby. Please
address any questions about openssl-ruby to the rev-talk mailing list at:"http://rubyforge.org/mailman/listinfo/rev-talk":http://rubyforge.org/mailman/listinfo/rev-talk
Additional information about Rev is available at:
"http://rev.rubyforge.org":http://rev.rubyforge.org