WEBrick binds only to localhost, not to requested bind addresses
----------------------------------------------------------------
Key: JRUBY-3827
URL: http://jira.codehaus.org/browse/JRUBY-3827
Project: JRuby
Issue Type: Bug
Affects Versions: JRuby 1.3.1
Environment: JRuby 1.3.1 release (1.8.6 mode), Rails 2.3.2, Windows
2008 Server; headius also tested on OS X
Reporter: Christopher Jeris
Assignee: Thomas E Enebo
Starting an ordinary WEBrick server yields a server that listens only on
localhost, not on the requested binding:
> jruby script\server
=> Booting WEBrick
=> Rails 2.3.2 application starting on http://0.0.0.0:3000
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2009-07-22 12:17:28] INFO WEBrick 1.3.1
[2009-07-22 12:17:28] INFO ruby 1.8.6 (2009-06-15) [java]
[2009-07-22 12:17:28] INFO WEBrick::HTTPServer#start: pid=2260 port=3000
[2009-07-22 12:17:53] INFO going to shutdown ...
[2009-07-22 12:17:53] INFO WEBrick::HTTPServer#start done.
but netstat -an yields:
TCP 127.0.0.1:3000 0.0.0.0:0 LISTENING
Starting script\server with the --binding option, and supplying the actual
externally visible IP of the server, changes what is printed by WEBrick
startup, but does not change the result: the server is only bound to 127.0.0.1.
Here's what I've found out so far, which I may be interpreting wrongly. During
WEBrick startup, listener sockets are created by
WEBrick::Utils::create_listeners (webrick/utils.rb:59). This method calls
Socket.getaddrinfo(nil, 3000, Socket::AF_UNSPEC, Socket::SOCK_STREAM, 0,
Socket::AI_PASSIVE) to get the address to bind the socket to. The
documentation of Socket.getaddrinfo says that, in case Socket::AI_PASSIVE is
supplied, a 'host' argument of nil is supposed to be mapped onto the address
binding Socket::INADDR_ANY. This doesn't seem to be what happens -- the return
from Socket.getaddrinfo is ["AF_INET", 3000, "127.0.0.1", "127.0.0.1", 4, 1, 6].
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email