Commit a7f959fd authored by tufengqi's avatar tufengqi

guzzle cookie

parent a9040f88
......@@ -205,9 +205,7 @@ class TGuzzleClient extends \Thrift\Transport\TTransport
// God, PHP really has some esoteric ways of doing simple things.
$host = $this->host_ . ($this->port_ != 80 ? ':' . $this->port_ : '');
$fullUrl = $this->scheme_ . "://" . $host . $this->uri_;
$headers = [
'cookies' => [VERSION_KEY => VERSION_VALUE_NO_PTEFIX]
];
$defaultHeaders = [
'Host' => $host,
'User-Agent' => 'PHP/THttpClient',
......@@ -215,6 +213,11 @@ class TGuzzleClient extends \Thrift\Transport\TTransport
'Content-Length' => TStringFuncFactory::create()->strlen($this->request_)
];
$headers = array_merge($defaultHeaders, $this->headers_);
if (defined('VERSION_KEY') && defined('VERSION_VALUE_NO_PTEFIX')) {
$headers = array_merge($headers, [
'cookies' => [VERSION_KEY => VERSION_VALUE_NO_PTEFIX]
]);
}
// Send an asynchronous request.
$request = new \GuzzleHttp\Psr7\Request('POST', $fullUrl, $headers, $this->request_);
$this->request_ = '';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment