drupal_set_header

Versions
4.6 – 6
drupal_set_header($header = NULL)

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).

▾ 11 functions call drupal_set_header()

aggregator_page_opml in modules/aggregator.module
Menu callback; generates an OPML representation of all feeds.
aggregator_page_rss in modules/aggregator.module
Menu callback; generate an RSS 0.92 feed of aggregator items or categories.
blogapi_rsd in modules/blogapi.module
db_connect in includes/database.pgsql.inc
Initialize a database connection.
drupal_access_denied in includes/common.inc
Generates a 403 error if the request is not allowed.
drupal_get_headers in includes/common.inc
Get the HTTP response headers for the current page.
drupal_not_found in includes/common.inc
Generates a 404 error if the request can not be handled.
drupal_site_offline in includes/common.inc
Generates a site off-line message
node_feed in modules/node.module
A generic function for generating RSS feeds from a set of nodes.
theme_maintenance_page in includes/theme.inc
_drupal_bootstrap_full in includes/common.inc

Code

includes/common.inc, line 134

<?php
function drupal_set_header($header = NULL) {
  // We use an array to guarantee there are no leading or trailing delimiters.
  // Otherwise, header('') could get called when serving the page later, which
  // ends HTTP headers prematurely on some PHP versions.
  static $stored_headers = array();

  if (strlen($header)) {
    header($header);
    $stored_headers[] = $header;
  }
  return implode("\n", $stored_headers);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.