summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorJason Greene <jason@php.net>2000-11-29 01:22:49 +0000
committerJason Greene <jason@php.net>2000-11-29 01:22:49 +0000
commitd8bc7084ee15fa94a7bbbce3a8fc019ad9dcb2f1 (patch)
tree686c9b629f0d890a30858f374fbcb1c412d8db53 /main
parent2672602e30ffe66f8a56e20241e2dcdaf62f5cc0 (diff)
downloadphp-git-d8bc7084ee15fa94a7bbbce3a8fc019ad9dcb2f1.tar.gz
Added the capability to specify a different HTTP Redirection response code
before the Location Header. Ex. header("HTTP/1.1 307 Temporary Redirect"); header("Location: URL");
Diffstat (limited to 'main')
-rw-r--r--main/SAPI.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/main/SAPI.c b/main/SAPI.c
index 67bd8019de..eba50440dd 100644
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -426,7 +426,11 @@ SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bo
efree(mimetype);
SG(sapi_headers).send_default_content_type = 0;
} else if (!STRCASECMP(header_line, "Location")) {
- SG(sapi_headers).http_response_code = 302; /* redirect */
+ if (SG(sapi_headers).http_response_code < 300 ||
+ SG(sapi_headers).http_response_code > 307) {
+ /* Return a Found Redirect if one is not already specified */
+ SG(sapi_headers).http_response_code = 302;
+ }
} else if (!STRCASECMP(header_line, "WWW-Authenticate")) { /* HTTP Authentication */
SG(sapi_headers).http_response_code = 401; /* authentication-required */
}