mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 10:48:51 +00:00
THRIFT-4656: Fix infinite loop in PHP TCurlClient
Infinite loop happens when response body is empty and HTTP status is 200. This patch fixes it.
This commit is contained in:
parent
dd965c1eb4
commit
30d3125cc2
@ -169,6 +169,24 @@ class TCurlClient extends TTransport
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Guarantees that the full amount of data is read. Since TCurlClient gets entire payload at
|
||||
* once, parent readAll cannot be used.
|
||||
*
|
||||
* @return string The data, of exact length
|
||||
* @throws TTransportException if cannot read data
|
||||
*/
|
||||
public function readAll($len)
|
||||
{
|
||||
$data = $this->read($len);
|
||||
|
||||
if (TStringFuncFactory::create()->strlen($data) !== $len) {
|
||||
throw new TTransportException('TCurlClient could not read '.$len.' bytes');
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes some data into the pending buffer
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user