# WEBrick::HTTPServer config

**URL:** <https://www.ruby-forum.com/t/webrick-httpserver-config/84023>\
**Category:** Ruby\
**Created:** [January 31, 2007, 4:38pm UTC](https://www.ruby-forum.com/t/webrick-httpserver-config/84023 "2007-01-31T16:38:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghoti143](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@ghoti143](https://www.ruby-forum.com/u/ghoti143)\
**Post date:** [January 31, 2007, 4:38pm UTC](https://www.ruby-forum.com/t/webrick-httpserver-config/84023/1 "2007-01-31T16:38:13Z")

</div>

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](http://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

---

<div class="post-metadata">

**Author:** ![ghoti143](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@ghoti143](https://www.ruby-forum.com/u/ghoti143)\
**Post date:** [January 31, 2007, 8:07pm UTC](https://www.ruby-forum.com/t/webrick-httpserver-config/84023/2 "2007-01-31T20:07:57Z")

</div>

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

> # :SSLVerifyClient =\> ::OpenSSL::SSL::VERIFY\_NONE, :SSLCertName =\> [[“C”,“JP”], [“O”,“[WEBrick.Org](http://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.

---

<div class="post-metadata">

**Author:** ![ghoti143](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@ghoti143](https://www.ruby-forum.com/u/ghoti143)\
**Post date:** [February 1, 2007, 4:30pm UTC](https://www.ruby-forum.com/t/webrick-httpserver-config/84023/3 "2007-02-01T16:30:34Z")

</div>

Did you check:  
[http://microjet.ath.cx/webrickguide/html/html\_webrick.html](http://microjet.ath.cx/webrickguide/html/html_webrick.html)  
& [http://microjet.ath.cx/webrickguide/html/Server\_Configuration.html](http://microjet.ath.cx/webrickguide/html/Server_Configuration.html)  
in specific?

Cheers,

## Patrick.

---

<div class="post-metadata">

**Author:** ![ghoti143](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@ghoti143](https://www.ruby-forum.com/u/ghoti143)\
**Post date:** [February 1, 2007, 4:47pm UTC](https://www.ruby-forum.com/t/webrick-httpserver-config/84023/4 "2007-02-01T16:47:22Z")

</div>

Patrick Wauters wrote:

> Did you check:  
> [http://microjet.ath.cx/webrickguide/html/html\_webrick.html](http://microjet.ath.cx/webrickguide/html/html_webrick.html)  
> & [http://microjet.ath.cx/webrickguide/html/Server\_Configuration.html](http://microjet.ath.cx/webrickguide/html/Server_Configuration.html)  
> 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](http://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
