Actions
Bug #11179
closedInconsistent Addrinfo parsing a port number
Status:
Third Party's Issue
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0dev (2015-05-25 trunk 50637) [x86_64-linux]
Description
In the case of the following code, ip_port returns 34464 because the number 99999 is cast as short int
.
Is the result expected?
require 'socket'
Addrinfo.tcp('', 99999).ip_port # => 34463
Even if the above behavior is correct, ip_port should return 65535 in the following code. But actually, Addrinfo raises an exception because -1 is parsed as service name. This behavior is inconsistent with the above.
require 'socket'
Addrinfo.tcp('', -1).ip_port # => Servname not supported for ai_socktype (SocketError)
Actions
Like0
Like0Like0