From 60f134a2cd7149fa063bc797bc9db1d8ccdb4031 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 30 Mar 2017 08:59:56 +0200 Subject: [PATCH] Fix #1790 proxy should not end with / --- src/Handler/StreamHandler.php | 2 +- tests/Handler/StreamHandlerTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Handler/StreamHandler.php b/src/Handler/StreamHandler.php index d36787a..1f868b8 100644 --- a/src/Handler/StreamHandler.php +++ b/src/Handler/StreamHandler.php @@ -381,7 +381,7 @@ private function add_proxy(RequestInterface $request, &$options, $value, &$param $value['no'] ) ) { - $options['http']['proxy'] = $value[$scheme]; + $options['http']['proxy'] = rtrim($value[$scheme], '/'); } } } diff --git a/tests/Handler/StreamHandlerTest.php b/tests/Handler/StreamHandlerTest.php index c04a824..8449549 100644 --- a/tests/Handler/StreamHandlerTest.php +++ b/tests/Handler/StreamHandlerTest.php @@ -272,7 +272,7 @@ public function testAddsProxyByProtocol() $url = str_replace('http', 'tcp', Server::$url); $res = $this->getSendResult(['proxy' => ['http' => $url]]); $opts = stream_context_get_options($res->getBody()->detach()); - $this->assertEquals($url, $opts['http']['proxy']); + $this->assertEquals(rtrim($url, '/'), $opts['http']['proxy']); } public function testAddsProxyButHonorsNoProxy()