Skip to content

Commit

Permalink
Squashed 'src/http-client/' changes from cb768475..aec7d3b5
Browse files Browse the repository at this point in the history
aec7d3b5 fix default options replace user options problem. (#125)
65733dba [HTTP-Client] cURL driver don't verify cert and host
d0bdf15e  add coWrite(); use swoft/swoole-ide-helper (#83)

git-subtree-dir: src/http-client
git-subtree-split: aec7d3b57ce986386f4b71ff757a0f5e0464bdee
  • Loading branch information
huangzhhui committed Jul 10, 2018
1 parent 88d07a8 commit 08d4e9c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"swoft/framework": "^1.0"
},
"require-dev": {
"eaglewu/swoole-ide-helper": "dev-master",
"swoft/swoole-ide-helper": "dev-master",
"phpunit/phpunit": "^5.7"
},
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/CoroutineAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ protected function applyOptions(CoHttpClient $client, RequestInterface $request,
$headers[$ucKey] = \is_array($value) ? current($value) : $value;
}
unset($str);
$headers = array_replace($headers, (array)($options['_headers'] ?? []));
$headers = array_replace((array)($options['_headers'] ?? []), $headers);
return $headers;
});
$client->setHeaders($headers ?? []);
Expand Down
6 changes: 3 additions & 3 deletions src/Adapter/CurlAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public function request(RequestInterface $request, array $options = []): HttpRes
curl_setopt($resource, CURLINFO_HEADER_OUT, true);
curl_setopt($resource, CURLOPT_RETURNTRANSFER, true);
// HTTPS do not verify Certificate and HOST
curl_setopt($resource, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($resource, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($resource, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($resource, CURLOPT_SSL_VERIFYHOST, 0);

$result = curl_exec($resource);

Expand Down Expand Up @@ -184,7 +184,7 @@ private function applyOptions($resource, RequestInterface $request, array &$opti
$ucKey = implode('-', $exploded);
$headers[$ucKey] = \is_array($value) ? current($value) : $value;
}
$headers = array_replace($headers, (array)($options['_headers'] ?? []));
$headers = array_replace((array)($options['_headers'] ?? []), $headers);
return $headers;
});
foreach ((array)$headers as $name => $value) {
Expand Down

0 comments on commit 08d4e9c

Please sign in to comment.