Permalink
Browse files

Some hanging in feof/fgets on redirects that i cant seem to fix :(

  • Loading branch information...
1 parent ef0eabc commit cd11f0940c0e20e53b79bc87f1200a3cd072818d @beberlei beberlei committed Mar 26, 2012
View
35 lib/Doctrine/KeyValueStore/Http/StreamClient.php
@@ -67,19 +67,18 @@ public function request($method, $url, $body = null, array $headers)
}
$header = rtrim($header);
- // TODO SSL support?
$opts = array(
- 'http' => array(
- 'method' => $method,
- 'content' => $body,
- 'max_redirects' => 2,
- 'ignore_errors' => false,
- 'user_agent' => 'Doctrine KeyValueStore',
- 'timeout' => $this->options['timeout'],
- 'header' => $header,
- 'protocol_version' => '1.1',
- ),
- );
+ 'http' => array(
+ 'method' => $method,
+ 'content' => $body,
+ 'max_redirects' => 0,
+ 'ignore_errors' => true,
+ 'user_agent' => 'Doctrine KeyValueStore',
+ 'timeout' => $this->options['timeout'],
+ 'header' => $header,
+ 'protocol_version' => '1.1',
+ ),
+ );
$httpFilePointer = @fopen(
$url,
@@ -94,12 +93,6 @@ public function request($method, $url, $body = null, array $headers)
throw new \RuntimeException("Error sending to " . $host . ": " . $error['message']);
}
- // Read request body
- $body = '';
- while ( !feof( $httpFilePointer ) ) {
- $body .= fgets( $httpFilePointer );
- }
-
$metaData = stream_get_meta_data( $httpFilePointer );
// The structure of this array differs depending on PHP compiled with
// --enable-curlwrappers or not. Both cases are normally required.
@@ -122,6 +115,12 @@ public function request($method, $url, $body = null, array $headers)
throw \RuntimeException('Error sending to ' . $host . ': Received an empty response or not status code');
}
+ // Read request body
+ $body = '';
+ while ( ! feof( $httpFilePointer ) ) {
+ $body .= fgets( $httpFilePointer );
+ }
+
// Create repsonse object from couch db response
return new Response($headers['status'], $body, $headers);
}
View
4 tests/Doctrine/Tests/KeyValueStore/Functional/Storage/WindowsAzureTableTest.php
@@ -29,9 +29,7 @@ public function testCrud()
$auth
);
- #$response = $storage->createTable("test");
- #var_dump($reponse);
- $storage->insert("test", array("dist" => "foo", "range" => 400), array("foo" => "bar"));
+ $storage->insert("test", array("dist" => "foo", "range" => time()), array("foo" => "bar"));
}
}

0 comments on commit cd11f09

Please sign in to comment.