r94754 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94753‎ | r94754 | r94755 >
Date:13:32, 17 August 2011
Author:catrope
Status:resolved (Comments)
Tags:
Comment:
(bug 30398) Expand any protocol-relative URLs to HTTP in RecentChange::getIRCLine(). This will prevent sending protocol-relative URLs to the IRC feed
Modified paths:
  • /trunk/phase3/includes/RecentChange.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/RecentChange.php
@@ -705,7 +705,9 @@
706706 // XXX: *HACK^2* the preg_replace() undoes much of what getInternalURL() does, but we
707707 // XXX: need to call it so that URL paths on the Wikimedia secure server can be fixed
708708 // XXX: by a custom GetInternalURL hook --vyznev 2008-12-10
709 - $url = preg_replace( '/title=[^&]*&/', '', $titleObj->getInternalURL( $url ) );
 709+ // XXX: Also, getInternalUrl() may return a protocol-relative URL.
 710+ // XXX: In that case, expand it to an HTTP URL, even if this is an HTTPS request --catrope 2011-08-17
 711+ $url = preg_replace( '/title=[^&]*&/', '', wfExpandUrl( $titleObj->getInternalURL( $url ), PROTO_HTTP ) );
710712 }
711713
712714 if( isset( $this->mExtra['oldSize'] ) && isset( $this->mExtra['newSize'] ) ) {

Sign-offs

UserFlagDate
Hasharinspected15:41, 17 August 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r947551.17wmf1: MFT r94754catrope13:41, 17 August 2011
r94990Followup r94754: move protocol expansion from getIRCLine() to inside getInter...catrope08:56, 19 August 2011

Comments

#Comment by Hashar (talk | contribs)   15:41, 17 August 2011

What happens if the wiki is HTTPS only ? :)

#Comment by Catrope (talk | contribs)   15:44, 17 August 2011

I guess we can make the protocol to use in IRC messages configurable. At least now it doesn't output protocol-relative URLs anymore, or sometimes HTTP and sometimes HTTPS depending on what the editor used :)

#Comment by Dantman (talk | contribs)   16:27, 17 August 2011

Shouldn't a HTTPS only wiki use $wgServer = "https://..."; PROTO_* only takes effect when the $wgServer is protocol relative.

#Comment by Catrope (talk | contribs)   18:55, 17 August 2011

Yes, good point, I momentarily forgot about that. Still, it's reasonable for someone to have a wiki that supports both, but prefer links to HTTPS.

#Comment by Catrope (talk | contribs)   11:29, 19 August 2011

This rev is superseded by r94995, which removes the changed line.

Supporting both but preferring HTTPS is now possible with $wgCanonicalServer added in r94995.

Status & tagging log