Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78816 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46100 invoked from network); 6 Nov 2014 13:40:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Nov 2014 13:40:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=dunglas@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dunglas@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.48 as permitted sender) X-PHP-List-Original-Sender: dunglas@gmail.com X-Host-Fingerprint: 74.125.82.48 mail-wg0-f48.google.com Received: from [74.125.82.48] ([74.125.82.48:51494] helo=mail-wg0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6C/95-28384-A3A7B545 for ; Thu, 06 Nov 2014 08:40:11 -0500 Received: by mail-wg0-f48.google.com with SMTP id m15so1216740wgh.7 for ; Thu, 06 Nov 2014 05:40:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=TCIq4aGCJdpgPz3gVYzgkn0uLa02VjGrKn/aGcw0DiM=; b=DCEtQeZtSHZ2Lk5SvDHlKK1Ww/tEk33d/SFSyCeOfwizwhTdoooWH7mC9LHF8Z8kbN xggmEEDxgmHlv1K2Rnwr2QKqPbyiFJNxq9uANJ0q3kiNS+v4kPG4a42uYEWq/slP2j4L aCMB1YFsh8HqI5w2XJRPt7jXfRRAJBPfXjSK7/71eEBSWFIrPRtDWL4O77fsGZbSPQmm TR7ip2plenTScvp+jjYhIp0OG6HGD5hg8Ya9xpckzFG3NOXjTzLUFHsG3j5A5pwaIJs4 VZFeZNEgYAZpYkz81n0L7zSc/Y2KYhZdtnsyYoi/WewOSj6/vrhMSbrQK/Dt9pWqxHSt ZDgg== X-Received: by 10.180.9.33 with SMTP id w1mr41556296wia.22.1415281206358; Thu, 06 Nov 2014 05:40:06 -0800 (PST) MIME-Version: 1.0 Received: by 10.194.35.73 with HTTP; Thu, 6 Nov 2014 05:39:46 -0800 (PST) In-Reply-To: References: Date: Thu, 6 Nov 2014 14:39:46 +0100 Message-ID: To: Andrey Andreev Cc: Daniel Ribeiro , PHP Internals Content-Type: multipart/alternative; boundary=001a11c2406c9041cc050730d5c3 Subject: Re: [PHP-DEV] Better RFC conformance for FILTER_VALIDATE_URL From: dunglas@gmail.com (=?UTF-8?Q?K=C3=A9vin_Dunglas?=) --001a11c2406c9041cc050730d5c3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable FILTER_VALIDATE_DOMAIN checks conformance with DNS RFCs : total length, label length and allowed characters (_ are allowed in domain names but many other characters are forbidden such as ~/+...). I'll add IDN support too when IDN support for streams will be merged. FILTER_VALIDATE_URL checks conformance with URL RFCs (and not URI, as discussed on GitHub). URL's host part RFCs conformance implies DNS RFCs conformance, IPv4 and IPv6 RFCs conformance + some additional checks (no underscore allowed in hostnames and IPv6 enclosed with brackets for instance). It's why I've added the convenience flag FILTER_FLAG_HOSTNAME. Btw, there is many use case for validating that a string is a valid domain (or a valid hostname): hoster and registar apps, mail server management apps and anything else DNS related. Maybe be can we find a better name for FILTER_VALIDATE_DOMAIN. Such as FILTER_VALIDATE_DOMAIN_NAME or FILTER_VALIDATE_DNS_DOMAIN (a bit redundant, DNS =3D Domain Name System)= but please not something related "DNS Record" because a valid DNS record can have the following format: les-tilleuls.coop. 3600 IN SOA monsite.nnx.com .root.monsite.nnx.com. ( 2014092300 ; serial 21600 ; refresh (6 hours) 3600 ; retry (1 hour) 604800 ; expire (1 week) 86400 ; minimum (1 day) ) 2014-11-06 13:55 GMT+01:00 Andrey Andreev : > Hi, > > On Thu, Nov 6, 2014 at 8:19 AM, K=C3=A9vin Dunglas wr= ote: > > Hi Andrey, > > > > Sorry but I think you're wrong. Domain !=3D hostname. Underscore are > allowed > > in domains (RFC 2181) but not in hostnames (RFC 1123 and next). To quot= e > > Wikipedia: > > > > "While a hostname may not contain other characters, such as the > underscore > > character (_), other DNS names may contain the underscore. Systems such > > asDomainKeys and service records use the underscore as a means to assur= e > > that their special character is not confused with hostnames. For > > example,_http._sctp.www.example.com specifies a service pointer for an > SCTP > > capable webserver host (www) in the domain example.com." > > http://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names > > > > You can also see this StackOverflow answer > > http://stackoverflow.com/a/2183140/1352334 > > I agree to an extent, but that is highly contextual. > > Who said that 'domain' =3D=3D=3D 'DNS record' (which is a very broad term > anyway)? And IF we assume this, why do you need FILTER_VALIDATE_DOMAIN > for it if it's only going to check length? > > Cheers, > Andrey. > --=20 K=C3=A9vin Dunglas Consultant et d=C3=A9veloppeur freelance http://dunglas.fr T=C3=A9l. : 06 60 91 20 20 --001a11c2406c9041cc050730d5c3--