Merge pull request !36 from Ruing/fix

This commit is contained in:
Ruing 2017-02-04 08:58:30 +08:00 committed by Discuz!
commit c8732c9e74
4 changed files with 12 additions and 12 deletions

View File

@ -867,7 +867,7 @@ function dfopen($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $
$scheme = $matches['scheme']; $scheme = $matches['scheme'];
$host = $matches['host']; $host = $matches['host'];
$path = $matches['path'] ? $matches['path'].($matches['query'] ? '?'.$matches['query'] : '') : '/'; $path = $matches['path'] ? $matches['path'].($matches['query'] ? '?'.$matches['query'] : '') : '/';
$port = !empty($matches['port']) ? $matches['port'] : 80; $port = !empty($matches['port']) ? $matches['port'] : ($matches['scheme'] == 'https' ? 443 : 80);
if(function_exists('curl_init') && $allowcurl) { if(function_exists('curl_init') && $allowcurl) {
$ch = curl_init(); $ch = curl_init();
@ -923,7 +923,7 @@ function dfopen($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $
} }
$fpflag = 0; $fpflag = 0;
if(!$fp = @fsocketopen(($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( $context = array(
'http' => array( 'http' => array(
'method' => $post ? 'POST' : 'GET', 'method' => $post ? 'POST' : 'GET',
@ -933,7 +933,7 @@ function dfopen($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $
), ),
); );
$context = stream_context_create($context); $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; $fpflag = 1;
} }

View File

@ -67,7 +67,7 @@ class miscmodel {
$scheme = $matches['scheme']; $scheme = $matches['scheme'];
$host = $matches['host']; $host = $matches['host'];
$path = $matches['path'] ? $matches['path'].($matches['query'] ? '?'.$matches['query'] : '') : '/'; $path = $matches['path'] ? $matches['path'].($matches['query'] ? '?'.$matches['query'] : '') : '/';
$port = !empty($matches['port']) ? $matches['port'] : 80; $port = !empty($matches['port']) ? $matches['port'] : ($matches['scheme'] == 'https' ? 443 : 80);
if($post) { if($post) {
$out = "POST $path HTTP/1.0\r\n"; $out = "POST $path HTTP/1.0\r\n";
@ -94,7 +94,7 @@ class miscmodel {
} }
$fpflag = 0; $fpflag = 0;
if(!$fp = @fsocketopen(($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( $context = array(
'http' => array( 'http' => array(
'method' => $post ? 'POST' : 'GET', 'method' => $post ? 'POST' : 'GET',
@ -104,7 +104,7 @@ class miscmodel {
), ),
); );
$context = stream_context_create($context); $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; $fpflag = 1;
} }

View File

@ -747,7 +747,7 @@ function dfopen($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $
$scheme = $matches['scheme']; $scheme = $matches['scheme'];
$host = $matches['host']; $host = $matches['host'];
$path = $matches['path'] ? $matches['path'].(isset($matches['query']) && $matches['query'] ? '?'.$matches['query'] : '') : '/'; $path = $matches['path'] ? $matches['path'].(isset($matches['query']) && $matches['query'] ? '?'.$matches['query'] : '') : '/';
$port = !empty($matches['port']) ? $matches['port'] : 80; $port = !empty($matches['port']) ? $matches['port'] : ($matches['scheme'] == 'https' ? 443 : 80);
if($post) { if($post) {
$out = "POST $path HTTP/1.0\r\n"; $out = "POST $path HTTP/1.0\r\n";
@ -773,7 +773,7 @@ function dfopen($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $
} }
$fpflag = 0; $fpflag = 0;
if(!$fp = @fsocketopen(($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( $context = array(
'http' => array( 'http' => array(
'method' => $post ? 'POST' : 'GET', 'method' => $post ? 'POST' : 'GET',
@ -783,7 +783,7 @@ function dfopen($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $
), ),
); );
$context = stream_context_create($context); $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; $fpflag = 1;
} }

View File

@ -65,7 +65,7 @@ class miscmodel {
$scheme = $matches['scheme']; $scheme = $matches['scheme'];
$host = $matches['host']; $host = $matches['host'];
$path = $matches['path'] ? $matches['path'].($matches['query'] ? '?'.$matches['query'] : '') : '/'; $path = $matches['path'] ? $matches['path'].($matches['query'] ? '?'.$matches['query'] : '') : '/';
$port = !empty($matches['port']) ? $matches['port'] : 80; $port = !empty($matches['port']) ? $matches['port'] : ($matches['scheme'] == 'https' ? 443 : 80);
if($post) { if($post) {
$out = "POST $path HTTP/1.0\r\n"; $out = "POST $path HTTP/1.0\r\n";
@ -92,7 +92,7 @@ class miscmodel {
} }
$fpflag = 0; $fpflag = 0;
if(!$fp = @fsocketopen(($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( $context = array(
'http' => array( 'http' => array(
'method' => $post ? 'POST' : 'GET', 'method' => $post ? 'POST' : 'GET',
@ -102,7 +102,7 @@ class miscmodel {
), ),
); );
$context = stream_context_create($context); $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; $fpflag = 1;
} }