Last modified: 2011-04-30 01:16:48 UTC
Created attachment 6085 [details] Support protocol-relative URLs in wfExpandUrl (includes/GlobalFunctions.php 1.14.0) We use protocol-relative URIs like "//es.wikifur.com" in our interwiki table to reduce the size of the output - all our sites are on http:, so there's no need for the language links to have http: at the front. This works great in pages, but fails when people use a URL like this: http://ru.wikifur.com/es:Test This should go to: http://es.wikifur.com/wiki/Test However, the resulting redirect is to the following invalid URI: http://ru.wikifur.com//es.wikifur.com/wiki/Test I tracked this down to wfExpandUrl in includes/GlobalFunctions.php, which tests for $url starting with '/' (i.e. site-relative URIs) and just returns the URI in this case. Having '//' at the front was probably not considered. A patch is attached which attempts to work around this. It also provide for absolute URIs rather than relative ones by extracting the current protocol from $wgServer. Absolute URIs are required in Location: by the HTTP 1.1 standard, though most browsers will accept relative ones (Lynx grumbles about it). There may be a better way to do it, or a better place to patch; I did not find where this code is called from.
Created attachment 6087 [details] Somewhat better-formatted patch
+need-review
Fixed in r63848.