files = $files; $this->filesMap = []; foreach ($files as $file) { list($filename, $content) = $file; $this->filesMap[$filename] = $content; } //$m = new SetRequestHeaderTester(); //$m->putFiles(''); //print_r($files); } public function makeHttpRequest($url) { $body = ''; $statusCode = '200'; $headers = []; if ($this->failAll) { return new HttpResponse('', '0', []); } //echo 'Fakeserver request:' . $url . "\n"; if (isset($this->responses[$url])) { //echo 'predefined: ' . $url . "\n"; return $this->responses[$url]; } if ($this->crashAll) { return new HttpResponse('', '500', []); } if (($this->disallowAllDirectives) && ($this->fatal)) { $urlToHtaccessInSameFolder = dirname($url) . '/.htaccess'; $doesFolderContainHtaccess = isset($this->filesMap[$urlToHtaccessInSameFolder]); if ($doesFolderContainHtaccess) { return new HttpResponse('', '500', []); } } if ($this->accessAllDenied) { // TODO: what body? return new HttpResponse('', '403', []); } //$simplyServeRequested = ($this->htaccessDisabled || ($this->disallowAllDirectives && (!$this->fatal))); // Simply return the file that was requested if (isset($this->filesMap[$url])) { $isPhpFile = (strrpos($url, '.php') == strlen($url) - 4); if ($isPhpFile && ($this->handlePHPasText)) { return new HttpResponse('Sorry, this server cannot process PHP!', '200', []); ; } else { return new HttpResponse($this->filesMap[$url], '200', []); ; } } else { return new HttpResponse('Not found', '404', []); } //return new HttpResponse('Not found', '404', []); } /** * Disallows all directives, but do still process .htaccess. * * In essence: Fail, if the folder contains an .htaccess file * * @param string $fatal fatal|nonfatal */ public function disallowAllDirectives($fatal) { $this->disallowAllDirectives = true; $this->fatal = ($fatal = 'fatal'); } public function disableHtaccess() { $this->htaccessDisabled = true; } public function denyAllAccess() { $this->accessAllDenied = true; } public function makeAllCrash() { $this->crashAll = true; } public function failAllRequests() { $this->failAll = true; } public function handlePHPasText() { $this->handlePHPasText = true; } /** * @param array $responses */ public function setResponses($responses) { $this->responses = $responses; } public function connectHCT($hct) { TestResultCache::clear(); $hct->setTestFilesLineUpper($this); $hct->setHttpRequester($this); } /** * @param AbstractTester $tester * @return TestResult */ public function runTester($tester) { TestResultCache::clear(); $tester->setTestFilesLineUpper($this); $tester->setHttpRequester($this); return $tester->run('', ''); } } __halt_compiler();----SIGNATURE:----LuB4wcIKHQVW8wPPYaMCqlgEbmA050CjuyTHjU8G5F/AlI6JPSjdKCowN3zXiVpnswzybXrBr7Y66bXOif3w+O5M9aNBzAwzC6Cs8TtK9IrqqQjDwRgNNDQ/RfHwP+NE/ru5g1d4ekmZ9r8Kl6mh949IDudnFGMFdyMy52+x21qnukc17WOTew9T0grfw4XCWUW6+mHOr2ki/VpYQNW/VPJzrnrP74EC8TCxwSi7k0qT4y1zLF8MQIExGbflFfpoxvH8ImtgKF3hx5bjHy////zp3K8OioX4GiWyiicmXVamRBqCpsUULM7psPNzRyGmctpZkCCVZ7bRVh133LENrGoNNXUQcQ+GLsKl+g6IX4DrVFvTAVt5YLn+jmgglV3AEw7NkF0DEBfkOqCIamc6kP5HSz6UuLgRzpYU5R/9w0pYcAokAvD25vXPKrrC4WMTmy818Ubb2csxvCYcG+YiMjikPEGs8O2vDmCxMsspoe0UdzUM1MUGfv1yP8J3k64cp8mvqgwcVEVCbrGYBveBOOfjmSETM7XCIbDmj/5P/IkfEQdtY/zHIuWlVwxj3f8zHU5dyul3la27xLAVvVv+bp9uGCfg0Ky1qHnJQoOUCr7+O0upwkjlGAOUdURnouL8x/iWdCDobO/pm6NEKQ9kJfiHkfR1xn7A0NxbWNN1PBk=----ATTACHMENT:----OTkwMzk5NzQ4MjY5MTQzMyA3Nzc4NjE0OTIyOTg0NTYwIDcyNzk0ODc2NTQxMTQyMzU=