diff options
author | Will Norris <will@willnorris.com> | 2012-01-02 13:48:24 -0800 |
---|---|---|
committer | Will Norris <will@willnorris.com> | 2012-01-02 13:48:24 -0800 |
commit | 76d048fcab3584b3ec0224ec304437eb96e1486d (patch) | |
tree | 6490da4e3d89d1e0802d67abb35f1d4a3e50845e /Auth | |
parent | fc221515153696460438e1a6a343b7f500a6e578 (diff) | |
download | php-openid-76d048fcab3584b3ec0224ec304437eb96e1486d.zip php-openid-76d048fcab3584b3ec0224ec304437eb96e1486d.tar.gz php-openid-76d048fcab3584b3ec0224ec304437eb96e1486d.tar.bz2 |
restructure Auth_OpenID_VERIFY_HOST logic
make it a little more readable and obvious what we're doing here
Diffstat (limited to 'Auth')
-rw-r--r-- | Auth/Yadis/ParanoidHTTPFetcher.php | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/Auth/Yadis/ParanoidHTTPFetcher.php b/Auth/Yadis/ParanoidHTTPFetcher.php index 28406b5..4005042 100644 --- a/Auth/Yadis/ParanoidHTTPFetcher.php +++ b/Auth/Yadis/ParanoidHTTPFetcher.php @@ -128,19 +128,17 @@ class Auth_Yadis_ParanoidHTTPFetcher extends Auth_Yadis_HTTPFetcher { curl_setopt($c, CURLOPT_TIMEOUT, $off); curl_setopt($c, CURLOPT_URL, $url); - if (defined('Auth_OpenID_VERIFY_HOST') && - Auth_OpenID_VERIFY_HOST == false) { - curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false); - } elseif (defined('Auth_OpenID_VERIFY_HOST')) { - /* These are actually the default options - * So by setting Auth_OpenID_VERIFY_HOST as false - * you disable the option, and if you set it to - * true, you will overide any custom settings - * that may be set in your distribution of PHP. - */ - curl_setopt($c, CURLOPT_SSL_VERIFYPEER, true); - curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 2); + if (defined('Auth_OpenID_VERIFY_HOST')) { + // set SSL verification options only if Auth_OpenID_VERIFY_HOST + // is explicitly set, otherwise use system default. + if (Auth_OpenID_VERIFY_HOST) { + curl_setopt($c, CURLOPT_SSL_VERIFYPEER, true); + curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 2); + } else { + curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false); + } } + curl_exec($c); $code = curl_getinfo($c, CURLINFO_HTTP_CODE); @@ -211,18 +209,15 @@ class Auth_Yadis_ParanoidHTTPFetcher extends Auth_Yadis_HTTPFetcher { curl_setopt($c, CURLOPT_WRITEFUNCTION, array($this, "_writeData")); - if (defined('Auth_OpenID_VERIFY_HOST') && - Auth_OpenID_VERIFY_HOST == false) { - curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false); - } elseif (defined('Auth_OpenID_VERIFY_HOST')) { - /* These are actually the default options - * So by setting Auth_OpenID_VERIFY_HOST as false - * you disable the option, and if you set it to - * true, you will overide any custom settings - * that may be set in your distribution of PHP. - */ - curl_setopt($c, CURLOPT_SSL_VERIFYPEER, true); - curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 2); + if (defined('Auth_OpenID_VERIFY_HOST')) { + // set SSL verification options only if Auth_OpenID_VERIFY_HOST + // is explicitly set, otherwise use system default. + if (Auth_OpenID_VERIFY_HOST) { + curl_setopt($c, CURLOPT_SSL_VERIFYPEER, true); + curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 2); + } else { + curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false); + } } curl_exec($c); |