#31923 [Bgs]: file_get_contents() does not accept urls containing hypen period "-."
| From: | pollita@php.net | Date: | Sat, 12 Feb 2005 16:52:11 +0000 |
| Subject: | #31923 [Bgs]: file_get_contents() does not accept urls containing hypen period "-." | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-73946@lists.php.net to get a copy of this message | ||
ID: 31923
Updated by: pollita@php.net
Reported By: mike-bugs dot php dot net at webheat dot co dot uk
Status: Bogus
Bug Type: Filesystem function related
Operating System: Linux
PHP Version: 4.3.10
New Comment:
"gethostbyname() (Used by the network streams code among other parts of
PHP) treats this correctly according to RFC specification."
I can see this statement being inobvious. I mean the gehostbyname()
function defined by the host systems standard C library. You
assumption that PHP's network code does not attempt to validate the
hostname before passing it on to the the system for resolution. It
works on some systems because on those systems the value is encoded
into a DNS packet and sent to the DNS server unmangled. On other
systems, a validation check is performed first and if it doesn't pass,
then it doesn't bother waiting for a network round trip, instead simply
returning a failure.
Previous Comments:
------------------------------------------------------------------------
[2005-02-12 17:17:11] mike-bugs dot php dot net at webheat dot co dot
uk
Thanks Magnus.
This does explain possible behaviour but doesn't explain why 2 Windows
PHP installs work fine but 2 Linux PHP installs (as installed by my
hosting company) do not.
This seems to imply that file_get_contents() doesn't validate the DNS
compliance of the arguement.
Also referring to the previously note from Pollita, as forgiving as the
browser maybe the DNS servers involved in the lookup of
http://mark-.deviantart.com are the ones that are dealing
with this
more so from what I know.
The deviantart.com DNS server software also seems to be forgiving, not
just of look ups of this kind but of creating new record of this kind
too, as the DNS entry would have been created when the user mark-
signed up his account with Deviantart.com
------------------------------------------------------------------------
[2005-02-12 06:21:56] magnus@php.net
It should be RFC883 (page 56) not RFC833.
http://www.faqs.org/rfcs/rfc883.html
"The labels must follow the rules for ARPANET host names. They must
start with a letter, end with a letter or digit, and have as interior
characters only letters, digits, and hyphen."
------------------------------------------------------------------------
[2005-02-12 00:02:20] mike-bugs dot php dot net at webheat dot co dot
uk
If this is the case it does not explain why it works on two
machines(installed by me)and not on two otheres (installed by my
hosting company).
Btw, could you post a link to the RFD you are quoting from. I searched
on Google and found an RFC entitled "Who talks TCP?"
Thanks
------------------------------------------------------------------------
[2005-02-11 21:36:12] pollita@php.net
Please refer to RFC833 Appendix 1.
Hyphens may not appear at the start or end of a <label>.
gethostbyname() (Used by the network streams code among other parts of
PHP) treats this correctly according to RFC specification. Your
browser is simply more forgiving.
------------------------------------------------------------------------
[2005-02-11 08:53:38] mike-bugs dot php dot net at webheat dot co dot
uk
The urls are as an example, http://emdeeuk.deviantart.com/ does work.
The url that identified the problem is: http://mark-.deviantart.com/
A hyphen is valid in DNS.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/31923
--
Edit this bug report at http://bugs.php.net/?id=31923&edit=1