1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-02-13 03:45:22 +01:00

[Http] Removing readChunked from EntityBody as this is handled by cURL

This commit is contained in:
Michael Dowling 2011-03-28 22:44:40 -05:00
parent a1adbca83f
commit 55523cf8bf
2 changed files with 0 additions and 44 deletions

View File

@ -236,31 +236,6 @@ class EntityBody extends Stream
return $encoding;
}
/**
* Read a chunk of data from the EntityBody
*
* @param int $chunkLength (optional) Maximum chunk length to read
* @param int $startPos (optional) Where the seek position was when the last
* chunk was read. If the seek position is not there, then the stream
* will be seeked to that position before it starts reading. You
* SHOULD always set the startPos when reading the body for a chunked
* Transfer-Encoding request so that other calls will not interfere
* with the data sent over the wire.
*
* @return string Returns the hex length of the chunk, followed by a CRLF,
* followed by the chunk of read data
*/
public function readChunked($chunkLength = 4096, $startPos = null)
{
if ($startPos !== null && ftell($this->stream) != $startPos) {
$this->seek($startPos);
}
$data = $this->read($chunkLength);
return dechex(strlen($data)) . "\r\n" . $data;
}
/**
* Handles compression or uncompression of stream data
*

View File

@ -126,23 +126,4 @@ class EntityBodyTest extends \Guzzle\Tests\GuzzleTestCase
$body = EntityBody::factory('testing 123...testing 123');
$this->assertEquals(md5('testing 123...testing 123'), $body->getContentMd5());
}
/**
* @covers Guzzle\Http\EntityBody::readChunked
*/
public function testCanReadUsingChunkedTransferEncoding()
{
$body = EntityBody::factory('this is a test of the Emergency Broadcast System (EBS)');
$this->assertEquals(dechex(3) . "\r\n" . 'thi', $body->readChunked(3));
$this->assertEquals(dechex(6) . "\r\n" . 's is a', $body->readChunked(6));
// Jump to a different position in the body (0)
$this->assertEquals(dechex(3) . "\r\n" . 'thi', $body->readChunked(3, 0));
// Read the remainder of the entity body
$this->assertEquals(dechex(51) . "\r\n" . 's is a test of the Emergency Broadcast System (EBS)', $body->readChunked(4096));
// The last chunk must be 0 length followed by CRLF
$this->assertEquals(dechex(0) . "\r\n", $body->readChunked(4096));
}
}