You are here

protected function SearchApiAcquiaSearchHttpTransport::performHttpRequest in Acquia Search for Search API 7

Overrides SearchApiSolrHttpTransport::performHttpRequest().

Adds the data to the query string required for HMAC authentication, executes the search query.

File

includes/SearchApiAcquiaSearchHttpTransport.php, line 209
Contains SearchApiAcquiaSearchHttpTransport.

Class

SearchApiAcquiaSearchHttpTransport
HTTP transport for connections to the Acquia Search Service.

Code

protected function performHttpRequest($method, $url, $timeout, $rawPost = NULL, $contentType = NULL) {
  $options = array(
    'method' => $method,
    'timeout' => $timeout && $timeout > 0 ? $timeout : $this
      ->getDefaultTimeout(),
    'headers' => array(),
  );
  if ($this->http_auth) {
    $options['headers']['Authorization'] = $this->http_auth;
  }
  if ($timeout) {
    $options['timeout'] = $timeout;
  }
  if ($rawPost) {
    $options['data'] = $rawPost;
  }
  if ($contentType) {
    $options['headers']['Content-Type'] = $contentType;
  }
  $nonce = $this
    ->prepareRequest($url, $options);
  $response = drupal_http_request($url, $options);
  $type = isset($response->headers['content-type']) ? $response->headers['content-type'] : 'text/xml';
  $body = isset($response->data) ? $response->data : NULL;
  return new Apache_Solr_HttpTransport_Response($response->code, $type, $body);
}