| OLD | NEW |
| 1 <?php | 1 <?php |
| 2 require_once 'portabilityLayer.php'; | 2 require_once 'portabilityLayer.php'; |
| 3 | 3 |
| 4 // This script acts as a stateful proxy for retrieving files. When the state is
set to | 4 // This script acts as a stateful proxy for retrieving files. When the state is
set to |
| 5 // offline, it simulates a network error with a nonsense response. | 5 // offline, it simulates a network error with a nonsense response. |
| 6 | 6 |
| 7 if (!sys_get_temp_dir()) { | 7 if (!sys_get_temp_dir()) { |
| 8 echo "FAIL: No temp dir was returned.\n"; | 8 echo "FAIL: No temp dir was returned.\n"; |
| 9 exit(); | 9 exit(); |
| 10 } | 10 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 if (preg_match("/\.svg$/", $path)) | 37 if (preg_match("/\.svg$/", $path)) |
| 38 return "application/svg+xml"; | 38 return "application/svg+xml"; |
| 39 if (preg_match("/\.xsl$/", $path)) | 39 if (preg_match("/\.xsl$/", $path)) |
| 40 return "application/xslt+xml"; | 40 return "application/xslt+xml"; |
| 41 if (preg_match("/\.gif$/", $path)) | 41 if (preg_match("/\.gif$/", $path)) |
| 42 return "image/gif"; | 42 return "image/gif"; |
| 43 if (preg_match("/\.jpg$/", $path)) | 43 if (preg_match("/\.jpg$/", $path)) |
| 44 return "image/jpeg"; | 44 return "image/jpeg"; |
| 45 if (preg_match("/\.png$/", $path)) | 45 if (preg_match("/\.png$/", $path)) |
| 46 return "image/png"; | 46 return "image/png"; |
| 47 if (preg_match("/\.css$/", $path)) |
| 48 return "text/css"; |
| 47 return "text/plain"; | 49 return "text/plain"; |
| 48 } | 50 } |
| 49 | 51 |
| 50 function generateNoCacheHTTPHeader() | 52 function generateNoCacheHTTPHeader() |
| 51 { | 53 { |
| 52 header("Expires: Thu, 01 Dec 2003 16:00:00 GMT"); | 54 header("Expires: Thu, 01 Dec 2003 16:00:00 GMT"); |
| 53 header("Cache-Control: no-cache, no-store, must-revalidate"); | 55 header("Cache-Control: no-cache, no-store, must-revalidate"); |
| 54 header("Pragma: no-cache"); | 56 header("Pragma: no-cache"); |
| 55 } | 57 } |
| 56 | 58 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 else if ($command == "log-resource-request") | 178 else if ($command == "log-resource-request") |
| 177 handleLogResourceRequest($_GET['path']); | 179 handleLogResourceRequest($_GET['path']); |
| 178 else | 180 else |
| 179 echo "Unknown command: " . $command . "\n"; | 181 echo "Unknown command: " . $command . "\n"; |
| 180 exit(); | 182 exit(); |
| 181 } | 183 } |
| 182 | 184 |
| 183 $requestedPath = $_GET['path']; | 185 $requestedPath = $_GET['path']; |
| 184 generateResponse($requestedPath); | 186 generateResponse($requestedPath); |
| 185 ?> | 187 ?> |
| OLD | NEW |