diff --git a/upload/uc_server/model/misc.php b/upload/uc_server/model/misc.php index 4edc4d8..49c9f78 100644 --- a/upload/uc_server/model/misc.php +++ b/upload/uc_server/model/misc.php @@ -65,14 +65,7 @@ class miscmodel { $scheme = $matches['scheme']; $host = $matches['host']; $path = $matches['path'] ? $matches['path'].($matches['query'] ? '?'.$matches['query'] : '') : '/'; - $port = !empty($matches['port']) ? $matches['port'] : 80; - - if($scheme = 'https'){ - $scheme = 'ssl'; - if($port == 80){ - $port = 443; - } - } + $port = !empty($matches['port']) ? $matches['port'] : ($matches['scheme'] == 'https' ? 443 : 80); if($post) { $out = "POST $path HTTP/1.0\r\n"; @@ -99,7 +92,7 @@ class miscmodel { } $fpflag = 0; - if(!$fp = @fsocketopen($scheme.'://'.($ip ? $ip : $host), $port, $errno, $errstr, $timeout)) { + if(!$fp = @fsocketopen(($scheme == 'https' ? 'ssl' : $scheme).'://'.($scheme == 'https' ? $host : ($ip ? $ip : $host)), $port, $errno, $errstr, $timeout)) { $context = array( 'http' => array( 'method' => $post ? 'POST' : 'GET', @@ -109,7 +102,7 @@ class miscmodel { ), ); $context = stream_context_create($context); - $fp = @fopen($scheme.'://'.($ip ? $ip : $host).':'.$port.$path, 'b', false, $context); + $fp = @fopen($scheme.'://'.($scheme == 'https' ? $host : ($ip ? $ip : $host)).':'.$port.$path, 'b', false, $context); $fpflag = 1; }