summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>2002-07-03 10:42:31 +0000
committerSascha Schumann <sas@php.net>2002-07-03 10:42:31 +0000
commit9c876ea01ad806ae6e345c5dc0cf252c0ebe8864 (patch)
tree60c5f992ca4a366896c4166747336f79ca7e9164 /sapi
parentc73733c59acef49b86af5996cb0ec12b970a7759 (diff)
downloadphp-git-9c876ea01ad806ae6e345c5dc0cf252c0ebe8864.tar.gz
Add sapi_header_op interface which supersedes the sapi_add_header and _ex
calls. Revert the change to the sapi_add_header_ex interface. Fix various bugs: 1. header("HTTP/1.0 306 foo"); header("Location: absolute-uri"); did not work in combination with several SAPI modules, because http_status_line was never properly reset. And thus, all SAPI modules which looked at http_status_line ignored the changed http_response_code. 2. The CGI SAPI did not send out the HTTP status line at all, if http_status_line had not been set explicitly by calling header("HTTP/1.0 200 foo");
Diffstat (limited to 'sapi')
-rw-r--r--sapi/pi3web/pi3web_sapi.c12
-rw-r--r--sapi/tux/php_tux.c8
-rw-r--r--sapi/webjames/webjames.c18
3 files changed, 14 insertions, 24 deletions
diff --git a/sapi/pi3web/pi3web_sapi.c b/sapi/pi3web/pi3web_sapi.c
index a7176a1b2a..83fe5fdef7 100644
--- a/sapi/pi3web/pi3web_sapi.c
+++ b/sapi/pi3web/pi3web_sapi.c
@@ -422,9 +422,14 @@ DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB)
};
};
break;
- case PHP_MODE_INDENT:
- header_line = (char *)estrdup("Content-Type: text/plain");
- sapi_add_header_ex(header_line, strlen(header_line), 1, 1, 0 TSRMLS_CC);
+ case PHP_MODE_INDENT: {
+ sapi_header_line ctr = {0};
+
+ ctr.line = "Content-Type: text/plain";
+ ctr.line_len = strlen(ctr.line);
+
+ sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
+ }
if ( open_file_for_scanning( &file_handle TSRMLS_CC ) == SUCCESS )
{
zend_indent();
@@ -433,7 +438,6 @@ DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB)
{
iRet = PIAPI_ERROR;
};
- efree(header_line);
break;
case PHP_MODE_LINT:
iRet = (php_lint_script(&file_handle TSRMLS_CC) == SUCCESS) ?
diff --git a/sapi/tux/php_tux.c b/sapi/tux/php_tux.c
index d2da64882a..4f0b6e17db 100644
--- a/sapi/tux/php_tux.c
+++ b/sapi/tux/php_tux.c
@@ -192,10 +192,12 @@ static void sapi_tux_register_variables(zval *track_vars_array TSRMLS_DC)
{
char buf[BUF_SIZE + 1];
char *p;
-
+ sapi_header_line ctr = {0};
+
+ ctr.line = buf;
+ ctr.line_len = sprintf(buf, "Server: %s", TUXAPI_version);
+ sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
- sprintf(buf, "Server: %s", TUXAPI_version);
- sapi_add_header_ex(buf, strlen(buf), 1, 0, 0 TSRMLS_CC);
php_register_variable("PHP_SELF", SG(request_info).request_uri, track_vars_array TSRMLS_CC);
php_register_variable("SERVER_SOFTWARE", TUXAPI_version, track_vars_array TSRMLS_CC);
php_register_variable("GATEWAY_INTERFACE", "CGI/1.1", track_vars_array TSRMLS_CC);
diff --git a/sapi/webjames/webjames.c b/sapi/webjames/webjames.c
index 1aba413dee..3bea3457e4 100644
--- a/sapi/webjames/webjames.c
+++ b/sapi/webjames/webjames.c
@@ -54,22 +54,6 @@ static int sapi_webjames_ub_write(const char *str, uint str_length TSRMLS_DC)
return bytes;
}
-static int sapi_webjames_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
-/*send the HTTP response line*/
-{
- char buf[256];
-
- if (WG(conn)->flags.outputheaders) {
- if (!SG(sapi_headers).http_status_line) {
- int code=SG(sapi_headers).http_response_code;
- snprintf(buf, 255, "HTTP/1.0 %d %s\r\n", code, code==200 ? "OK" : code==302 ? "Moved temporarily" : "Something");
- webjames_writestring(WG(conn), buf);
- }
- }
-
- return SAPI_HEADER_DO_SEND;
-}
-
static void sapi_webjames_send_header(sapi_header_struct *sapi_header, void *server_context TSRMLS_DC)
/*send an HTTP header*/
{
@@ -286,7 +270,7 @@ static sapi_module_struct sapi_module = {
php_error, /* error handler */
NULL, /* header handler */
- sapi_webjames_send_headers, /* send headers handler */
+ NULL, /* send headers handler */
sapi_webjames_send_header, /* send header handler */
sapi_webjames_read_post, /* read POST data */
sapi_webjames_read_cookies, /* read Cookies */