File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
tests/Elasticsearch/Tests Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -686,7 +686,7 @@ private function extractURIParts(string $host): array
686686
687687 private function prependMissingScheme (string $ host ): string
688688 {
689- if (!filter_var ( $ host , FILTER_VALIDATE_URL )) {
689+ if (!preg_match ( " /^https?:\/\// " , $ host )) {
690690 $ host = 'http:// ' . $ host ;
691691 }
692692
Original file line number Diff line number Diff line change @@ -312,6 +312,17 @@ public function testInlineHosts()
312312 $ this ->assertSame (9200 , $ host ->getPort ());
313313 $ this ->assertSame ("https " , $ host ->getTransportSchema ());
314314 $ this ->assertSame ("user:pass " , $ host ->getUserPass ());
315+
316+ $ client = Elasticsearch \ClientBuilder::create ()->setHosts (
317+ [
318+ 'https://user:pass@the_foo.com:9200 '
319+ ]
320+ )->build ();
321+ $ host = $ client ->transport ->getConnection ();
322+ $ this ->assertSame ("the_foo.com " , $ host ->getHost ());
323+ $ this ->assertSame (9200 , $ host ->getPort ());
324+ $ this ->assertSame ("https " , $ host ->getTransportSchema ());
325+ $ this ->assertSame ("user:pass " , $ host ->getUserPass ());
315326 }
316327
317328 public function testExtendedHosts ()
@@ -417,7 +428,7 @@ public function testExtendedHosts()
417428 // good
418429 }
419430
420- // Underscore host, questionably legal, but inline method would break
431+ // Underscore host, questionably legal
421432 $ client = Elasticsearch \ClientBuilder::create ()->setHosts (
422433 [
423434 [
You can’t perform that action at this time.
0 commit comments