File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 ' );
You can’t perform that action at this time.
0 commit comments