Commit 2f848f83 authored by tufengqi's avatar tufengqi

http请求新增cookie传输版本

parent 201794d3
...@@ -205,6 +205,8 @@ class TCurlClient extends \Thrift\Transport\TTransport ...@@ -205,6 +205,8 @@ class TCurlClient extends \Thrift\Transport\TTransport
curl_setopt(self::$curlHandle, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt(self::$curlHandle, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt(self::$curlHandle, CURLOPT_FOLLOWLOCATION, true); curl_setopt(self::$curlHandle, CURLOPT_FOLLOWLOCATION, true);
curl_setopt(self::$curlHandle, CURLOPT_MAXREDIRS, 1); curl_setopt(self::$curlHandle, CURLOPT_MAXREDIRS, 1);
$cookie = VERSION_KEY . ':' . VERSION_VALUE;
curl_setopt(self::$curlHandle, CURLOPT_COOKIE, $cookie);
} }
// God, PHP really has some esoteric ways of doing simple things. // God, PHP really has some esoteric ways of doing simple things.
$host = $this->host_ . ($this->port_ != 80 ? ':' . $this->port_ : ''); $host = $this->host_ . ($this->port_ != 80 ? ':' . $this->port_ : '');
......
...@@ -205,7 +205,9 @@ class TGuzzleClient extends \Thrift\Transport\TTransport ...@@ -205,7 +205,9 @@ class TGuzzleClient extends \Thrift\Transport\TTransport
// God, PHP really has some esoteric ways of doing simple things. // God, PHP really has some esoteric ways of doing simple things.
$host = $this->host_ . ($this->port_ != 80 ? ':' . $this->port_ : ''); $host = $this->host_ . ($this->port_ != 80 ? ':' . $this->port_ : '');
$fullUrl = $this->scheme_ . "://" . $host . $this->uri_; $fullUrl = $this->scheme_ . "://" . $host . $this->uri_;
$headers = []; $headers = [
'cookies' => [VERSION_KEY => VERSION_VALUE]
];
$defaultHeaders = [ $defaultHeaders = [
'Host' => $host, 'Host' => $host,
'User-Agent' => 'PHP/THttpClient', 'User-Agent' => 'PHP/THttpClient',
......
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