diff options
author | Jason Greene <jason@php.net> | 2000-11-29 01:22:49 +0000 |
---|---|---|
committer | Jason Greene <jason@php.net> | 2000-11-29 01:22:49 +0000 |
commit | d8bc7084ee15fa94a7bbbce3a8fc019ad9dcb2f1 (patch) | |
tree | 686c9b629f0d890a30858f374fbcb1c412d8db53 | |
parent | 2672602e30ffe66f8a56e20241e2dcdaf62f5cc0 (diff) | |
download | php-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");
-rw-r--r-- | main/SAPI.c | 6 |
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 */ } |