From a48ca5716d944515cde6fe087673c3a88a670f40 Mon Sep 17 00:00:00 2001 From: jakubpolomsky Date: Mon, 16 Jan 2017 15:52:05 +0100 Subject: [PATCH 1/2] #15 update StreamHandler for guzzle/ring --- .../GuzzleHttp/Ring/Client/StreamHandler.php | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/wirecardceecheckoutseamless/vendor/GuzzleHttp/Ring/Client/StreamHandler.php b/wirecardceecheckoutseamless/vendor/GuzzleHttp/Ring/Client/StreamHandler.php index 39768de..4bacec1 100644 --- a/wirecardceecheckoutseamless/vendor/GuzzleHttp/Ring/Client/StreamHandler.php +++ b/wirecardceecheckoutseamless/vendor/GuzzleHttp/Ring/Client/StreamHandler.php @@ -16,6 +16,7 @@ class StreamHandler { private $options; + private $lastHeaders; public function __construct(array $options = []) { @@ -30,17 +31,20 @@ public function __invoke(array $request) try { // Does not support the expect header. $request = Core::removeHeader($request, 'Expect'); - $stream = $this->createStream($url, $request, $headers); - return $this->createResponse($request, $url, $headers, $stream); + $stream = $this->createStream($url, $request); + return $this->createResponse($request, $url, $stream); } catch (RingException $e) { return $this->createErrorResponse($url, $e); } } - private function createResponse(array $request, $url, array $hdrs, $stream) + private function createResponse(array $request, $url, $stream) { + $hdrs = $this->lastHeaders; + $this->lastHeaders = null; $parts = explode(' ', array_shift($hdrs), 3); $response = [ + 'version' => substr($parts[0], 5), 'status' => $parts[1], 'reason' => isset($parts[2]) ? $parts[2] : null, 'headers' => Core::headersFromLines($hdrs), @@ -176,11 +180,8 @@ private function createResource(callable $callback) return $resource; } - private function createStream( - $url, - array $request, - &$http_response_header - ) { + private function createStream($url, array $request) + { static $methods; if (!$methods) { $methods = array_flip(get_class_methods(__CLASS__)); @@ -215,8 +216,7 @@ private function createStream( $url, $request, $options, - $this->createContext($request, $options, $params), - $http_response_header + $this->createContext($request, $options, $params) ); } @@ -285,13 +285,14 @@ private function add_verify(array $request, &$options, $value, &$params) } } elseif ($value === false) { $options['ssl']['verify_peer'] = false; + $options['ssl']['allow_self_signed'] = true; return; } else { throw new RingException('Invalid verify request option'); } $options['ssl']['verify_peer'] = true; - $options['ssl']['allow_self_signed'] = true; + $options['ssl']['allow_self_signed'] = false; } private function add_cert(array $request, &$options, $value, &$params) @@ -310,7 +311,7 @@ private function add_cert(array $request, &$options, $value, &$params) private function add_progress(array $request, &$options, $value, &$params) { - $fn = function ($code, $_, $_, $_, $transferred, $total) use ($value) { + $fn = function ($code, $_1, $_2, $_3, $transferred, $total) use ($value) { if ($code == STREAM_NOTIFY_PROGRESS) { $value($total, $transferred, null, null); } @@ -394,16 +395,17 @@ private function createStreamResource( $url, array $request, array $options, - $context, - &$http_response_header + $context ) { return $this->createResource( - function () use ($url, &$http_response_header, $context) { + function () use ($url, $context) { if (false === strpos($url, 'http')) { trigger_error("URL is invalid: {$url}", E_USER_WARNING); return null; } - return fopen($url, 'r', null, $context); + $resource = fopen($url, 'r', null, $context); + $this->lastHeaders = $http_response_header; + return $resource; }, $request, $options From 37819595d663b163a3f63aa7d5a5e7688c90ac97 Mon Sep 17 00:00:00 2001 From: jakubpolomsky Date: Mon, 16 Jan 2017 15:53:50 +0100 Subject: [PATCH 2/2] #16 update version number --- wirecardceecheckoutseamless/config.xml | 2 +- wirecardceecheckoutseamless/wirecardceecheckoutseamless.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wirecardceecheckoutseamless/config.xml b/wirecardceecheckoutseamless/config.xml index 5eece8e..2f47d91 100644 --- a/wirecardceecheckoutseamless/config.xml +++ b/wirecardceecheckoutseamless/config.xml @@ -2,7 +2,7 @@ wirecardceecheckoutseamless - + diff --git a/wirecardceecheckoutseamless/wirecardceecheckoutseamless.php b/wirecardceecheckoutseamless/wirecardceecheckoutseamless.php index 23a3fc0..19ad84b 100644 --- a/wirecardceecheckoutseamless/wirecardceecheckoutseamless.php +++ b/wirecardceecheckoutseamless/wirecardceecheckoutseamless.php @@ -121,7 +121,7 @@ public function __construct() $this->config = $this->config(); $this->name = 'wirecardceecheckoutseamless'; $this->tab = 'payments_gateways'; - $this->version = '1.0.2'; + $this->version = '1.0.3'; $this->author = 'Wirecard'; $this->controllers = array( 'confirm',