From 3d5aca4a406424bf69016f9c7c4a94b317b62d25 Mon Sep 17 00:00:00 2001 From: Ori Livneh Date: Thu, 2 Jul 2015 19:20:41 -0700 Subject: [PATCH] Add MediaWiki-Timestamp header to ResourceLoader requests To help distinguish cache hits from cache misses, send a MediaWiki-Timestamp header on ResourceLoader responses, indicating the current time as fractional seconds since epoch, with microsecond precision. Change-Id: I954a96ced1435a47d458de12411b257fe6b4ea34 --- includes/resourceloader/ResourceLoader.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 5d0ed3c51b..54cc6e5b1d 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -813,6 +813,11 @@ class ResourceLoader implements LoggerAwareInterface { $exp = min( $maxage, $smaxage ); header( 'Expires: ' . wfTimestamp( TS_RFC2822, $exp + time() ) ); } + + // Send the current time expressed as fractional seconds since epoch, + // with microsecond precision. This helps distinguish hits from misses + // in edge caches. + header( 'MediaWiki-Timestamp: ' . microtime( true ) ); } /** -- 2.20.1