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
686
686
687
687
private function prependMissingScheme (string $ host ): string
688
688
{
689
- if (!filter_var ( $ host , FILTER_VALIDATE_URL )) {
689
+ if (!preg_match ( " /^https?:\/\// " , $ host )) {
690
690
$ host = 'http:// ' . $ host ;
691
691
}
692
692
Original file line number Diff line number Diff line change @@ -312,6 +312,17 @@ public function testInlineHosts()
312
312
$ this ->assertSame (9200 , $ host ->getPort ());
313
313
$ this ->assertSame ("https " , $ host ->getTransportSchema ());
314
314
$ 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 ());
315
326
}
316
327
317
328
public function testExtendedHosts ()
@@ -417,7 +428,7 @@ public function testExtendedHosts()
417
428
// good
418
429
}
419
430
420
- // Underscore host, questionably legal, but inline method would break
431
+ // Underscore host, questionably legal
421
432
$ client = Elasticsearch \ClientBuilder::create ()->setHosts (
422
433
[
423
434
[
You can’t perform that action at this time.
0 commit comments