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
path: root/core
diff options
context:
space:
mode:
authorThomas Steur <tsteur@users.noreply.github.com>2014-11-14 02:40:14 +0300
committerThomas Steur <tsteur@users.noreply.github.com>2014-11-14 02:40:14 +0300
commit74436365533366123a78bf646b245116b8c0c565 (patch)
treece3d680db290d341b607717686818202de6c0f77 /core
parentca36bb8ba014d08bc400b0a70a9176153d814d4e (diff)
parent5d472e8b490d36a92d44f7e1bd87dc8c932e21b4 (diff)
Merge pull request #6659 from piwik/6577
Return HTTP 204 instead of GIF for JavaScript tracking.
Diffstat (limited to 'core')
-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..38467fc65d 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.1 204 No Response");
+ return;
+ }
+
+ $this->outputTransparentGif();
+ }
+
+ protected function outputTransparentGif ()
+ {
+ $transGifBase64 = "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";
+ Common::sendHeader('Content-Type: image/gif');
+
print(base64_decode($transGifBase64));
}