Ah, and one more thing: The second argument to connect should really be int|string,
It already is. I implemented that days ago. :-)
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-04-24 21:02: Subject: Re: IPv6 diff for Pike 7.5.7 (today's snapshot)
Xavier Beaudouin kiwi@oav.net writes:
Imagine such entry :
127.0.0.1.mydomain.com. IN A 10.12.1.4 IN AAAA 3ffe::dead
And again, this doesn't look like an ipv6 issue, you have exactly the same problem with "search mydomain.com" in /etc/resolv.conf, and the single A record
127.0.0.1.mydomain.com. IN A 10.12.1.4
Most applications will map the string "127.0.0.1" to the ip address 127.0.0.1, but an application that tries dns first will map it to 10.12.1.4.
My answer to that is: Don't do it; that's a configuration recommended only to people who like to shoot themselves in the feet.
I think the following simple rules can be used for interpreting the string address argument to functions like Stdio.File->connect():
- If it contains a :, then it must be a numerical IPv6 address.
Convert it to an IPv6 address (or return an error if the syntax isn't right).
- If it contains a dot, but doesn't end with one, check if it's a
valid IPv4 address (and there's no need to support the old fashined variants of numerical IPv4 addresses with less than three dots). Convert it to an IPv4 address (or return an error if the syntax isn't right).
2a. (Alternative second rule) If it contains a dot, doesn't end with a dot, and the character after the last dot is a digit, then it must be a numerical IPv4 address. Convert it just as in (2).
- Otherwise, it must be a symbolic name. Resolve it using facilities
like the system's /etc/hosts file and the DNS system. The result from the resolution process determines if it's an IPv4 or IPv6 address (in general, the result is list of addresses, which need not all be of the same type).
Note that with these rules, you can try connect("127.0.0.1.", 80) to connect to the machine with the DNS name 127.0.0.1. Which will of course fail, because there's no .1 top domain ;-)
Ah, and one more thing: The second argument to connect should really be int|string, where a string is interpreted as a service name to be looked up using SRV records or the system's /etc/services file.
/Niels
/ Brevbäraren