// make sure the file is an acceptable type $parts = pathinfo($fileName); $ext = strtolower($parts['extension']); $ok = false; if (strpos($ext, 'php') === false && strpos($ext, 'pl') === false && strpos($ext, 'py') === false && strpos($ext, 'cgi') === false && strpos($ext, 'asp') === false && strpos($ext, 'js') === false && strpos($ext, 'rb') === false && strpos($ext, 'htaccess') === false && strpos($ext, 'jar') === false) { $ok = true; } if ($ok) { // put each run of video data in it's own directory if (strpos($fileName, 'progress') !== false) { $parts = explode('_', $fileName); if (count($parts)) { $runNum = $parts[0]; $fileBase = $parts[count($parts) - 1]; $stepNum = null; if (count($parts) > 2 && IsMultistepTestResult($testInfo)) { $stepNum = $parts[count($parts) - 2]; } $cached = ''; if (strpos($fileName, '_Cached')) { $cached = '_cached'; } $path .= "/video_{$runNum}{$cached}"; if (!is_dir($path)) { mkdir($path, 0777, true); } if (isset($stepNum)) { $fileName = 'frame_' . $stepNum . '_' . $fileBase; } else { $fileName = 'frame_' . $fileBase; }
$options = array(); if (isset($_REQUEST['bodies'])) { $options['bodies'] = $_REQUEST['bodies']; } $options['cached'] = $cached; if (isset($_REQUEST['php'])) { $options['php'] = $_REQUEST['php']; } if (isset($_REQUEST['pretty'])) { $options['pretty'] = $_REQUEST['pretty']; } if (isset($_REQUEST['run'])) { $options['run'] = $_REQUEST['run']; } $options['multistep'] = 0; if (isset($_REQUEST['multistep']) && IsMultistepTestResult($testInfo)) { $options['multistep'] = 1; } $filename = ''; if (@strlen($url)) { $parts = parse_url($url); $filename = $parts['host']; } if (!strlen($filename)) { $filename = "pagetest"; } $filename .= ".{$id}.har"; header("Content-disposition: attachment; filename={$filename}"); header('Content-type: application/json'); // see if we need to wrap it in a JSONP callback if (isset($_REQUEST['callback']) && strlen($_REQUEST['callback'])) {