diff options
author | Steven Wittens <steven@10.no-reply.drupal.org> | 2006-11-30 08:13:31 +0000 |
---|---|---|
committer | Steven Wittens <steven@10.no-reply.drupal.org> | 2006-11-30 08:13:31 +0000 |
commit | 1c7f089dea266a8555da539b6924d566cfd2c0e9 (patch) | |
tree | 65eb175121f56a082bc5b77487986f6f2be364f4 | |
parent | a0b5a225d353e5fb1e6ac53c1bf553424291a372 (diff) | |
download | brdo-1c7f089dea266a8555da539b6924d566cfd2c0e9.tar.gz brdo-1c7f089dea266a8555da539b6924d566cfd2c0e9.tar.bz2 |
#75803: Allow other HTTP status codes in drupal_goto()
-rw-r--r-- | includes/common.inc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/includes/common.inc b/includes/common.inc index 6724e2b5b..c5eca4a2b 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -282,10 +282,20 @@ function drupal_get_destination() { * The query string component, if any. * @param $fragment * The destination fragment identifier (named anchor). - * + * @param $http_response_code + * Valid values for an actual "goto" as per RFC 2616 section 10.3 are: + * - 301 Moved Permanently (the recommended value for most redirects) + * - 302 Found (default in Drupal and PHP, sometimes used for spamming search + * engines) + * - 303 See Other + * - 304 Not Modified + * - 305 Use Proxy + * - 307 Temporary Redirect (an alternative to "503 Site Down for Maintenance") + * Note: Other values are defined by RFC 2616, but are rarely used and poorly + * supported. * @see drupal_get_destination() */ -function drupal_goto($path = '', $query = NULL, $fragment = NULL) { +function drupal_goto($path = '', $query = NULL, $fragment = NULL, $http_response_code = 302) { if (isset($_REQUEST['destination'])) { extract(parse_url(urldecode($_REQUEST['destination']))); } @@ -298,7 +308,7 @@ function drupal_goto($path = '', $query = NULL, $fragment = NULL) { // Before the redirect, allow modules to react to the end of the page request. module_invoke_all('exit', $url); - header('Location: '. $url); + header('Location: '. $url, TRUE, $http_response_code); // The "Location" header sends a REDIRECT status code to the http // daemon. In some cases this can go wrong, so we make sure none |