Reedy has uploaded a new change for review.
https://gerrit.wikimedia.org/r/90886
Change subject: Add "touch.php" for $wgAppleTouchIcon...
......................................................................
Add "touch.php" for $wgAppleTouchIcon...
Change-Id: I6f83e6edfade9ed8669ed9c1cc5734dee18ebf59
---
A w/touch.php
1 file changed, 49 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config
refs/changes/86/90886/1
diff --git a/w/touch.php b/w/touch.php
new file mode 100644
index 0000000..8cb58e0
--- /dev/null
+++ b/w/touch.php
@@ -0,0 +1,49 @@
+<?php
+define( "MEDIAWIKI", true );
+
+require( "/apache/common/w/MWVersion.php" );
+require( getMediaWiki( "includes/WebStart.php" ) );
+
+function faviconShowError( $html ) {
+ header( 'Content-Type: text/html; charset=utf-8' );
+ echo "<html><body>$html</body></html>\n";
+}
+
+function streamAppleTouch() {
+ global $wgAppleTouchIcon;
+ wfResetOutputBuffers();
+ if ( $wgAppleTouchIcon === false ) {
+ # That's not very helpful, that's where we are already
+ header( 'HTTP/1.1 404 Not Found' );
+ faviconShowError( "\$wgAppleTouchIcon is configured
incorrectly, " .
+ "it must be set to something other than false \n" );
+ return;
+ }
+
+ $req = RequestContext::getMain()->getRequest();
+ if ( $req->getHeader( 'X-Favicon-Loop' ) !== false ) {
+ header( 'HTTP/1.1 500 Internal Server Error' );
+ faviconShowError( "Proxy forwarding loop detected" );
+ return;
+ }
+
+ $url = wfExpandUrl( $wgAppleTouchIcon, PROTO_INTERNAL );
+ $client = MWHttpRequest::factory( $url );
+ $client->setHeader( 'X-Favicon-Loop', '1' );
+
+ $status = $client->execute();
+ if ( !$status->isOK() ) {
+ header( 'HTTP/1.1 500 Internal Server Error' );
+ faviconShowError( htmlspecialchars( "Failed to fetch URL
\"$url\"" ) );
+ return;
+ }
+
+ $content = $client->getContent();
+ header( 'Content-Length: ' . strlen( $content ) );
+ header( 'Content-Type: ' . $client->getResponseHeader( 'Content-Type' )
);
+ header( 'Cache-Control: public' );
+ header( 'Expires: ' . gmdate( 'r', time() + 86400 ) );
+ echo $content;
+}
+
+streamAppleTouch();
--
To view, visit https://gerrit.wikimedia.org/r/90886
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6f83e6edfade9ed8669ed9c1cc5734dee18ebf59
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Reedy <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits