TCPServer should bind to INADDR_ANY given empty string as hostname
------------------------------------------------------------------

                 Key: JRUBY-3565
                 URL: http://jira.codehaus.org/browse/JRUBY-3565
             Project: JRuby
          Issue Type: Bug
          Components: Extensions
    Affects Versions: JRuby 1.2
         Environment: Mac OS X 10.5, presumably all OSes
            Reporter: Clayton Wheeler
            Priority: Minor
         Attachments: tcp-bind-rubyspec.patch, tcp-bind.patch

Similarly to JRUBY-3564 for UDP, TCPServer.new should interpret the empty 
string passed as a hostname to mean INADDR_ANY (0.0.0.0) instead of the 
loopback address (127.0.0.1). This is the MRI behavior.

I have created a RubySpec patch for this and attached it, to indicate the 
problem. This new RubySpec passes out of the box on MRI, but fails on JRuby. I 
will submit this to RubySpec.

I have also attached a simple patch for RubyTCPServer to fix this behavior. 

==== Before ====

$ ./spec/mspec/bin/mspec run -t j spec/ruby/library/socket/tcpserver/
jruby 1.2.0 (ruby 1.8.6 patchlevel 287) (2009-04-11 rev 9531) [i386-java]
......F.

1)
TCPServer.new binds to INADDR_ANY if the hostname is empty FAILED
Expected "localhost"
 to equal "0.0.0.0"

/Users/csw/src/jruby-1_2/spec/ruby/library/socket/tcpserver/new_spec.rb:39
/Users/csw/src/jruby-1_2/spec/ruby/library/socket/tcpserver/new_spec.rb:4
/Users/csw/src/jruby-1_2/spec/ruby/library/socket/tcpserver/new_spec.rb:55:in 
`load'

Finished in 0.301000 seconds

7 files, 8 examples, 19 expectations, 1 failure, 0 errors

==== After ====

$ ./spec/mspec/bin/mspec run -t j spec/ruby/library/socket/tcpserver/
jruby 1.2.0 (ruby 1.8.6 patchlevel 287) (2009-04-11 rev 9531) [i386-java]
........

Finished in 0.328000 seconds

7 files, 8 examples, 20 expectations, 0 failures, 0 errors



-- 
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


Reply via email to