リビジョン | de488170bed4231ee9b6864894998aa475d36979 (tree) |
---|---|
日時 | 2017-10-21 01:27:13 |
作者 | umorigu <umorigu@gmai...> |
コミッター | umorigu |
BugTrack/2442 showrss plugin - Support HTTPS RSS feeds
@@ -1,7 +1,7 @@ | ||
1 | 1 | <?php |
2 | 2 | // PukiWiki - Yet another WikiWikiWeb clone |
3 | 3 | // proxy.php |
4 | -// Copyright: 2003-2016 PukiWiki Development Team | |
4 | +// Copyright: 2003-2017 PukiWiki Development Team | |
5 | 5 | // License: GPL v2 or (at your option) any later version |
6 | 6 | // |
7 | 7 | // HTTP-Proxy related functions |
@@ -35,7 +35,6 @@ function pkwk_http_request($url, $method = 'GET', $headers = '', $post = array() | ||
35 | 35 | { |
36 | 36 | global $use_proxy, $no_proxy, $proxy_host, $proxy_port; |
37 | 37 | global $need_proxy_auth, $proxy_auth_user, $proxy_auth_pass; |
38 | - | |
39 | 38 | $rc = array(); |
40 | 39 | $arr = parse_url($url); |
41 | 40 |
@@ -44,7 +43,13 @@ function pkwk_http_request($url, $method = 'GET', $headers = '', $post = array() | ||
44 | 43 | // query |
45 | 44 | $arr['query'] = isset($arr['query']) ? '?' . $arr['query'] : ''; |
46 | 45 | // port |
47 | - $arr['port'] = isset($arr['port']) ? $arr['port'] : 80; | |
46 | + if (!isset($arr['port'])) { | |
47 | + if ($arr['scheme'] === 'https') { | |
48 | + $arr['port'] = 443; | |
49 | + } else { | |
50 | + $arr['port'] = 80; | |
51 | + } | |
52 | + } | |
48 | 53 | |
49 | 54 | $url_base = $arr['scheme'] . '://' . $arr['host'] . ':' . $arr['port']; |
50 | 55 | $url_path = isset($arr['path']) ? $arr['path'] : '/'; |
@@ -90,8 +95,12 @@ function pkwk_http_request($url, $method = 'GET', $headers = '', $post = array() | ||
90 | 95 | |
91 | 96 | $errno = 0; |
92 | 97 | $errstr = ''; |
98 | + $ssl_prefix = ''; | |
99 | + if ($arr['scheme'] === 'https') { | |
100 | + $ssl_prefix = 'ssl://'; | |
101 | + } | |
93 | 102 | $fp = fsockopen( |
94 | - $via_proxy ? $proxy_host : $arr['host'], | |
103 | + $ssl_prefix . ($via_proxy ? $proxy_host : $arr['host']), | |
95 | 104 | $via_proxy ? $proxy_port : $arr['port'], |
96 | 105 | $errno, $errstr, 30); |
97 | 106 | if ($fp === FALSE) { |