Skip to content

Commit

Permalink
HTTP接続ではSSL関係の設定を無視するように変更
Browse files Browse the repository at this point in the history
  • Loading branch information
2ch774 committed Apr 3, 2015
1 parent 9ab3529 commit ca6328b
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions lib/P2Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -2240,14 +2240,21 @@ static public function getBe2chCodeByMailPass($mail, $pass)
/**
* HTTP_Request2クラスのインスタンスを生成する
*
* @param $url HTTP_Request2と同じ
* @param string $url 文字列のURL(絶対に必須)
* @param $method HTTP_Request2と同じ
* @return HTTP_Request2
*/
static public function getHTTPRequest2($url , $method = HTTP_Request2::METHOD_GET)
{
global $_conf;

$protocol = parse_url($url, PHP_URL_SCHEME);

if(empty($url) || $protocol === false)
{
throw new InvalidArgumentException("URLの指定が変です。");
}

$req = new HTTP_Request2($url, $method);

// タイムアウトの設定
Expand All @@ -2257,11 +2264,13 @@ static public function getHTTPRequest2($url , $method = HTTP_Request2::METHOD_GE
));

// SSLの設定
$req->setAdapter($_conf['ssl_function']);
if($protocol == 'https') {
$req->setAdapter($_conf['ssl_function']);

if($_conf['ssl_capath'])
{
$req->setConfig ('ssl_capath', $_conf['ssl_capath']);
if($_conf['ssl_capath'])
{
$req->setConfig ('ssl_capath', $_conf['ssl_capath']);
}
}

// プロキシ
Expand Down

0 comments on commit ca6328b

Please sign in to comment.