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

This commit is contained in:
Ruing 2017-02-01 20:55:21 +08:00
parent 7b8ce575cd
commit def9b78e8c
1 changed files with 8 additions and 1 deletions

View File

@ -67,6 +67,13 @@ class miscmodel {
$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;
}
}
if($post) {
$out = "POST $path HTTP/1.0\r\n";
$header = "Accept: */*\r\n";
@ -92,7 +99,7 @@ class miscmodel {
}
$fpflag = 0;
if(!$fp = @fsocketopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout)) {
if(!$fp = @fsocketopen($scheme.'://'.($ip ? $ip : $host), $port, $errno, $errstr, $timeout)) {
$context = array(
'http' => array(
'method' => $post ? 'POST' : 'GET',