mirror of
https://github.com/crmeb/CRMEB.git
synced 2025-12-17 06:52:49 +00:00
去掉CA证书验证
This commit is contained in:
parent
686e876d2f
commit
1f6d91b849
30
vendor/guzzlehttp/guzzle/src/Client.php
vendored
30
vendor/guzzlehttp/guzzle/src/Client.php
vendored
@ -161,7 +161,7 @@ class Client implements ClientInterface
|
|||||||
'allow_redirects' => RedirectMiddleware::$defaultSettings,
|
'allow_redirects' => RedirectMiddleware::$defaultSettings,
|
||||||
'http_errors' => true,
|
'http_errors' => true,
|
||||||
'decode_content' => true,
|
'decode_content' => true,
|
||||||
'verify' => true,
|
'verify' => false,
|
||||||
'cookies' => false
|
'cookies' => false
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -290,7 +290,14 @@ class Client implements ClientInterface
|
|||||||
*/
|
*/
|
||||||
private function applyOptions(RequestInterface $request, array &$options)
|
private function applyOptions(RequestInterface $request, array &$options)
|
||||||
{
|
{
|
||||||
$modify = [];
|
$modify = [
|
||||||
|
'set_headers' => [],
|
||||||
|
];
|
||||||
|
|
||||||
|
if (isset($options['headers'])) {
|
||||||
|
$modify['set_headers'] = $options['headers'];
|
||||||
|
unset($options['headers']);
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($options['form_params'])) {
|
if (isset($options['form_params'])) {
|
||||||
if (isset($options['multipart'])) {
|
if (isset($options['multipart'])) {
|
||||||
@ -302,6 +309,8 @@ class Client implements ClientInterface
|
|||||||
}
|
}
|
||||||
$options['body'] = http_build_query($options['form_params'], '', '&');
|
$options['body'] = http_build_query($options['form_params'], '', '&');
|
||||||
unset($options['form_params']);
|
unset($options['form_params']);
|
||||||
|
// Ensure that we don't have the header in different case and set the new value.
|
||||||
|
$options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']);
|
||||||
$options['_conditional']['Content-Type'] = 'application/x-www-form-urlencoded';
|
$options['_conditional']['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,24 +322,19 @@ class Client implements ClientInterface
|
|||||||
if (isset($options['json'])) {
|
if (isset($options['json'])) {
|
||||||
$options['body'] = \GuzzleHttp\json_encode($options['json']);
|
$options['body'] = \GuzzleHttp\json_encode($options['json']);
|
||||||
unset($options['json']);
|
unset($options['json']);
|
||||||
|
// Ensure that we don't have the header in different case and set the new value.
|
||||||
|
$options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']);
|
||||||
$options['_conditional']['Content-Type'] = 'application/json';
|
$options['_conditional']['Content-Type'] = 'application/json';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($options['decode_content'])
|
if (!empty($options['decode_content'])
|
||||||
&& $options['decode_content'] !== true
|
&& $options['decode_content'] !== true
|
||||||
) {
|
) {
|
||||||
|
// Ensure that we don't have the header in different case and set the new value.
|
||||||
|
$options['_conditional'] = Psr7\_caseless_remove(['Accept-Encoding'], $options['_conditional']);
|
||||||
$modify['set_headers']['Accept-Encoding'] = $options['decode_content'];
|
$modify['set_headers']['Accept-Encoding'] = $options['decode_content'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($options['headers'])) {
|
|
||||||
if (isset($modify['set_headers'])) {
|
|
||||||
$modify['set_headers'] = $options['headers'] + $modify['set_headers'];
|
|
||||||
} else {
|
|
||||||
$modify['set_headers'] = $options['headers'];
|
|
||||||
}
|
|
||||||
unset($options['headers']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($options['body'])) {
|
if (isset($options['body'])) {
|
||||||
if (is_array($options['body'])) {
|
if (is_array($options['body'])) {
|
||||||
$this->invalidBody();
|
$this->invalidBody();
|
||||||
@ -344,6 +348,8 @@ class Client implements ClientInterface
|
|||||||
$type = isset($value[2]) ? strtolower($value[2]) : 'basic';
|
$type = isset($value[2]) ? strtolower($value[2]) : 'basic';
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'basic':
|
case 'basic':
|
||||||
|
// Ensure that we don't have the header in different case and set the new value.
|
||||||
|
$modify['set_headers'] = Psr7\_caseless_remove(['Authorization'], $modify['set_headers']);
|
||||||
$modify['set_headers']['Authorization'] = 'Basic '
|
$modify['set_headers']['Authorization'] = 'Basic '
|
||||||
. base64_encode("$value[0]:$value[1]");
|
. base64_encode("$value[0]:$value[1]");
|
||||||
break;
|
break;
|
||||||
@ -382,6 +388,8 @@ class Client implements ClientInterface
|
|||||||
$request = Psr7\modify_request($request, $modify);
|
$request = Psr7\modify_request($request, $modify);
|
||||||
if ($request->getBody() instanceof Psr7\MultipartStream) {
|
if ($request->getBody() instanceof Psr7\MultipartStream) {
|
||||||
// Use a multipart/form-data POST if a Content-Type is not set.
|
// Use a multipart/form-data POST if a Content-Type is not set.
|
||||||
|
// Ensure that we don't have the header in different case and set the new value.
|
||||||
|
$options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']);
|
||||||
$options['_conditional']['Content-Type'] = 'multipart/form-data; boundary='
|
$options['_conditional']['Content-Type'] = 'multipart/form-data; boundary='
|
||||||
. $request->getBody()->getBoundary();
|
. $request->getBody()->getBoundary();
|
||||||
}
|
}
|
||||||
|
|||||||
6
vendor/overtrue/wechat/src/Core/Http.php
vendored
6
vendor/overtrue/wechat/src/Core/Http.php
vendored
@ -241,6 +241,8 @@ class Http
|
|||||||
Log::debug('Client Request:', compact('url', 'method', 'options'));
|
Log::debug('Client Request:', compact('url', 'method', 'options'));
|
||||||
|
|
||||||
$options['handler'] = $this->getHandler();
|
$options['handler'] = $this->getHandler();
|
||||||
|
//不验证CA证书
|
||||||
|
$options['verify'] = false;
|
||||||
|
|
||||||
$response = $this->getClient()->request($method, $url, $options);
|
$response = $this->getClient()->request($method, $url, $options);
|
||||||
|
|
||||||
@ -264,7 +266,7 @@ class Http
|
|||||||
public function parseJSON($body)
|
public function parseJSON($body)
|
||||||
{
|
{
|
||||||
if ($body instanceof ResponseInterface) {
|
if ($body instanceof ResponseInterface) {
|
||||||
$body = $body->getBody();
|
$body = mb_convert_encoding($body->getBody(), 'UTF-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: json maybe contains special chars. So, let's FUCK the WeChat API developers ...
|
// XXX: json maybe contains special chars. So, let's FUCK the WeChat API developers ...
|
||||||
@ -274,7 +276,7 @@ class Http
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$contents = json_decode($body, true);
|
$contents = json_decode($body, true, 512, JSON_BIGINT_AS_STRING);
|
||||||
|
|
||||||
Log::debug('API response decoded:', compact('contents'));
|
Log::debug('API response decoded:', compact('contents'));
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user