$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);
$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);