Last modified: 2011-04-30 01:16:48 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T20664, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 18664 - Relative URIs in interwiki links table causes failed redirects
Relative URIs in interwiki links table causes failed redirects
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Redirects (Other open bugs)
1.14.x
All All
: Normal minor (vote)
: ---
Assigned To: Nobody - You can work on this!
http://ru.wikifur.com/
: patch, patch-need-review
Depends on: 20342
Blocks: 19270
  Show dependency treegraph
 
Reported: 2009-05-03 21:45 UTC by Laurence 'GreenReaper' Parry
Modified: 2011-04-30 01:16 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Support protocol-relative URLs in wfExpandUrl (includes/GlobalFunctions.php 1.14.0) (861 bytes, patch)
2009-05-03 21:45 UTC, Laurence 'GreenReaper' Parry
Details
Somewhat better-formatted patch (752 bytes, patch)
2009-05-04 00:00 UTC, Laurence 'GreenReaper' Parry
Details

Description Laurence 'GreenReaper' Parry 2009-05-03 21:45:16 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.
Comment 1 Laurence 'GreenReaper' Parry 2009-05-04 00:00:40 UTC
Created attachment 6087 [details]
Somewhat better-formatted patch
Comment 2 Siebrand Mazeland 2009-05-17 21:50:32 UTC
+need-review
Comment 3 Chad H. 2010-03-17 00:22:12 UTC
Fixed in r63848.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links