[#4522] Undefined Errno::EPROTO and the like raises NameError — "Florian Frank" <flori@...>
Hi,
[#4533] giving acces readline to rl_line_buffer — "Cs. Henk" <csaba-ml@...>
Hi!
[#4548] Ruby 1.8.2 array of hash entries functions incorrectly — noreply@...
Bugs item #1613, was opened at 2005-03-09 19:49
[#4561] rb_reg_quote weirdness — Nikolai Weibull <mailing-lists.ruby-core@...>
(Two weirdnesses in one day.)
Hi,
[#4567] Immutable Ropes — Nikolai Weibull <mailing-lists.ruby-core@...>
Note how I didn't write "Immutable Strings" in the subject.
[#4575] Allowing "?" in struct members — "Berger, Daniel" <Daniel.Berger@...>
Hi all,
[#4587] 0**0==1? — Bertram Scharpf <lists@...>
Hi,
[#4595] New block syntax — Daniel Amelang <daniel.amelang@...>
I'm really sorry if this isn't the place to talk about this. I've
Daniel Amelang wrote:
Hi --
On Monday 21 March 2005 16:17, David A. Black wrote:
Hi --
Hey David, I think that we've had some misunderstandings due to
Hi --
On Wednesday 30 March 2005 20:55, David A. Black wrote:
On Sunday 20 March 2005 21:31, Daniel Amelang wrote:
[#4601] Re: New block syntax — "Berger, Daniel" <Daniel.Berger@...>
> -----Original Message-----
[#4611] want_object? - possible? — "Berger, Daniel" <Daniel.Berger@...>
Hi all,
[#4619] Re: want_object? - possible? — Daniel Berger <djberg96@...>
--- nobu.nokada@softhome.net wrote:
Hi --
On 3/24/05, David A. Black <dblack@wobblini.net> wrote:
Hi --
On 4/14/05, David A. Black <dblack@wobblini.net> wrote:
On 14 Apr 2005, at 22:20, Mark Hubbart wrote:
On 4/15/05, Eric Hodel <drbrain@segment7.net> wrote:
[#4622] tempfile.rb — Tilman Sauerbeck <tilman@...>
Hi,
[#4648] about REXML::Encoding — speakillof <speakillof@...>
Hi.
On Thursday 31 March 2005 09:44, speakillof wrote:
Hi.
I've tested, applied, and committed your Encoding patch, Nobu.
Hi,
URI.parse and Socket.getaddrinfo don't cooperate with IPv6 addresses
irb(main):002:0> URI.parse("http://[::1]").host
=> "[::1]"
irb(main):003:0> Socket.getaddrinfo("[::1]", nil)
SocketError: getaddrinfo: No address associated with nodename
from (irb):3:in `getaddrinfo'
from (irb):3
I think that URI should remove the [] from the host part when it parses,
and add it back in when it builds.
I see this problem propogates itself up through net/http, open-uri,
etc... None of these APIs seem to accept IPv6 URIs (at least not ::1,
loopback, the only one I can connect to).
It also won't encode IPv6 addresses:
URI::HTTP.build(:scheme => 'http', :host => '::1').to_s
URI::InvalidComponentError: bad component(expected host component): ::1
from /usr/local/lib/ruby/1.8/uri/generic.rb:380:in `check_host'
...
This works:
URI::HTTP.build(:scheme => 'http', :host => '[::1]').to_s)
=> "http://[::1]"
But it's URI's job to know the IPv6 URI syntax, not mine!
This could also be patched in Socket.getaddrinfo, but I don't think
thats the place, its complicated enough already.
Cheers,
Sam
/*
* Document-method: getaddrinfo
* call-seq: Socket.getaddrinfo(host, service, family=nil, socktype=nil, protocol=nil, flags=nil) => ainfo
*
* Return address information for +host+ and +port+. The remaining arguments
* are hints that limit the address information returned.
*
* This method corresponds closely to the POSIX.1g getaddrinfo() definition.
*
* === Parameters
* - +host+ is a host name or an address string (dotted decimal for IPv4, or a hex string
* for IPv6) for which to return information. A nil is also allowed, its meaning
* depends on +flags+, see below.
* - +service+ is a service name ("http", "ssh", ...), or
* a port number (80, 22, ...), see Socket.getservbyname for more
* information. A nil is also allowed, meaning zero.
* - +family+ limits the output to a specific address family, one of the
* Socket::AF_* constants. Socket::AF_INET (IPv4) and Socket::AF_INET6 (IPv6)
* are the most commonly used families. You will usually pass either nil or
* Socket::AF_UNSPEC, allowing the IPv6 information to be returned first if
* +host+ is reachable via IPv6, and IPv4 information otherwise. The two
* strings "AF_INET" or "AF_INET6" are also allowed, they are converted to
* their respective Socket::AF_* constants.
* - +socktype+ limits the output to a specific type of socket, one of the
* Socket::SOCK_* constants. Socket::SOCK_STREAM (for TCP) and
* Socket::SOCK_DGRAM (for UDP) are the most commonly used socket types. If
* nil, then information for all types of sockets supported by +service+ will
* be returned. You will usually know what type of socket you intend to
* create, and should pass that socket type in.
* - +protocol+ limits the output to a specific protocol numpber, one of the
* Socket::IPPROTO_* constants. It is usually implied by the socket type
* (Socket::SOCK_STREAM => Socket::IPPROTO_TCP, ...), if you pass other than
* nil you already know what this is for.
* - +flags+ is one of the Socket::AI_* constants. They mean:
* - Socket::AI_PASSIVE: when set, if +host+ is nil the 'any' address will be
* returned, Socket::INADDR_ANY or 0 for IPv4, "0::0" or "::" for IPv6. This
* address is suitable for use by servers that will bind their socket and do
* a passive listen, thus the name of the flag. Otherwise the local or
* loopback address will be returned, this is "127.0.0.1" for IPv4 and "::1'
* for IPv6.
* - ...
*
*
* === Returns
*
* Returns an array of arrays, where each subarray contains:
* - address family, a string like "AF_INET" or "AF_INET6"
* - port number, the port number for +service+
* - host name, either a canonical name for +host+, or it's address in presentation
* format if the address could not be looked up.
* - host IP, the address of +host+ in presentation format
* - address family, as a numeric value (one of the Socket::AF_* constants).
* - socket type, as a numeric value (one of the Socket::SOCK_* constants).
* - protocol number, as a numeric value (one of the Socket::IPPROTO_* constants).
*
* The first four values are identical to what is commonly returned as an
* address array, see IPSocket for more information.
*
* === Examples
*
* Not all input combinations are valid, and while there are many combinations,
* only a few cases are common.
*
* A typical client will call getaddrinfo with the +host+ and +service+ it
* wants to connect to. It knows that it will attempt to connect with either
* TCP or UDP, and specifies +sockettype+ accordingly. It loops through all
* returned addresses, and try to connect to them in turn:
*
* ainfo = Socket::getaddrinfo('www.example.com', 'www', nil, Socket::SOCK_STREAM)
* ainfo.each do |af, port, name, addr|
* begin
* sock = TCPSocket.new(addr, port)
* # ...
* exit 1
* rescue
* end
* end
*
* With UDP you don't know if connection suceeded, but if communication fails,
* the next address can be tried.
*
* A typical server will call getaddrinfo with a +host+ of nil, the +service+
* it listens to, and a +flags+ of Socket::AI_PASSIVE. It will listen for
* connections on the first returned address:
* ainfo = Socket::getaddrinfo(nil, 'www', nil, Socket::SOCK_STREAM, nil, Socket::AI_PASSIVE)
* af, port, name, addr = ainfo.first
* sock = TCPServer(addr, port)
* while( client = s.accept )
* # ...
* end
*/