protected function AcquiaSearchService::prepareRequest in Acquia Search 6.3
Modify the url and add headers appropriate to authenticate to Acquia Search.
Return value
The nonce used in the request.
3 calls to AcquiaSearchService::prepareRequest()
- AcquiaSearchService::makeServletRequest in ./
Acquia_Search_Service.php - Make a request to a servlet (a path) that's not a standard path.
- AcquiaSearchService::_sendRawGet in ./
Acquia_Search_Service.php - Central method for making a GET operation against this Solr Server
- AcquiaSearchService::_sendRawPost in ./
Acquia_Search_Service.php - Central method for making a POST operation against this Solr Server
File
- ./
Acquia_Search_Service.php, line 29
Class
Code
protected function prepareRequest(&$url, &$options, $use_data = TRUE) {
module_load_include('inc', 'acquia_agent', 'acquia_agent_streams');
$id = uniqid();
if (!stristr($url, '?')) {
$url .= "?";
}
else {
$url .= "&";
}
$url .= 'request_id=' . $id;
if ($use_data && isset($options['data'])) {
list($cookie, $nonce) = acquia_search_auth_cookie($url, $options['data'], NULL, $this->env_id);
}
else {
list($cookie, $nonce) = acquia_search_auth_cookie($url, NULL, NULL, $this->env_id);
}
if (empty($cookie)) {
throw new Exception('Invalid authentication string - subscription keys expired or missing.');
}
$options['headers']['Cookie'] = $cookie;
$options['headers'] += array(
'User-Agent' => 'acquia_search/' . variable_get('acquia_search_version', '6.x-3.x'),
);
$options['context'] = acquia_agent_stream_context_create($url, 'acquia_search');
if (!$options['context']) {
throw new Exception(t("Could not create stream context"));
}
return $nonce;
}