[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

WEBrick::HTTPServer config

Mike Houghton

1/31/2007 3:38:00 PM

I've copied some basic code for an HTTPS server

===============
require 'webrick'
require 'webrick/https'

httpserver = WEBrick::HTTPServer.new(
:Port => 2000,
:DocumentRoot => Dir::pwd + "/htdocs",
:SSLEnable => true,
:SSLVerifyClient => ::OpenSSL::SSL::VERIFY_NONE,
:SSLCertName => [ ["C","JP"], ["O","WEBrick.Org"], ["CN", "WWW"] ]
)
===============

My question is does anyone know the full set of parameters that can be
supplied to HTTPServer.new ?
I can't find anything the the documentation and google/websearch doesn't
give much.

Thanks

--
Posted via http://www.ruby-....

3 Answers

Eric Hodel

1/31/2007 7:07:00 PM

0

On Jan 31, 2007, at 07:38, Mike Houghton wrote:

> I've copied some basic code for an HTTPS server
>
> ===============
> require 'webrick'
> require 'webrick/https'
>
> httpserver = WEBrick::HTTPServer.new(
> :Port => 2000,
> :DocumentRoot => Dir::pwd + "/htdocs",
> :SSLEnable => true,
> :SSLVerifyClient => ::OpenSSL::SSL::VERIFY_NONE,
> :SSLCertName => [ ["C","JP"], ["O","WEBrick.Org"], ["CN", "WWW"] ]
> )
> ===============
>
> My question is does anyone know the full set of parameters that can be
> supplied to HTTPServer.new ?
> I can't find anything the the documentation and google/websearch
> doesn't
> give much.

WEBrick::Config has a bunch more.

Timeshifter

2/1/2007 3:29:00 PM

0

Did you check: http://microjet.ath.cx/webrickguide/html/html_we...
& http://microjet.ath.cx/webrickguide/html/Server_Configur...
in specific?

Cheers,

Patrick.
--
On 31 jan, 20:07, Eric Hodel <drbr...@segment7.net> wrote:
> On Jan 31, 2007, at 07:38, Mike Houghton wrote:
>
>
>
>
>
> > I've copied some basic code for an HTTPS server
>
> > ===============
> > require 'webrick'
> > require 'webrick/https'
>
> > httpserver = WEBrick::HTTPServer.new(
> > :Port => 2000,
> > :DocumentRoot => Dir::pwd + "/htdocs",
> > :SSLEnable => true,
> > :SSLVerifyClient => ::OpenSSL::SSL::VERIFY_NONE,
> > :SSLCertName => [ ["C","JP"], ["O","WEBrick.Org"], ["CN", "WWW"] ]
> > )
> > ===============
>
> > My question is does anyone know the full set of parameters that can be
> > supplied to HTTPServer.new ?
> > I can't find anything the the documentation and google/websearch
> > doesn't
> > give much.
>
> WEBrick::Config has a bunch more.- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -


Mike Houghton

2/1/2007 3:47:00 PM

0

Patrick Wauters wrote:
> Did you check:
> http://microjet.ath.cx/webrickguide/html/html_we...
> & http://microjet.ath.cx/webrickguide/html/Server_Configur...
> in specific?
>
> Cheers,
>
> Patrick.
> --

Thanks for the replies guys.

I've got a little further but still struggling (Ruby newbie!)
I've created an SSL key (key.pem) and certificate (cert.pem) using
OpenSSL and have incorporated them into ruby like this

================
pkey = cert = cert_name = nil
begin

pkey =
OpenSSL::PKey::RSA.new(File.read("/home/mhoughton/sslcert/key.pem"))

cert =
OpenSSL::X509::Certificate.new(File.read("/home/mhoughton/sslcert/cert.pem"))
rescue
$stderr.puts "Switching to use self-signed certificate"
cert_name = [ ["C","JP"], ["O","WEBrick.Org"], ["CN", "WWW"] ]
end


s=WEBrick::HTTPServer.new(

:Port => 8080,
:Logger => WEBrick::Log::new($stderr, WEBrick::Log::DEBUG),
:DocumentRoot => "/usr/local/webrick/htdocs",
:SSLEnable => true,
#:SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE,
:SSLCertificate => cert,
:SSLPrivateKey => pkey,
:SSLCertName => cert_name
)
s.start
==============

The key and certificate files are present(!) and can be read using
File.read()
but the code bombs out on RSA.new() ( or on Certificate.new if I swap
the order)
and the rescue block is executed and the created HTTPServer doesn't use
the supplied key and certificate.

What am I doing wrong?

Thanks

Mike



--
Posted via http://www.ruby-....