summaryrefslogtreecommitdiff
path: root/main/SAPI.c
diff options
context:
space:
mode:
authorDerick Rethans <derick@php.net>2002-06-21 09:31:21 +0000
committerDerick Rethans <derick@php.net>2002-06-21 09:31:21 +0000
commit6869cb3f5a907500d9553c978fc491748585d9db (patch)
treea40530b71f58a94b359254c223d380c2ffb7f2be /main/SAPI.c
parent0f4ccfaa27a52b916a78fedae167aaa03808b372 (diff)
downloadphp-git-6869cb3f5a907500d9553c978fc491748585d9db.tar.gz
- Added a new parameter to the header() function which overrides the HTTP
response code. @- Added a new parameter to the header() function which overrides the HTTP @ response code. (Derick)
Diffstat (limited to 'main/SAPI.c')
-rw-r--r--main/SAPI.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/main/SAPI.c b/main/SAPI.c
index 0c6d2fe21e..0077e277fa 100644
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -393,7 +393,7 @@ static int sapi_find_matching_header(void *element1, void *element2)
/* This function expects a *duplicated* string, that was previously emalloc()'d.
* Pointers sent to this functions will be automatically freed by the framework.
*/
-SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace TSRMLS_DC)
+SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace, int http_response_code TSRMLS_DC)
{
int retval;
sapi_header_struct sapi_header;
@@ -462,11 +462,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")) {
- 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 */
+ 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 */
int newlen;
char *result, *newheader;
@@ -547,6 +547,9 @@ SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bo
}
}
+ if (http_response_code) {
+ SG(sapi_headers).http_response_code = http_response_code;
+ }
if (sapi_module.header_handler) {
retval = sapi_module.header_handler(&sapi_header, &SG(sapi_headers) TSRMLS_CC);
} else {