Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66836 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1460 invoked from network); 27 Mar 2013 16:26:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Mar 2013 16:26:35 -0000 Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.210.180 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.210.180 mail-ia0-f180.google.com Received: from [209.85.210.180] ([209.85.210.180:36521] helo=mail-ia0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 95/DC-30100-ABD13515 for ; Wed, 27 Mar 2013 11:26:35 -0500 Received: by mail-ia0-f180.google.com with SMTP id f27so7399275iae.39 for ; Wed, 27 Mar 2013 09:26:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=F9jU6w0EqS8qQcgAh4G1IKTCM9i7Py7BPGfLG9W0oEA=; b=KaQo7DzjgyggVZG0/DVp+fqv+Vjuqz+pSBxxDTrobdGsgoW/+LkoEECQlLosuSChBj WhD3O7JIBNsay8KQWBUezGpoNtKtjZ+Dj6tvBJh+4qkwsAJlfpl8M4tNW8G28KO1Z88M 893MLn2IwFd7HmCA+0IyPXSvUBHHRb2izql9T/7GZjO5nQ373uYV4ud3y05Vwv9wZZZ/ H8D38eX/bao519K0AcGhb6iKoNUHo22jl0QdcINbZcWaFHIPw0n18s2Rf0ygNYDrlOxC nh4lcQQXSec00xWXYrkmZZuRpCLvkOrX+nnB1IB5jzXjEQC8BLT28YXeQ/kLMvZ6qV2h L79w== MIME-Version: 1.0 X-Received: by 10.50.212.105 with SMTP id nj9mr4640761igc.17.1364401592313; Wed, 27 Mar 2013 09:26:32 -0700 (PDT) Received: by 10.50.66.207 with HTTP; Wed, 27 Mar 2013 09:26:32 -0700 (PDT) In-Reply-To: <7D873005-C72C-4BEB-BED2-46BF716F40BD@mujo.be> References: <7D873005-C72C-4BEB-BED2-46BF716F40BD@mujo.be> Date: Wed, 27 Mar 2013 17:26:32 +0100 Message-ID: To: Sam Hermans Cc: PHP Internals Content-Type: multipart/alternative; boundary=14dae93404a33dad8104d8ea8041 Subject: Re: [PHP-DEV] RFC ? gethostbyname - getnameinfo() From: tyra3l@gmail.com (Ferenc Kovacs) --14dae93404a33dad8104d8ea8041 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, Mar 27, 2013 at 1:39 PM, Sam Hermans wrote: > 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 the= m. > > 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 > > you mean REMOTE_ADDR? what SAPI are you using? AFAIK REMOTE_ADDR (as most other $_SERVER variables) is coming from the webserver itself: http://lxr.php.net/xref/PHP_5_5/sapi/apache/mod_php5.c#254 http://lxr.php.net/search?q=3DREMOTE_ADDR&defs=3D&refs=3D&path=3D&hist=3D&p= roject=3DPHP_5_5 I suppose it will contain whatever address your server received the request (be that an ipv4 or ipv6 address). on the other hand gethostbyname by definition returns an IPV4 address for the given host. this is the intended and documented behavior. there is an open feature request (with a patch) for changing that behavior to return IPv6 address: https://bugs.php.net/bug.php?id=3D49493&edit=3D1 personally I think that we should introduce this feature without breaking any BC, so a new function or a new optional argument should be added. --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --14dae93404a33dad8104d8ea8041--