Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:15938 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13611 invoked by uid 1010); 10 Apr 2005 11:45:05 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 13593 invoked from network); 10 Apr 2005 11:45:04 -0000 Received: from unknown (HELO nznet.gen.nz) (127.0.0.1) by localhost with SMTP; 10 Apr 2005 11:45:04 -0000 X-Host-Fingerprint: 202.27.216.34 bo.nznet.gen.nz Linux 2.4/2.6 Received: from ([202.27.216.34:35100] helo=bo.nznet.gen.nz) by pb1.pair.com (ecelerity HEAD r(5268)) with SMTP id BD/0A-19272-FB119524 for ; Sun, 10 Apr 2005 07:45:04 -0400 Received: from [127.0.0.1] (ms1-41.nznet.gen.nz [202.27.216.170]) by bo.nznet.gen.nz (8.11.6/8.11.6) with ESMTP id j3ABiv423436; Sun, 10 Apr 2005 23:44:57 +1200 Message-ID: <425911CD.5010602@nznet.gen.nz> Date: Sun, 10 Apr 2005 23:45:17 +1200 User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-nz, en-gb, en-au, en, en-us MIME-Version: 1.0 To: internals@lists.php.net CC: Sara Golemon , Wez Furlong References: <425369FD.1000800@nznet.gen.nz> <4e89b4260504060541544ccde2@mail.gmail.com> <003801c53ab9$a7902650$6c051fac@lighthammer> <4e89b426050406083078b02033@mail.gmail.com> <001101c53acf$8aa975d0$5c8be5a9@ohr.berkeley.edu> <4254A37D.8070408@nznet.gen.nz> <4e89b4260504070603358c31c5@mail.gmail.com> <4257A954.3090408@nznet.gen.nz> <4e89b42605040906586fd137ab@mail.gmail.com> In-Reply-To: <4e89b42605040906586fd137ab@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Scheme identification in stream wrappers: (Partial) disambiguation? From: packrat@nznet.gen.nz ("Morgan L. Owens") Wez Furlong wrote: > On Apr 9, 2005 6:07 AM, Morgan L. Owens wrote: > >> > Really? >> > Can you guarantee that your user-space code to sniff out the path is >> > going to work 100% of the time on all platforms? >> > >>Who said user-space? I meant in the implementation of fopen(). > > > fopen() is implemented in user-space, meaning, not kernel-space. > Only the kernel knows what logic it will really really use to resolve > a valid path. > Emulating that code for each supported platform on which PHP runs is > plain stupid. > I still don't see why emulation code would be necessary. What happens when fopen() is passed an invalid file path now? It's obviously capable of coping with failure. What is so unimplementable with it coping with its initial failure by going "Drat. Okay, might it be a URL? Looks like it has a scheme... let's try it". If you insist, you could wrap that in #ifdefs so that the code is only compiled on platforms where 'foo:' might validly appear at the start of a file path. if(the string might be a URL) { #ifdef FILEPATHS_CAN_START_WITH_SCHEMELIKE_SEQUENCE if(attempt to open as local file succeeds) return handle else #endif if(scheme is registered && attempt to open as stream succeeds) return handle else return fail } else { if(attempt to open as local file succeeds) return handle else return fail } > > I suggest that you go and re-read RFC 1738, section 3.1, Common > Internet Scheme Syntax. We support that, because the original > wrappers implementation was solely for "URL schemes that involve the > direct use of an IP-based protocol to a specified host on the > Internet". > > ... > > In other words, there is no defined mapping to a streaming data > source, which is what the wrappers layer in PHP is built for. > Sorry, I didn't see any mention of that in the documentation. Just saw "URL" and assumed that it referred to RFC 2396, which IIRC would have been the current standard at the time. Nothing about direct use of an IP-based protocol to a specified host (like a local variable or a gzip'ed file?). If I could search back through the development discussion list over the relevant time period I'd've found this? In short, what you're talking about supporting is (what is now) Section 3.2 of RFC 3986. Thanks for clearing that up. > > Do you think that by trying to insult PHP you'll motivate the > developers to try and change it to the way you think it should work? > Just characterising the sort of response I can imagine people not married to PHP making when they first run into this. Hey, none of this is the result of any decision of mine. So I wasn't aware of which interpretation of "URL" you had chosen to use. Now that you've gotten around to saying which (to me, if not to those other users I mentioned), I've got my answer. MLO