function drupal_set_header in Drupal 4
Same name and namespace in other branches
- 5 includes/common.inc \drupal_set_header()
- 6 includes/common.inc \drupal_set_header()
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).
13 calls to 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.mysqli.inc - Initialise a database connection.
- db_connect in includes/
database.mysql.inc - Initialize a database connection.
File
- includes/
common.inc, line 134 - Common functions that many Drupal modules will need to reference.
Code
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);
}