Upgrading vendor folder dependencies.

This commit is contained in:
Renan DelValle 2018-12-27 09:58:53 -08:00
parent 4a0cbcd770
commit acbe9ad9e5
No known key found for this signature in database
GPG key ID: C240AD6D6F443EC9
229 changed files with 10735 additions and 4528 deletions

View file

@ -33,7 +33,7 @@ use Thrift\Type\TType;
*/
abstract class TBase
{
static public $tmethod = array(
public static $tmethod = array(
TType::BOOL => 'Bool',
TType::BYTE => 'Byte',
TType::I16 => 'I16',

View file

@ -26,7 +26,7 @@ use Thrift\Type\TType;
class TApplicationException extends TException
{
static public $_TSPEC =
public static $_TSPEC =
array(1 => array('var' => 'message',
'type' => TType::STRING),
2 => array('var' => 'code',

View file

@ -56,7 +56,7 @@ class TException extends \Exception
}
}
static public $tmethod = array(
public static $tmethod = array(
TType::BOOL => 'Bool',
TType::BYTE => 'Byte',
TType::I16 => 'I16',

View file

@ -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
*

View file

@ -88,14 +88,23 @@ class THttpClient extends TTransport
*/
protected $headers_;
/**
* Context additional options
*
* @var array
*/
protected $context_;
/**
* Make a new HTTP client.
*
* @param string $host
* @param int $port
* @param int $port
* @param string $uri
* @param string $scheme
* @param array $context
*/
public function __construct($host, $port = 80, $uri = '', $scheme = 'http')
public function __construct($host, $port = 80, $uri = '', $scheme = 'http', array $context = array())
{
if ((TStringFuncFactory::create()->strlen($uri) > 0) && ($uri{0} != '/')) {
$uri = '/' . $uri;
@ -108,6 +117,7 @@ class THttpClient extends TTransport
$this->handle_ = null;
$this->timeout_ = null;
$this->headers_ = array();
$this->context_ = $context;
}
/**
@ -211,16 +221,21 @@ class THttpClient extends TTransport
$headers[] = "$key: $value";
}
$options = array('method' => 'POST',
$options = $this->context_;
$baseHttpOptions = isset($options["http"]) ? $options["http"] : array();
$httpOptions = $baseHttpOptions + array('method' => 'POST',
'header' => implode("\r\n", $headers),
'max_redirects' => 1,
'content' => $this->buf_);
if ($this->timeout_ > 0) {
$options['timeout'] = $this->timeout_;
$httpOptions['timeout'] = $this->timeout_;
}
$this->buf_ = '';
$contextid = stream_context_create(array('http' => $options));
$options["http"] = $httpOptions;
$contextid = stream_context_create($options);
$this->handle_ = @fopen(
$this->scheme_ . '://' . $host . $this->uri_,
'r',

View file

@ -305,7 +305,7 @@ public:
void skip(size_t len) {
while (len) {
size_t chunk_size = std::min(len, buffer_used);
size_t chunk_size = (std::min)(len, buffer_used);
if (chunk_size) {
buffer_ptr = reinterpret_cast<char*>(buffer_ptr) + chunk_size;
buffer_used -= chunk_size;
@ -318,7 +318,7 @@ public:
void readBytes(void* buf, size_t len) {
while (len) {
size_t chunk_size = std::min(len, buffer_used);
size_t chunk_size = (std::min)(len, buffer_used);
if (chunk_size) {
memcpy(buf, buffer_ptr, chunk_size);
buffer_ptr = reinterpret_cast<char*>(buffer_ptr) + chunk_size;