Last modified: 2011-09-07 14:26:49 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 T32792, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 30792 - Protocol-relative URLs cause complete breakage of Squid purge during upload, action=purge, etc.
Protocol-relative URLs cause complete breakage of Squid purge during upload, ...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Uploading (Other open bugs)
1.17.x
All All
: Unprioritized blocker (vote)
: ---
Assigned To: Roan Kattouw
:
Depends on:
Blocks: 20342
  Show dependency treegraph
 
Reported: 2011-09-07 02:45 UTC by Tim Starling
Modified: 2011-09-07 14:26 UTC (History)
3 users (show)

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


Attachments

Description Tim Starling 2011-09-07 02:45:57 UTC
In LocalFile: purgeCache(), purgeThumbnails() and recordUpload2() all call SquidUpdate::purge(), and apparently the URLs in all three cases are potentially protocol-relative. SquidUpdate has always had support for purging relative URLs, it calls SquidUpdate::expand(), but this function has not been updated to support protocol-relative URLs, so the result is invalid. HTCP packets with URLs like the following have been logged:

//commons.wikimedia.org//upload.wikimedia.org/wikipedia/commons/thumb/0/03/Laurel_Caverns_cave.jpg/1024px-Laurel_Caverns_cave.jpg

Users are complaining. I'm going to look at doing a quick live patch.
Comment 1 Tim Starling 2011-09-07 02:59:59 UTC
Index: SquidUpdate.php
===================================================================
--- SquidUpdate.php	(revision 96381)
+++ SquidUpdate.php	(working copy)
@@ -208,11 +208,15 @@
 	 * @return string
 	 */
 	static function expand( $url ) {
+		### WMF EMERGENCY PATCH FOR BUG 30792 -- TS
+		return wfExpandUrl( $url, PROTO_HTTP );
+		/*
 		global $wgInternalServer, $wgServer;
 		$server = $wgInternalServer !== false ? $wgInternalServer : $wgServer;
 		if( $url !== '' && $url[0] == '/' ) {
 			return $server . $url;
 		}
 		return $url;
+		 */
 	}
 }
Comment 2 Tim Starling 2011-09-07 03:00:41 UTC
Assigned to Roan Kattouw.
Comment 3 Roan Kattouw 2011-09-07 08:37:06 UTC
Hm, I guess we're only setting $wgInternalServer in secure.php but not during normal operation. I'll poke in a minute.
Comment 4 Roan Kattouw 2011-09-07 10:28:56 UTC
(In reply to comment #3)
> Hm, I guess we're only setting $wgInternalServer in secure.php but not during
> normal operation. I'll poke in a minute.
Fixed by setting $wgInternalServer to the value of $wgCanonicalServer in CommonSettings.php .
Comment 5 Roan Kattouw 2011-09-07 14:26:49 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > Hm, I guess we're only setting $wgInternalServer in secure.php but not during
> > normal operation. I'll poke in a minute.
> Fixed by setting $wgInternalServer to the value of $wgCanonicalServer in
> CommonSettings.php .
Lies! The issue was something else. Fixed properly in r96437 and deployed to the cluster. I watched the Squid purge stream on tcpdump to make sure no purges for protocol-relative URLs were sent.

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


Navigation
Links