Skip to content

Commit 77897b0

Browse files
author
Taois
committed
fix: pd
1 parent 3ada877 commit 77897b0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

spider/php/lib/HtmlParser.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ private function urlJoin($baseUrl, $relativeUrl) {
189189
$scheme = isset($parts['scheme']) ? $parts['scheme'] . '://' : 'http://';
190190
$host = isset($parts['host']) ? $parts['host'] : '';
191191

192+
// Handle protocol-relative URLs (starting with //)
193+
if (substr($relativeUrl, 0, 2) == '//') {
194+
return (isset($parts['scheme']) ? $parts['scheme'] . ':' : 'http:') . $relativeUrl;
195+
}
196+
192197
if (substr($relativeUrl, 0, 1) == '/') {
193198
return $scheme . $host . $relativeUrl;
194199
}

0 commit comments

Comments
 (0)