You are here

function drupal_set_header in Drupal 5

Same name and namespace in other branches
  1. 4 includes/common.inc \drupal_set_header()
  2. 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).

15 calls to drupal_set_header()
aggregator_page_opml in modules/aggregator/aggregator.module
Menu callback; generates an OPML representation of all feeds.
aggregator_page_rss in modules/aggregator/aggregator.module
Menu callback; generate an RSS 0.92 feed of aggregator items or categories.
blogapi_rsd in modules/blogapi/blogapi.module
db_connect in includes/database.mysqli.inc
Initialise a database connection.
db_connect in includes/database.mysql.inc
Initialize a database connection.

... See full list

File

includes/common.inc, line 133
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);
}