Merge pull request #12571 from civicrm/5.4
[civicrm-core.git] / CRM / Cxn / CiviCxnHttp.php
index d1b5e7f48b15a04e485dc7e90c7722081a8f4d84..0d6024812cc0c40441ab0acd4a49dd157eedf06c 100644 (file)
@@ -54,7 +54,7 @@ class CRM_Cxn_CiviCxnHttp extends \Civi\Cxn\Rpc\Http\PhpHttp {
     $lowVerb = strtolower($verb);
 
     if ($lowVerb === 'get' && $this->cache) {
-      $cachePath = 'get/' . md5($url);
+      $cachePath = 'get_' . md5($url);
       $cacheLine = $this->cache->get($cachePath);
       if ($cacheLine && $cacheLine['expires'] > CRM_Utils_Time::getTimeRaw()) {
         return $cacheLine['data'];
@@ -66,7 +66,7 @@ class CRM_Cxn_CiviCxnHttp extends \Civi\Cxn\Rpc\Http\PhpHttp {
     if ($lowVerb === 'get' && $this->cache) {
       $expires = CRM_Utils_Http::parseExpiration($result[0]);
       if ($expires !== NULL) {
-        $cachePath = 'get/' . md5($url);
+        $cachePath = 'get_' . md5($url);
         $cacheLine = array(
           'url' => $url,
           'expires' => $expires,
@@ -79,11 +79,22 @@ class CRM_Cxn_CiviCxnHttp extends \Civi\Cxn\Rpc\Http\PhpHttp {
     return $result;
   }
 
+  /**
+   * Create stream options.
+   *
+   * @param string $verb
+   * @param string $url
+   * @param string $blob
+   * @param array $headers
+   *
+   * @return array
+   * @throws \Exception
+   */
   protected function createStreamOpts($verb, $url, $blob, $headers) {
     $result = parent::createStreamOpts($verb, $url, $blob, $headers);
 
     $caConfig = CA_Config_Stream::probe(array(
-      'verify_peer' => (bool) CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL'),
+      'verify_peer' => (bool) Civi::settings()->get('verifySSL'),
     ));
     if ($caConfig->isEnableSSL()) {
       $result['ssl'] = $caConfig->toStreamOptions();
@@ -95,4 +106,11 @@ class CRM_Cxn_CiviCxnHttp extends \Civi\Cxn\Rpc\Http\PhpHttp {
     return $result;
   }
 
+  /**
+   * @return \CRM_Utils_Cache_Interface|null
+   */
+  public function getCache() {
+    return $this->cache;
+  }
+
 }