--- ../prod/base/w/includes/GlobalFunctions.php	2009-02-22 19:38:43.000000000 -0500
+++ ../prod/pool/w/includes/GlobalFunctions.php	2009-05-03 17:56:57.000000000 -0400
@@ -1199,9 +1199,20 @@
  * @return string Fully-qualified URL
  */
 function wfExpandUrl( $url ) {
+	// Allow for both site- and protocol-relative URLs
 	if( substr( $url, 0, 1 ) == '/' ) {
 		global $wgServer;
-		return $wgServer . $url;
+		if ( substr( $url, 0, 2 ) == '//' ) {
+			// Try to extract the protocol from the server
+			if ( $protocolPos = strpos( $wgServer, '//' ) ) {
+				$protocol = substr( $wgServer, 0, $protocolPos );
+				return $protocol . $url;
+			} else {
+				return $url;
+			}
+		} else {
+			return $wgServer . $url;
+		}
 	} else {
 		return $url;
 	}
