drupal_add_http_header

Versions
mediamosa-21
drupal_add_http_header($name, $value, $append = FALSE)

Set an HTTP response header for the current page.

Note: When sending a Content-Type header, always include a 'charset' type, too. This is necessary to avoid security bugs (e.g. UTF-7 XSS).

Parameters

$name The HTTP header name, or the special 'Status' header name.

$value The HTTP header value; if equal to FALSE, the specified header is unset. If $name is 'Status', this is expected to be a status code followed by a reason phrase, e.g. "404 Not Found".

$append Whether to append the value to an existing header or to replace it.

▾ 21 functions call drupal_add_http_header()

aggregator_test_feed in modules/aggregator/tests/aggregator_test.module
Page callback. Generates a test feed and simulates last-modified and etags.
ajax_deliver in includes/ajax.inc
Package and send the result of a page callback to the browser as an AJAX response.
authorize_access_denied_page in ./authorize.php
Render a 403 access denied page for authorize.php
drupal_deliver_html_page in includes/common.inc
Package and send the result of a page callback to the browser as HTML.
drupal_json_output in includes/common.inc
Return data in JSON format.
drupal_serve_page_from_cache in includes/bootstrap.inc
Set HTTP headers in preparation for a cached page response.
file_transfer in includes/file.inc
Transfer file using HTTP to client.
image_style_generate in modules/image/image.module
Menu callback; Given a style and image path, generate a derivative.
node_feed in modules/node/node.module
A generic function for generating RSS feeds from a set of nodes.
openid_test_yadis_xrds in modules/openid/tests/openid_test.module
Menu callback; XRDS document that references the OP Endpoint URL.
openid_test_yadis_x_xrds_location in modules/openid/tests/openid_test.module
Menu callback; regular HTML page with an X-XRDS-Location HTTP header.
system_test_set_header in modules/simpletest/tests/system_test.module
theme_aggregator_page_opml in modules/aggregator/aggregator.pages.inc
Theme the OPML feed output.
theme_aggregator_page_rss in modules/aggregator/aggregator.pages.inc
Theme the RSS output.
theme_install_page in includes/theme.maintenance.inc
Generate a themed installation page.
theme_update_page in includes/theme.maintenance.inc
Generate a themed update page.
update_access_denied_page in ./update.php
xmlrpc_server_output in includes/xmlrpcs.inc
_drupal_log_error in includes/errors.inc
Log a PHP error or exception, display an error page in fatal cases.
_openid_test_endpoint_associate in modules/openid/tests/openid_test.module
OpenID endpoint; handle "associate" requests (see OpenID Authentication 2.0, section 8).
_openid_test_endpoint_authenticate in modules/openid/tests/openid_test.module
OpenID endpoint; handle "authenticate" requests.

Code

includes/bootstrap.inc, line 926

<?php
function drupal_add_http_header($name, $value, $append = FALSE) {
  // The headers as name/value pairs.
  $headers = &drupal_static('drupal_http_headers', array());

  $name_lower = strtolower($name);
  _drupal_set_preferred_header_name($name);

  if ($value === FALSE) {
    $headers[$name_lower] = FALSE;
  }
  elseif (isset($headers[$name_lower]) && $append) {
    // Multiple headers with identical names may be combined using comma (RFC
    // 2616, section 4.2).
    $headers[$name_lower] .= ',' . $value;
  }
  else {
    $headers[$name_lower] = $value;
  }
  drupal_send_headers(array($name => $headers[$name_lower]), TRUE);
}
?>