File tree 2 files changed +25
-1
lines changed
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)
658
658
}
659
659
660
660
// protocol relative URL
661
- if (0 === strpos ($ uri , '// ' )) {
661
+ if ('' !== trim ( $ uri , ' / ' ) && str_starts_with ($ uri , '// ' )) {
662
662
return parse_url ($ currentUri , \PHP_URL_SCHEME ).': ' .$ uri ;
663
663
}
664
664
Original file line number Diff line number Diff line change @@ -180,6 +180,30 @@ public function testMultiPartRequestWithAdditionalParametersOfTheSameName()
180
180
]);
181
181
}
182
182
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
+
183
207
private function uploadFile (string $ data ): string
184
208
{
185
209
$ path = tempnam (sys_get_temp_dir (), 'http ' );
You can’t perform that action at this time.
0 commit comments