Skip to content

Commit a19f3c7

Browse files
committed
Merge branch '4.4' into 5.4
* 4.4: Update ExceptionInterface.php Flush with flush() after ob_end_flush() [HttpFoundation] Fix deleteFileAfterSend on client abortion fix sending request to paths containing multiple slashes
2 parents 18e7317 + dd61895 commit a19f3c7

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

AbstractBrowser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ protected function getAbsoluteUri(string $uri)
658658
}
659659

660660
// protocol relative URL
661-
if (0 === strpos($uri, '//')) {
661+
if ('' !== trim($uri, '/') && str_starts_with($uri, '//')) {
662662
return parse_url($currentUri, \PHP_URL_SCHEME).':'.$uri;
663663
}
664664

Tests/HttpBrowserTest.php

+24
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,30 @@ public function testMultiPartRequestWithAdditionalParametersOfTheSameName()
180180
]);
181181
}
182182

183+
/**
184+
* @dataProvider forwardSlashesRequestPathProvider
185+
*/
186+
public function testMultipleForwardSlashesRequestPath(string $requestPath)
187+
{
188+
$client = $this->createMock(HttpClientInterface::class);
189+
$client
190+
->expects($this->once())
191+
->method('request')
192+
->with('GET', 'http://localhost'.$requestPath)
193+
->willReturn($this->createMock(ResponseInterface::class));
194+
$browser = new HttpBrowser($client);
195+
$browser->request('GET', $requestPath);
196+
}
197+
198+
public function forwardSlashesRequestPathProvider()
199+
{
200+
return [
201+
'one slash' => ['/'],
202+
'two slashes' => ['//'],
203+
'multiple slashes' => ['////'],
204+
];
205+
}
206+
183207
private function uploadFile(string $data): string
184208
{
185209
$path = tempnam(sys_get_temp_dir(), 'http');

0 commit comments

Comments
 (0)