You are here

function acquia_search_extract_hmac in Acquia Connector 7.3

Same name and namespace in other branches
  1. 7 acquia_search/acquia_search.module \acquia_search_extract_hmac()
  2. 7.2 acquia_search/acquia_search.module \acquia_search_extract_hmac()

Look in the headers and get the hmac_digest out.

Return value

string Hmac_digest.

2 calls to acquia_search_extract_hmac()
AcquiaSearchService::authenticateResponse in acquia_search/Acquia_Search_Service.php
Validate the hmac for the response body.
AcquiaSearchUnitTestCase::testExtractHmacHeader in acquia_search/tests/acquia_search.test
Tests extracting the hmac digest from the response header.

File

acquia_search/acquia_search.module, line 908
Integration between Acquia Drupal and Acquia's hosted solr search service.

Code

function acquia_search_extract_hmac($headers) {
  $reg = array();
  if (is_array($headers)) {
    foreach ($headers as $name => $value) {
      if (strtolower($name) == 'pragma' && preg_match("/hmac_digest=([^;]+);/i", $value, $reg)) {
        return trim($reg[1]);
      }
    }
  }
  return '';
}