Good Evening (or maybe morrning in your neck of the world)

On Fri, Sep 25, 2009 at 1:41 PM, born in USSR <psixxx / bk.ru> wrote:

> i need to make secure connection between this rubyserver and web-browser
>
> ruby code:
> > require "openssl"
> > require 'socket'
> > port = 443
> > ctx = OpenSSL::SSL::SSLContext.new()
> > ctx.ciphers = "ADH"
> > tcps = TCPServer.new(port)
> > ssls = OpenSSL::SSL::SSLServer.new(tcps, ctx)
> > while (session = ssls.accept) # !program interrupts here!
> >   puts session.gets
> >   session.puts Time.new
> >   session.close
> > end
>
> in browser i enter "127.0.0.1:443" and in console i can watch
>

First, you are making a http://127.0.0.1:443 call from your browser to an
https server - http != https :)

Second, I would strongly suggset you not go down this path - you want to
write your ruby server/app and not an https server. Tools like nginx + thin
+ rack (with your app attaching as a rack middleware) would make so much
more sense in 99% of cases. It might take a small amount of time to write up
the config files for the pieces but they are strong solid workhorses that
you aren't going to readily duplicate.

John