diff --git a/lib/tests/filelib_test.php b/lib/tests/filelib_test.php index aa07dc58b64..004dc8b49e8 100644 --- a/lib/tests/filelib_test.php +++ b/lib/tests/filelib_test.php @@ -241,10 +241,20 @@ class core_filelib_testcase extends advanced_testcase { $this->assertSame(2, $curl->info['redirect_count']); $this->assertSame('done', $contents); + // This test was failing for people behind Squid proxies. Squid does not + // fully support HTTP 1.1, so converts things to HTTP 1.0, where the name + // of the status code is different. + reset($response); + if (key($response) === 'HTTP/1.0') { + $responsecode302 = '302 Moved Temporarily'; + } else { + $responsecode302 = '302 Found'; + } + $curl = new curl(); $contents = $curl->get("$testurl?redir=3", array(), array('CURLOPT_FOLLOWLOCATION'=>0)); $response = $curl->getResponse(); - $this->assertSame('302 Found', reset($response)); + $this->assertSame($responsecode302, reset($response)); $this->assertSame(0, $curl->get_errno()); $this->assertSame(302, $curl->info['http_code']); $this->assertSame('', $contents); @@ -253,7 +263,7 @@ class core_filelib_testcase extends advanced_testcase { $curl->emulateredirects = true; $contents = $curl->get("$testurl?redir=3", array(), array('CURLOPT_FOLLOWLOCATION'=>0)); $response = $curl->getResponse(); - $this->assertSame('302 Found', reset($response)); + $this->assertSame($responsecode302, reset($response)); $this->assertSame(0, $curl->get_errno()); $this->assertSame(302, $curl->info['http_code']); $this->assertSame('', $contents);