[PHP4BETA] CVS update: php4

From: Date: Wed, 05 May 1999 19:53:16 +0000
Subject: [PHP4BETA] CVS update: php4
Groups: php.version4 
Request: Send a blank email to php-version4+get-656@lists.php.net to get a copy of this message
Date: Wednesday May 5, 1999 @ 15:53 Author: zeev Update of /repository/php4 In directory php:/tmp/cvs-serv24598 Modified Files: SAPI.c SAPI.h main.c output.c Log Message: ISAPI WORKS! Index: php4/SAPI.c diff -u php4/SAPI.c:1.5 php4/SAPI.c:1.6 --- php4/SAPI.c:1.5 Wed May 5 14:25:20 1999 +++ php4/SAPI.c Wed May 5 15:53:15 1999 @@ -41,6 +41,7 @@ zend_llist_init(&SG(sapi_headers).headers, sizeof(sapi_header_struct), (void (*)(void *)) sapi_free_header, 0); SG(sapi_headers).content_type.header = NULL; SG(sapi_headers).http_response_code = 200; + SG(headers_sent) = 0; } @@ -62,7 +63,11 @@ sapi_header.header = (char *) header_line; sapi_header.header_len = header_line_len; - retval = sapi_module.header_handler(&sapi_header, &SG(sapi_headers)); + if (sapi_module.header_handler) { + retval = sapi_module.header_handler(&sapi_header, &SG(sapi_headers)); + } else { + retval = SAPI_HEADER_ADD; + } if (retval & SAPI_HEADER_DELETE_ALL) { zend_llist_clean(&SG(sapi_headers).headers); @@ -91,14 +96,27 @@ SAPI_API int sapi_send_headers() { + int retval; SLS_FETCH(); + + if (SG(headers_sent)) { + return SUCCESS; + } + + if (sapi_module.send_headers) { + retval = sapi_module.send_headers(&SG(sapi_headers) SLS_CC); + } else { + retval = SAPI_HEADER_DO_SEND; + } - switch (sapi_module.send_headers(&SG(sapi_headers) SLS_CC)) { + switch (retval) { case SAPI_HEADER_SENT_SUCCESSFULLY: + SG(headers_sent) = 1; return SUCCESS; break; case SAPI_HEADER_DO_SEND: zend_llist_apply_with_argument(&SG(sapi_headers).headers, (void (*)(void *, void *)) sapi_module.send_header, SG(server_context)); + SG(headers_sent) = 1; return SUCCESS; break; case SAPI_HEADER_SEND_FAILED: Index: php4/SAPI.h diff -u php4/SAPI.h:1.5 php4/SAPI.h:1.6 --- php4/SAPI.h:1.5 Wed May 5 14:25:20 1999 +++ php4/SAPI.h Wed May 5 15:53:15 1999 @@ -49,6 +49,7 @@ void *server_context; sapi_request_info request_info; sapi_headers_struct sapi_headers; + unsigned char headers_sent; } sapi_globals_struct; Index: php4/main.c diff -u php4/main.c:1.44 php4/main.c:1.45 --- php4/main.c:1.44 Wed May 5 14:25:20 1999 +++ php4/main.c Wed May 5 15:53:15 1999 @@ -29,7 +29,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.44 1999/05/05 18:25:20 andi Exp $ */ +/* $Id: main.c,v 1.45 1999/05/05 19:53:15 zeev Exp $ */ #include <stdio.h> @@ -1126,14 +1126,14 @@ if (!strcmp(SG(request_info).query_string+1, "PHPE9568F34-D428-11d2-A769-00AA001ACF42")) { char *header_line = estrndup(CONTEXT_TYPE_IMAGE_GIF, sizeof(CONTEXT_TYPE_IMAGE_GIF)); - php4i_add_header_information(header_line, sizeof(CONTEXT_TYPE_IMAGE_GIF)); + php4i_add_header_information(header_line, sizeof(CONTEXT_TYPE_IMAGE_GIF)-1); PHPWRITE(php4_logo, sizeof(php4_logo)); efree(header_line); return; } else if (!strcmp(SG(request_info).query_string+1, "PHPE9568F35-D428-11d2-A769-00AA001ACF42")) { char *header_line = estrndup(CONTEXT_TYPE_IMAGE_GIF, sizeof(CONTEXT_TYPE_IMAGE_GIF)); - php4i_add_header_information(header_line, sizeof(CONTEXT_TYPE_IMAGE_GIF)); + php4i_add_header_information(header_line, sizeof(CONTEXT_TYPE_IMAGE_GIF)-1); PHPWRITE(zendtech_logo, sizeof(zendtech_logo)); efree(header_line); return; Index: php4/output.c diff -u php4/output.c:1.7 php4/output.c:1.8 --- php4/output.c:1.7 Wed May 5 14:25:20 1999 +++ php4/output.c Wed May 5 15:53:15 1999 @@ -22,6 +22,7 @@ int (*zend_body_write)(const char *str, uint str_length); /* string output */ int (*zend_header_write)(const char *str, uint str_length); /* unbuffer string output */ static int zend_ub_body_write(const char *str, uint str_length); +static int zend_ub_body_write_no_header(const char *str, uint str_length); static int zend_b_body_write(const char *str, uint str_length); /* output buffering */ @@ -57,10 +58,16 @@ void zend_end_ob_buffering(int send_buffer) { + SLS_FETCH(); + if (!ob_buffer) { return; } - zend_body_write = zend_ub_body_write; + if (SG(headers_sent)) { + zend_body_write = zend_ub_body_write_no_header; + } else { + zend_body_write = zend_ub_body_write; + } if (send_buffer) { zend_ob_send(); } @@ -166,6 +173,12 @@ } +static int zend_ub_body_write_no_header(const char *str, uint str_length) +{ + return zend_header_write(str, str_length); +} + + static int zend_ub_body_write(const char *str, uint str_length) { SLS_FETCH(); @@ -174,6 +187,7 @@ zend_bailout(); } if (php3_header()) { + zend_body_write = zend_ub_body_write_no_header; return zend_header_write(str, str_length); } else { return 0; -- PHP 4 Beta

« previous php.version4 (#656) next »