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 @@ -676,7 +676,7 @@ protected function getAbsoluteUri($uri)
676676 }
677677
678678 // protocol relative URL
679- if (str_starts_with ($ uri , '// ' )) {
679+ if ('' !== trim ( $ uri , ' / ' ) && str_starts_with ($ uri , '// ' )) {
680680 return parse_url ($ currentUri , \PHP_URL_SCHEME ).': ' .$ uri ;
681681 }
682682
Original file line number Diff line number Diff line change @@ -172,6 +172,30 @@ public function testMultiPartRequestWithAdditionalParametersOfTheSameName()
172172 ]);
173173 }
174174
175+ /**
176+ * @dataProvider forwardSlashesRequestPathProvider
177+ */
178+ public function testMultipleForwardSlashesRequestPath (string $ requestPath )
179+ {
180+ $ client = $ this ->createMock (HttpClientInterface::class);
181+ $ client
182+ ->expects ($ this ->once ())
183+ ->method ('request ' )
184+ ->with ('GET ' , 'http://localhost ' .$ requestPath )
185+ ->willReturn ($ this ->createMock (ResponseInterface::class));
186+ $ browser = new HttpBrowser ($ client );
187+ $ browser ->request ('GET ' , $ requestPath );
188+ }
189+
190+ public function forwardSlashesRequestPathProvider ()
191+ {
192+ return [
193+ 'one slash ' => ['/ ' ],
194+ 'two slashes ' => ['// ' ],
195+ 'multiple slashes ' => ['//// ' ],
196+ ];
197+ }
198+
175199 private function uploadFile (string $ data ): string
176200 {
177201 $ path = tempnam (sys_get_temp_dir (), 'http ' );
You can’t perform that action at this time.
0 commit comments