Skip to content

Commit ba42ed5

Browse files
committed
fix sending request to double slash path
1 parent 212de38 commit ba42ed5

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/Symfony/Component/BrowserKit/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ protected function getAbsoluteUri($uri)
676676
}
677677

678678
// protocol relative URL
679-
if (str_starts_with($uri, '//')) {
679+
if ('//' !== $uri && str_starts_with($uri, '//')) {
680680
return parse_url($currentUri, \PHP_URL_SCHEME).':'.$uri;
681681
}
682682

src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,18 @@ public function testMultiPartRequestWithAdditionalParametersOfTheSameName()
172172
]);
173173
}
174174

175+
public function testDoubleForwardSlashRequestPath()
176+
{
177+
$client = $this->createMock(HttpClientInterface::class);
178+
$client
179+
->expects($this->once())
180+
->method('request')
181+
->with('GET', 'http://localhost//')
182+
->willReturn($this->createMock(ResponseInterface::class));
183+
$browser = new HttpBrowser($client);
184+
$browser->request('GET', '//');
185+
}
186+
175187
private function uploadFile(string $data): string
176188
{
177189
$path = tempnam(sys_get_temp_dir(), 'http');

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy