]> git.mxchange.org Git - mailer.git/blobdiff - inc/http-functions.php
Detect https and double-dot (port number)
[mailer.git] / inc / http-functions.php
index 8ae5daa78323c9e8a7512fa57d550a51b938b1d5..8932af62882342f0f92a76a06851f3444404b592 100644 (file)
@@ -650,11 +650,20 @@ function extractHostnameFromUrl (&$script) {
        } // END - if
 
        // Extract host name
-       $host = str_replace('http://', '', $url);
+       $host = str_replace(array('http://', 'https://'), array('', ''), $url);
+
+       // Is there a slash at the end?
        if (isInString('/', $host)) {
                $host = substr($host, 0, strpos($host, '/'));
        } // END - if
 
+       // Is there a double-dot in? (Means port number)
+       if (strpos($host, ':') !== FALSE) {
+               // Detected a double-dot
+               $hostArray = explode(':', $host);
+               $host = $hostArray[0];
+       } // END - if
+
        // Generate relative URL
        //* DEBUG: */ debugOutput('SCRIPT=' . $script);
        if (substr(strtolower($script), 0, 7) == 'http://') {