The HTML form thread made me wonder if we shouldn’t have some equivalent
of Perl’s IndigoPerl: http://www.indigostar.com/indigoperl.htm
How hard would such a thing be to integrate with the WindowsInstaller?
martin
The HTML form thread made me wonder if we shouldn’t have some equivalent
of Perl’s IndigoPerl: http://www.indigostar.com/indigoperl.htm
How hard would such a thing be to integrate with the WindowsInstaller?
martin
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”
)
s.mount(“/ipr”, HTTPServlet::FileHandler, “/proj/ipr/public_html”)
s.mount(“/~gotoyuzo”,
HTTPServlet::FileHandler, “/home/gotoyuzo/public_html”,
true) #<= allow to show directory index.
il Thu, 21 Aug 2003 16:44:19 GMT, Martin DeMello martindemello@yahoo.com ha scritto::
The HTML form thread made me wonder if we shouldn’t have some equivalent
of Perl’s IndigoPerl: http://www.indigostar.com/indigoperl.htm
gabriele renzi wrote:
#http server
#!/usr/local/bin/ruby
require ‘webrick’
include WEBricks = 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.)
Very neat! I admit that I didn’t know exactly what webrick was; I’d just
assumed that since no one mentioned a pure ruby http server in the other
thread, there wasn’t an easy-to-use one available.
martin
gabriele renzi surrender_it@remove.yahoo.it wrote:
il Thu, 21 Aug 2003 16:44:19 GMT, Martin DeMello > martindemello@yahoo.com ha scritto::
The HTML form thread made me wonder if we shouldn’t have some equivalent
of Perl’s IndigoPerl: http://www.indigostar.com/indigoperl.htmdid you noticed that webrick exists and is now part of the standard
distribution?
did you noticed that webrick exists and is now part of the standard
distribution?
I didn’t know about webrick. That is SO FRICKIN’ COOL.
dunno if it could possibly get confused, this it’s working fine for
me:
require ‘webrick’
include WEBrick
s = HTTPServer.new(
:Port => 2000,
:DocumentRoot => “/”
)
s.mount(“/my”, HTTPServlet::FileHandler, ‘C:\pubs’,true)
s.start
it seems that you could try passing
:BindAddress =>your_chosen_addr
possibly you have multiple net interface and this confuses the script?
or maybe you could contact the author to check if you discovered a bug
il Fri, 22 Aug 2003 07:04:38 +0900, Joel VanderWerf vjoel@PATH.Berkeley.EDU ha scritto::
[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?
Joe Cheng wrote:
did you noticed that webrick exists and is now part of the standard
distribution?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
–
Dan North
Could it be trying to open an IPv6 socket? WEBrick is IPv6 aware…
Joel VanderWerf (vjoel@PATH.Berkeley.EDU) wrote:
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.)
–
Eric Hodel - drbrain@segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04
Hi,
In message 3F4541D9.8060403@path.berkeley.edu,
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.)
If you want to run WEBrick only in IPv4 network,
:BindAddress option may be useful.
s = HTTPServer.new(
:Port => 2000,
:DocumentRoot => Dir::pwd + “/htdocs”,
:BindAddress => “0.0.0.0”
)
I think the error may come from the incompatibility of
getaddrinfo. What result does the following one-liner
become?
% ruby -r socket -ve ‘p Socket::getaddrinfo(nil,2000,
Socket::AF_UNSPEC,Socket::SOCK_STREAM,0,Socket::AI_PASSIVE)’
try to push _why to add a section on it in his “what’s new” page
il Fri, 22 Aug 2003 05:22:50 GMT, “Joe Cheng” code@joecheng.com ha scritto::
did you noticed that webrick exists and is now part of the standard
distribution?I didn’t know about webrick. That is SO FRICKIN’ COOL.
GOTOU Yuuzou wrote:
Hi,
In message 3F4541D9.8060403@path.berkeley.edu,
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.)If you want to run WEBrick only in IPv4 network,
:BindAddress option may be useful.s = HTTPServer.new(
:Port => 2000,
:DocumentRoot => Dir::pwd + “/htdocs”,
:BindAddress => “0.0.0.0”
)
Well, that’s some progress. Now the output is:
[2003-08-23 00:30:24] INFO WEBrick 1.3.1
[2003-08-23 00:30:24] INFO ruby 1.8.0 (2003-08-04) [i686-linux]
But the process does not stay around (according to ps -Af | grep ruby
), and my browser can’t connect to anything at the ports I tried
(2000, 9000, 9123).
I also tried
:BindAddress => “192.168.1.3”
That’s the ip of my host.
I think the error may come from the incompatibility of
getaddrinfo. What result does the following one-liner
become?% ruby -r socket -ve ‘p Socket::getaddrinfo(nil,2000,
Socket::AF_UNSPEC,Socket::SOCK_STREAM,0,Socket::AI_PASSIVE)’
$ ruby -r socket -ve ‘p
Socket::getaddrinfo(nil,2000,Socket::AF_UNSPEC,Socket::SOCK_STREAM,0,Socket::AI_PASSIVE)’
ruby 1.8.0 (2003-08-04) [i686-linux]
[[“AF_INET6”, 2000, “::”, “::”, 10, 1, 6], [“AF_INET”, 2000, “0.0.0.0”,
“0.0.0.0”, 2, 1, 6]]
`Joel VanderWerf vjoel@PATH.Berkeley.EDU’ wrote:
Hi,
In message 3F4719A3.4080903@path.berkeley.edu,
GOTOU Yuuzou wrote:
If you want to run WEBrick only in IPv4 network,
:BindAddress option may be useful.s = HTTPServer.new(
:Port => 2000,
:DocumentRoot => Dir::pwd + “/htdocs”,
:BindAddress => “0.0.0.0”
)Well, that’s some progress. Now the output is:
[2003-08-23 00:30:24] INFO WEBrick 1.3.1
[2003-08-23 00:30:24] INFO ruby 1.8.0 (2003-08-04) [i686-linux]But the process does not stay around (according to
ps -Af | grep ruby
), and my browser can’t connect to anything at the ports I tried
(2000, 9000, 9123).
Hmm, it seems that your code didn’t call HTTPServer#start.
Could you try the following code?
require ‘webrick’
s = WEBrick::HTTPServer.new(
:Port => 2000,
:BindAddress => “0.0.0.0”,
:DocumentRoot => Dir::pwd,
:Logger => WEBrick::Log.new($stderr, WEBrick::Log::DEBUG)
)
trap(“INT”){ s.shutdown }
s.start
$ ruby -r socket -ve ‘p
Socket::getaddrinfo(nil,2000,Socket::AF_UNSPEC,Socket::SOCK_STREAM,0,Socket::AI_PASSIVE)’
ruby 1.8.0 (2003-08-04) [i686-linux]
[[“AF_INET6”, 2000, “::”, “::”, 10, 1, 6], [“AF_INET”, 2000, “0.0.0.0”,
“0.0.0.0”, 2, 1, 6]]
it seems ok.
GOTOU Yuuzou wrote:
Hmm, it seems that your code didn’t call HTTPServer#start.
Could you try the following code?
That’s it. Thanks!