[Patch] [Finished] pear/Text_Wiki/Text/Wiki/Parse/Mediawiki/Url.php

From: Date: Tue, 07 Nov 2006 22:58:00 +0000
Subject: [Patch] [Finished] pear/Text_Wiki/Text/Wiki/Parse/Mediawiki/Url.php
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-44870@lists.php.net to get a copy of this message
Greetings, I have made one relatively minor modification to the pear CVS file: pear/Text_Wiki/Text/Wiki/Parse/Mediawiki/Url.php Verbose Explanation: ==================== This simple change consists of appending a single entry to the schemes array which makes it possible for Mediawiki to parse links which use the following syntax: [//pear.php.net Pear::Homepage] The W3C document which discusses the resolution of partial URLs can be found at http://www.w3.org/Addressing/URL/4_3_Partial.html. The portion of this document which is relevant for the purposes of this patch is the following statement: ``If the scheme parts are different, the whole absolute URI must be given. Otherwise, the scheme is omitted, ..`` The URL definition (from the official W3 specifications) seems to support legitimacy of the aforementioned document as it states that it does not define the resolution of fragmented or partial URLs. This document can be found at http://www.w3.org/Addressing/URL/url-spec.txt. The specific quote is: ``Fragment identifiers and partial URLs are not involved in the basic URL definition.`` Examples: ========= If we were presently at https://example.com/index.php, and this page renders a Mediawiki link which has the wiki form of "[//images.example.com/hello.jpg]", the specification would dictate that the URI resolve to https://images.example.com/hello.jpg. As a supplementary example, if we were presently at http://example.com/index.php, and this page renders a Mediawiki link which has the wiki form of "[//images2.example.com/hello2.jpg]", the specification would dictate that the URI resolve to http://images2.example.com/hello2.jpg. Testing Methodology: ==================== I am basically proposing that we add the ability to omit the scheme from a url to be able to inherit from the proper document. I have verified that this works as described in the examples above through testing on my own apache webserver. My tests concluded that if one is to use a url in an xhtml document which has the form of: "//fully.qualified.ip.org.dns.entry/resource/specific_one", the url scheme gets inherited from whatever scheme the document was accessed with (I tested that this works for both Internet Explorer 6 and Firefox 1.5). Testing was performed by executing queries equivalent to the examples and then checking the logs to verify the appropriate scheme had been used each time. Optional Reading: ================= And for those of you who may be interested in this kind of thing, I found http://www.w3.org/DesignIssues/Axioms.html to be an interesting read regarding URI schemes (even though the document appears to be a decade old by now and is not official). Final Thoughts: =============== This is my first patch, so please forgive the general excessiveness and/or any wrongdoing on my part. I have put forth my best effort to follow the protocol outlined at http://pear.php.net/manual/en/contributing.patches.php. I welcome constructive feedback regarding how I can improve any future patches. Thanks, Jay

? Url.diff Index: Url.php =================================================================== RCS file: /repository/pear/Text_Wiki/Text/Wiki/Parse/Mediawiki/Url.php,v retrieving revision 1.2 diff -u -r1.2 Url.php --- Url.php 15 Aug 2006 16:02:06 -0000 1.2 +++ Url.php 7 Nov 2006 22:03:50 -0000 @@ -67,6 +67,7 @@ */ var $conf = array( 'schemes' => array( + '//', // inherits scheme of the base url 'http://', 'https://', 'ftp://',
« previous php.pear.dev (#44870) next »