User "Dantman" posted a comment on MediaWiki.r94375.
Full URL:
https://secure.wikimedia.org/wikipedia/mediawiki/wiki/Special:Code/MediaWiki/94375#c20725
Commit summary:
Touch up Title::get[Full|Local]URL. This concept of "if not an existing
interwiki getFullURL calls getLocalURL" and "if external (interwiki)
getLocalURL calls getFullURL" is ridiculous. In fact if mInterwiki just happens
to not be '' and not exist, you create infinite recursion and php dies.
Instead of having getFullURL and getLocalURL call each other, move the
interwiki workload into getLocalURL, and make getFullURL simply call
getLocalURL then expand it (use the wf method in case it's already a full url)
and append the fragment to it.
Comment:
Hmmm... I don't think the cache pollution issue is quite there, but there is a
different issue I thought of.
Some small notes first:
* Have people even used protocol relative urls for $wgServer? That sounds like
it would have been liable to break {{SERVER}} and {{fullurl:}} since we only
added support for protocol relatives in content now.
Rather a url without a protocol isn't even a full url, it's a relative url.
* Don't worry too much about the parser cache. The parser uses the Linker,
which uses Title::getLinkUrl, which uses getLocalURL+getFragmentForURL for
internal links. So internal links won't be full urls anyway.
However thinking about it, wfExpandUrl doesn't just expand. It unexpands and
re-expands urls, so this would have the side effect of making http interwiki
links https on a https wiki potentially breaking the interwiki link of the
interwiki site doesn't have https, or is like Wikipedia currently is and
doesn't use the same domain.
What do you think is the best option? (Implying a check to ensure we don't
break interwikis, so put that aside for a moment)
* Provide a $wg config var to decide the PROTO_ policy for full urls. (Mixed
http/https wiki can use PROTO_RELATIVE to ensure relative urls, and the single
proto wiki can keep PROTO_CURRENT as $wgServer currently gives them)
* Provide a new PROTO_ option that doesn't ignore whether $wgServer contains a
protocol or not and will act like PROTO_CURRENT if it contains a protocol but
like PROTO_RELATIVE if $wgServer is protocol relative. Links will work the same
as before but local links will potentially benefit from PROTO_CURRENT behaviour
on wiki with an absolute $wgServer. (Unless we want to permit a https wiki's
internal links to point to the http wiki when it has been configured with an
absolute http $wgServer?)
* Provide a new PROTO_ option or alternative wfExpandUrl that sticks to the
basic behaviour of just expanding with $wgServer.
* Just test if the url is absolute and prepend $wgServer if not already
expanded (same behaviour as the prev, but hardcoded in Title instead of
generalised in a function or PROTO_ option).
That aside, if we previously had a wfExpandUrl that strait up used $wgServer
and may actually be used in contexts that output to the parser cache, why are
we replacing it with a wfExpandUrl which by default (ie: if any extensions used
it) will start outputting http(s):// instead of // even when $wgServer is a
protocol relative url? That sounds like the bigger bug.
_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview