Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:15888 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57698 invoked by uid 1010); 7 Apr 2005 03:05:42 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 57674 invoked from network); 7 Apr 2005 03:05:42 -0000 Received: from unknown (HELO pb1.pair.com) (127.0.0.1) by localhost with SMTP; 7 Apr 2005 03:05:42 -0000 X-Host-Fingerprint: 202.27.216.34 bo.nznet.gen.nz Linux 2.4/2.6 Received: from ([202.27.216.34:42894] helo=bo.nznet.gen.nz) by pb1.pair.com (ecelerity HEAD r(5268)) with SMTP id 76/33-19272-483A4524 for ; Wed, 06 Apr 2005 23:05:40 -0400 Received: from [127.0.0.1] (ms2-58.nznet.gen.nz [202.27.216.123]) by bo.nznet.gen.nz (8.11.6/8.11.6) with ESMTP id j3735I429574; Thu, 7 Apr 2005 15:05:18 +1200 Message-ID: <4254A37D.8070408@nznet.gen.nz> Date: Thu, 07 Apr 2005 15:05:33 +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: Sara Golemon CC: Wez Furlong , internals@lists.php.net References: <425369FD.1000800@nznet.gen.nz><4e89b4260504060541544ccde2@mail.gmail.com><003801c53ab9$a7902650$6c051fac@lighthammer> <4e89b426050406083078b02033@mail.gmail.com> <001101c53acf$8aa975d0$5c8be5a9@ohr.berkeley.edu> In-Reply-To: <001101c53acf$8aa975d0$5c8be5a9@ohr.berkeley.edu> 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") If there's something that looks like a scheme (i.e., a well-formed sequence of characters followed by ':'), see if it's registered; if it is, the appropriate wrapper should be used. Otherwise, on platforms where ':' has significance, try it again as a file path. Otherwise, it fails due to an absent stream wrapper. This limits problems to users who are trying to access a child directory of the current path which happens to have the same name as a registered scheme. The problems will consist of the stream failing because the URL it's receiving is bogus. People in such a situation can use the file: scheme explicitly to disambiguate (assuming they can't have a directory whose name starts with a double slash!). Alternately, on problem platforms, if the string is ambiguous, see if it is well-formed as a file path. If it is, try it as such. If it's not, or it fails, see if it starts with a registered scheme name and if so, try that. It would be easier to check if a string is a well-formed file path than it is to check if it's a valid URL according to some arbitrary scheme (impossible in general). Assuming no-one tries to register a one-letter scheme, the Windows build can get away with seeing if the "scheme" is only one letter long, and if it is, assume that it's a drive letter. I dunno; Windows users use '/' as the directory separator in file:// URLs, since it's supposed to be up to the application to map a URL to the actual resource ('\' is frequently tolerated however) in whatever platform-specific manner is appropriate; does the same hold for platforms that use ':' as the directory separator in their file: URLs? Currently the standard for file URLs is still RFC1738; this is supposed to be updated at some stage, however. It explicitly gives the VMS example of mapping DISK$USER:[MY.NOTES]NOTE123456.TXT on vms.host.edu to the URL file://vms.host.edu/disk$user/my/notes/note12345.txt and noting that to refer to the local machine the host part can be either 'localhost' or the empty string.