# GServer and SSL

**URL:** <https://www.ruby-forum.com/t/gserver-and-ssl/182536>\
**Category:** Ruby\
**Created:** [January 29, 2010, 3:17pm UTC](https://www.ruby-forum.com/t/gserver-and-ssl/182536 "2010-01-29T15:17:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![barorg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a88e57/32.png) [@barorg](https://www.ruby-forum.com/u/barorg)\
**Post date:** [January 29, 2010, 3:17pm UTC](https://www.ruby-forum.com/t/gserver-and-ssl/182536/1 "2010-01-29T15:17:08Z")

</div>

I’ve got some code that uses GServer rather heavily, and I’m wondering,  
if I need to use secure sockets, is there any example of how to use  
GServer with and SSL layer?

---

<div class="post-metadata">

**Author:** ![barorg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a88e57/32.png) [@barorg](https://www.ruby-forum.com/u/barorg)\
**Post date:** [January 30, 2010, 5:33pm UTC](https://www.ruby-forum.com/t/gserver-and-ssl/182536/2 "2010-01-30T17:33:50Z")

</div>

Gal Bar-or wrote:

> I’ve got some code that uses GServer rather heavily, and I’m wondering,  
> if I need to use secure sockets, is there any example of how to use  
> GServer with and SSL layer?

You could have a look at ruby-ldapserver, which is something I wrote a  
long time ago. It doesn’t actually use GServer as I didn’t know about it  
at the time; it has its own server class with an accept loop. But it  
does wrap OpenSSL so that you can do SSL-on-connect, or SSL upgrade  
within an existing connection.

Important files:

ldap/server/tcpserver.rb  
ldap/server/connection.rb

(and look for @opt[:ssl\_on\_connect])
