function drupal_set_header
6.x common.inc | 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).
14 calls to drupal_set_header()
- blogapi_rsd in drupal-6.x/
modules/ blogapi/ blogapi.module - drupal_access_denied in drupal-6.x/
includes/ common.inc - Generates a 403 error if the request is not allowed.
- drupal_get_headers in drupal-6.x/
includes/ common.inc - Get the HTTP response headers for the current page.
- drupal_json in drupal-6.x/
includes/ common.inc - Return data in JSON format.
- drupal_not_found in drupal-6.x/
includes/ common.inc - Generates a 404 error if the request can not be handled.
File
- drupal-6.x/
includes/ common.inc, line 146 - 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);
}