Re: RFC ? gethostbyname - getnameinfo()
| From: | Sam Hermans | Date: | Wed, 27 Mar 2013 21:38:18 +0000 |
| Subject: | Re: RFC ? gethostbyname - getnameinfo() | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-66844@lists.php.net to get a copy of this message | ||
Not sure,
I tried something locally and this is what i came up with (and what i think expected behaviour could
be)
<?php
echo "IPv6 preferred host (no A record, but CNAME to A):\n";
var_dump(gethostbyname("ipv6.google.com"));
echo "\nIPv4 preferred host with AAAA records: \n";
var_dump(gethostbyname("www.google.com"));
echo "\nIPv6 preferred host (no A record, but CNAME to A)\n";
var_dump(gethostbyname2("ipv6.google.com"));
echo "\nIPv4 preferred host with AAAA records:\n";
var_dump(gethostbyname2("www.google.com"));
echo "\nIPv4 preferred host with AAAA records and extra argument:\n";
var_dump(gethostbyname2("www.google.com",TRUE));
root@lucid32:/vagrant/php-5.4.13# ./sapi/cli/php run.php
IPv6 preferred host (no A record, but CNAME to A):
string(15) "ipv6.google.com"
IPv4 preferred host with AAAA records:
string(14) "173.194.66.103"
IPv6 preferred host (no A record, but CNAME to A)
string(22) "2a00:1450:400c:c05::68"
IPv4 preferred host with AAAA records:
string(14) "173.194.66.104"
IPv4 preferred host with AAAA records and extra argument:
string(22) "2a00:1450:400c:c03::68"
On 27 Mar 2013, at 15:34, Lars Strojny <lars@strojny.net> wrote:
> I agree, PHP should have world-class support for v6. What is your proposal exactly?
>
> Am 27.03.2013 um 13:39 schrieb Sam Hermans <sam@mujo.be>:
>
>> Hi,
>>
>> The rcf howto pushed me into mailing you guys to measure reaction.
>>
>> For a project i am working on i struggle a lot with the fact that
>> $_SERVER['REMOTE_ADDRESS'] return policy is to prefer IPv6 over IPv4, and that
>> gethostbyname prefers IPv4. It seems that the gethostbyname
>> function as used in php is deprecated, and that getnameinfo should be used.
>>
>> I think that in an age where we are finally getting the support of the *big* boys to start
>> using IPv6 that php should be there and ready for them.
>>
>> I have never contributed to php core before, but i'm more than happy to take the lead
>> on this one.
>>
>> Please let me know what you guys think, and thank you for your time.
>>
>> Kind regards,
>> Sam Hermans
>>
>>
>> --
>> PHP Internals - PHP Runtime Development Mailing List
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>