7.x bootstrap.inc drupal_get_http_header($name = NULL)

Gets the HTTP response headers for the current page.

Parameters

$name: An HTTP header name. If omitted, all headers are returned as name/value pairs. If an array value is FALSE, the header has been unset.

Return value

A string containing the header value, or FALSE if the header has been set, or NULL if the header has not been set.

5 calls to drupal_get_http_header()
ajax_deliver in includes/ajax.inc
Packages and sends the result of a page callback as an Ajax response.
drupal_deliver_html_page in includes/common.inc
Packages and sends the result of a page callback to the browser as HTML.
drupal_page_set_cache in includes/common.inc
Stores the current page in the cache.
drupal_send_headers in includes/bootstrap.inc
Sends the HTTP response headers that were previously set, adding defaults.
drupal_serve_page_from_cache in includes/bootstrap.inc
Sets HTTP headers in preparation for a cached page response.

File

includes/bootstrap.inc, line 1430
Functions that need to be loaded on every Drupal request.

Code

function drupal_get_http_header($name = NULL) {
  $headers = &drupal_static('drupal_http_headers', array());
  if (isset($name)) {
    $name = strtolower($name);
    return isset($headers[$name]) ? $headers[$name] : NULL;
  }
  else {
    return $headers;
  }
}