Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@googlemail.com>2014-11-13 06:13:48 +0300
committerThomas Steur <thomas.steur@googlemail.com>2014-11-13 06:13:48 +0300
commitfd9478a0499d4fb851b07cf7971750d550592237 (patch)
tree58eaad2660c4fd3c51791286e7703985ff8845e6 /core/Tracker.php
parentbe899f7a6a562cc2d670e610c7bfbbf0f6f73148 (diff)
refs #6577 Return HTTP 204 instead of GIF for JavaScript tracking.
added a new url parameter send_image=0 to disable sending an image and instead response with a 204 code
Diffstat (limited to 'core/Tracker.php')
-rw-r--r--core/Tracker.php25
1 files changed, 19 insertions, 6 deletions
diff --git a/core/Tracker.php b/core/Tracker.php
index ed911e55f6..8252c494c3 100644
--- a/core/Tracker.php
+++ b/core/Tracker.php
@@ -454,7 +454,7 @@ class Tracker
Common::sendHeader('Content-Type: text/html; charset=utf-8');
echo $this->getMessageFromException($e);
} else {
- $this->outputTransparentGif();
+ $this->sendResponse();
}
die(1);
exit;
@@ -501,7 +501,7 @@ class Tracker
}
switch ($this->getState()) {
case self::STATE_LOGGING_DISABLE:
- $this->outputTransparentGif ();
+ $this->sendResponse();
Common::printDebug("Logging disabled, display transparent logo");
break;
@@ -513,7 +513,7 @@ class Tracker
case self::STATE_NOSCRIPT_REQUEST:
case self::STATE_NOTHING_TO_NOTICE:
default:
- $this->outputTransparentGif ();
+ $this->sendResponse();
Common::printDebug("Nothing to notice => default behaviour");
break;
}
@@ -648,7 +648,7 @@ class Tracker
return $visit;
}
- protected function outputTransparentGif ()
+ private function sendResponse()
{
if (isset($GLOBALS['PIWIK_TRACKER_DEBUG'])
&& $GLOBALS['PIWIK_TRACKER_DEBUG']
@@ -660,11 +660,24 @@ class Tracker
// If there was an error during tracker, return so errors can be flushed
return;
}
- $transGifBase64 = "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";
- Common::sendHeader('Content-Type: image/gif');
$this->outputAccessControlHeaders();
+ $request = $_GET + $_POST;
+
+ if (array_key_exists('send_image', $request) && $request['send_image'] === '0') {
+ Common::sendHeader("HTTP/1.0 204 No Response");
+ return;
+ }
+
+ $this->outputTransparentGif();
+ }
+
+ protected function outputTransparentGif ()
+ {
+ $transGifBase64 = "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";
+ Common::sendHeader('Content-Type: image/gif');
+
print(base64_decode($transGifBase64));
}