From e2645a7a43c93ea481a485428946a6654d36620e Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Sat, 2 Feb 2019 17:37:52 +0100 Subject: [PATCH] Prepare for RC1 (#378) --- CHANGELOG.md | 4 +++- lib/Browser.php | 14 ++++++-------- lib/Client/Curl.php | 12 ++++++------ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8dbd4feb..88eb97d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,13 @@ The change log shows what have been Added, Changed, Deprecated and Removed between versions. -## 1.0.0-beta3 +## 1.0.0-rc1 ### Added +- Support for HTTP/2 server push. - Option `expose_curl_info` has been added to expose curl metadata information +- Added `CallbackException` for Curl clients. ### Changed diff --git a/lib/Browser.php b/lib/Browser.php index 325b5a65..2d814730 100644 --- a/lib/Browser.php +++ b/lib/Browser.php @@ -165,10 +165,9 @@ private function createMiddlewareChain(array $middleware, callable $requestChain $responseChainNext = $responseChainLast; // Build response chain - /** @var MiddlewareInterface $middleware */ - foreach ($middleware as $middleware) { - $lastCallable = function (RequestInterface $request, ResponseInterface $response) use ($middleware, $responseChainNext) { - return $middleware->handleResponse($request, $response, $responseChainNext); + foreach ($middleware as $m) { + $lastCallable = function (RequestInterface $request, ResponseInterface $response) use ($m, $responseChainNext) { + return $m->handleResponse($request, $response, $responseChainNext); }; $responseChainNext = $lastCallable; @@ -183,10 +182,9 @@ private function createMiddlewareChain(array $middleware, callable $requestChain // Build request chain $requestChainNext = $requestChainLast; - /** @var MiddlewareInterface $middleware */ - foreach ($middleware as $middleware) { - $lastCallable = function (RequestInterface $request) use ($middleware, $requestChainNext) { - return $middleware->handleRequest($request, $requestChainNext); + foreach ($middleware as $m) { + $lastCallable = function (RequestInterface $request) use ($m, $requestChainNext) { + return $m->handleRequest($request, $requestChainNext); }; $requestChainNext = $lastCallable; diff --git a/lib/Client/Curl.php b/lib/Client/Curl.php index 9a46f175..a46f62e4 100644 --- a/lib/Client/Curl.php +++ b/lib/Client/Curl.php @@ -22,17 +22,17 @@ public function sendRequest(RequestInterface $request, array $options = []): Res try { curl_exec($curl); $this->parseError($request, curl_errno($curl), $curl); - $curlInfo = curl_getinfo($curl); + + if ($options->get('expose_curl_info')) { + $curlInfo = curl_getinfo($curl); + } } finally { $this->releaseHandle($curl); } $response = $responseBuilder->getResponse(); - if ($options->get('expose_curl_info', false)) { - $value = json_encode($curlInfo); - if (false !== $value) { - $response = $response->withHeader('__curl_info', $value); - } + if (null !== $curlInfo && $value = json_encode($curlInfo)) { + $response = $response->withHeader('__curl_info', $value); } return $response;