summaryrefslogtreecommitdiffstats
path: root/php-guzzlehttp-guzzle6-upstream-pull-1792.patch
blob: dbf61688d18a0c9b9c98ce96a49c1e6dddd61041 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From 60f134a2cd7149fa063bc797bc9db1d8ccdb4031 Mon Sep 17 00:00:00 2001
From: Remi Collet <fedora@famillecollet.com>
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()