Skip to content

Commit bfd39df

Browse files
jessevzzyronixs3inlc
authored
Ipv6 support in buildServerUrl() (#1076)
* Adding loops to scan through lines to support importing hashes longer then 1024 bytes * Made ipv6 working in server utils --------- Co-authored-by: Romke van Dijk <[email protected]> Co-authored-by: Sein Coray <[email protected]>
1 parent bd19ec1 commit bfd39df

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/inc/Util.class.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,14 +1153,13 @@ public static function buildServerUrl() {
11531153
$protocol = (isset($_SERVER['HTTPS']) && (strcasecmp('off', $_SERVER['HTTPS']) !== 0)) ? "https://" : "http://";
11541154
$hostname = $_SERVER['HTTP_HOST'];
11551155
$port = $_SERVER['SERVER_PORT'];
1156-
if (strpos($hostname, ":") !== false) {
1157-
$hostname = substr($hostname, 0, strpos($hostname, ":"));
1158-
}
1156+
11591157
if ($protocol == "https://" && $port == 443 || $protocol == "http://" && $port == 80) {
11601158
$port = "";
11611159
}
11621160
else {
11631161
$port = ":$port";
1162+
$hostname = substr($hostname, 0, strrpos($hostname, ":")); //Needs to use strrpos in case of ipv6 because of multiple ':' characters
11641163
}
11651164
return $protocol . $hostname . $port;
11661165
}

0 commit comments

Comments
 (0)