Skip to content

Commit 2fd94aa

Browse files
committed
fix isHttp function
1 parent 5cb6c28 commit 2fd94aa

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Extractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public function resolveUri($uri): UriInterface
176176
{
177177
if (is_string($uri)) {
178178
if (!isHttp($uri)) {
179-
throw new InvalidArgumentException('Uri string must use http or https scheme');
179+
throw new InvalidArgumentException(sprintf('Uri string must use http or https scheme (%s)', $uri));
180180
}
181181

182182
$uri = $this->crawler->createUri($uri);

src/functions.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ function resolveUri(UriInterface $base, UriInterface $uri): UriInterface
6363

6464
function isHttp(string $uri): bool
6565
{
66-
return (bool) preg_match('#^(https?:|\.|/)#', $uri);
66+
if (preg_match('/^(w+):/', $uri, $matches)) {
67+
return in_array(strtolower($matches[1]), ['http', 'https']);
68+
}
69+
70+
return true;
6771
}
6872

6973
function resolvePath(string $base, string $path): string

0 commit comments

Comments
 (0)