Integrated Webserver?

G

gabriele renzi

il Thu, 21 Aug 2003 16:44:19 GMT, Martin DeMello
The HTML form thread made me wonder if we shouldn't have some equivalent
of Perl's IndigoPerl: http://www.indigostar.com/indigoperl.htm

did you noticed that webrick exists and is now part of the standard
distribution?

cut&pasted code from webrick.org
#http server
#!/usr/local/bin/ruby
require 'webrick'
include WEBrick

s = HTTPServer.new(
:port => 2000,
:DocumentRoot => Dir::pwd + "/htdocs"
)

## mount subdirectories
s.mount("/ipr", HTTPServlet::FileHandler, "/proj/ipr/public_html")
s.mount("/~gotoyuzo",
HTTPServlet::FileHandler, "/home/gotoyuzo/public_html",
true) #<= allow to show directory index.
 
J

Joel VanderWerf

gabriele said:
#http server
#!/usr/local/bin/ruby
require 'webrick'
include WEBrick

s = HTTPServer.new(
:port => 2000,
:DocumentRoot => Dir::pwd + "/htdocs"
)

Looks nice. I tried this example (with minor modifications) and got

[2003-08-21 14:44:46] INFO WEBrick 1.3.1
[2003-08-21 14:44:46] INFO ruby 1.8.0 (2003-08-04) [i686-linux]
[2003-08-21 14:44:47] WARN TCPServer Error: Address family not
supported by protocol - socket(2)

Could it be because I'm trying to run it inside a 192.* network? (Tried
googling for that error message, but that didn't help much.)
 
D

Dan North

Joe said:
I didn't know about webrick. That is SO FRICKIN' COOL.
It just gets more and more ridiculous doesn't it?

I'm back to writing Java and I keep thinking to myself, every time I
type SomeFoo someFoo = new SomeFoo(), and then again every time I type a
semicolon, and every time I define a method with all the static typing
in the signature, WHY??

Thanks again Matz. If people don't get it, then it's their loss :)
 
E

Eric Hodel

--r/w8vo2lxBmCPGjQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Looks nice. I tried this example (with minor modifications) and got
=20
[2003-08-21 14:44:46] INFO WEBrick 1.3.1
[2003-08-21 14:44:46] INFO ruby 1.8.0 (2003-08-04) [i686-linux]
[2003-08-21 14:44:47] WARN TCPServer Error: Address family not=20
supported by protocol - socket(2)
=20
Could it be because I'm trying to run it inside a 192.* network? (Tried= =20
googling for that error message, but that didn't help much.)

Could it be trying to open an IPv6 socket? WEBrick is IPv6 aware...

--=20
Eric Hodel - (e-mail address removed) - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04


--r/w8vo2lxBmCPGjQ
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)

iD8DBQE/RmehMypVHHlsnwQRAkWqAJ0TgUZdlYcnD72zsb3UFTvXvcofxACfVtcA
HwGFxM5l2k47L7A2AxIOhgs=
=57a3
-----END PGP SIGNATURE-----

--r/w8vo2lxBmCPGjQ--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,109
Messages
2,570,671
Members
47,262
Latest member
EffiePju4

Latest Threads

Top