Skip to content

Commit 8e0d76b

Browse files
authored
Merge pull request #555 from DieterHolvoet/issue/host-matching
Only match exact main and subdomains
2 parents 62bd050 + 074bb42 commit 8e0d76b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/ExtractorFactory.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,14 @@ public function createExtractor(UriInterface $uri, RequestInterface $request, Re
4646
$class = $this->default;
4747

4848
foreach ($this->adapters as $adapterHost => $adapter) {
49-
if (substr($host, -strlen($adapterHost)) === $adapterHost) {
49+
// Check if $host is the same domain as $adapterHost.
50+
if ($host === $adapterHost) {
51+
$class = $adapter;
52+
break;
53+
}
54+
55+
// Check if $host is a subdomain of $adapterHost.
56+
if (substr($host, -strlen($adapterHost) + 1) === ".{$adapterHost}") {
5057
$class = $adapter;
5158
break;
5259
}

0 commit comments

Comments
 (0)