修复纯HTTPS协议下的UCenter通信问题

This commit is contained in:
Ruing 2017-02-03 22:45:50 +08:00
parent 25a605f457
commit 4764fcccee
1 changed files with 3 additions and 3 deletions

View File

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