Example #1
0
<?php

include 'common.inc';
$file = "{$testPath}/{$_GET['file']}";
if (isset($_GET['file']) && strlen($_GET['file']) && strpos($_GET['file'], '/') === false && strpos($_GET['file'], '\\') === false && strpos($_GET['file'], '..') === false && strpos($_GET['file'], 'testinfo') === false && gz_is_file($file)) {
    header("Content-disposition: attachment; filename={$_GET['file']}");
    if (strpos($_GET['file'], 'pagespeed') !== false || strpos($_GET['file'], '.json') !== false) {
        header("Content-type: application/json");
    } else {
        header("Content-type: application/octet-stream");
    }
    gz_readfile_chunked($file);
} else {
    header("HTTP/1.0 404 Not Found");
}
Example #2
0
                    $buffer = '[' . substr($buffer, 4);
                } elseif (substr($buffer, 0, 5) == "[{}\n,") {
                    $buffer = '[' . substr($buffer, 5);
                }
            }
            ob_flush();
            flush();
        }
        echo rtrim($buffer, "\r\n}");
        gzclose($handle);
    }
} elseif (gz_is_file("{$testPath}/{$run}{$cachedText}_timeline.json")) {
    $ok = true;
    header("Content-disposition: attachment; filename=timeline.json");
    header("Content-type: application/json");
    gz_readfile_chunked("{$testPath}/{$run}{$cachedText}_timeline.json");
} elseif (gz_is_file("{$testPath}/{$run}{$cachedText}_devtools.json")) {
    require_once 'devtools.inc.php';
    $devTools = array();
    $startOffset = null;
    GetTimeline($testPath, $run, $cached, $devTools, $startOffset);
    if (isset($devTools) && is_array($devTools) && count($devTools)) {
        foreach ($devTools as $entry) {
            $events = GetEvents($entry);
            if (count($events)) {
                if (!$ok) {
                    $ok = true;
                    header("Content-disposition: attachment; filename=timeline.json");
                    header("Content-type: application/json");
                    echo "[\"WebPagetest\"";
                }