CVS update: php31/main
| From: | zeev | Date: | Fri, 21 Aug 1998 13:48:43 +0000 |
| Subject: | CVS update: php31/main | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-412@lists.php.net to get a copy of this message | ||
Date: Friday August 21, 1998 @ 9:48
Author: zeev
Update of /repository/php31/main
In directory asf:/tmp/cvs-serv26336/main
Modified Files:
Makefile.am fopen-wrappers.h main.c main.h
Added Files:
string_buffer.c string_buffer.h
Log Message:
Add the ability to buffer output:
* Removed all puts and putc implementations. Only the PUTC and PUTS macros should be used - they go
through
writeclient.
* Add buffering support
Right now, buffered_output is always turned off, and the buffered content isn't yet sent at
all. The
framework is there though.
Index: php31/main/Makefile.am
diff -c php31/main/Makefile.am:2.5 php31/main/Makefile.am:2.6
*** php31/main/Makefile.am:2.5 Thu Aug 20 17:50:30 1998
--- php31/main/Makefile.am Fri Aug 21 09:48:41 1998
***************
*** 41,47 ****
safe_mode.c debugger.c mime.c snprintf.c fopen-wrappers.c \
operators.c stack.c head.c php3_hash.c tls.c highlight.c \
php3_ini.c token_cache.c internal_functions.c php3_sprintf.c \
! variables.c post.c php3_realpath.c
configuration-parser.h: $(srcdir)/configuration-parser.y
bison -p cfg -v -d $< -o configuration-parser.c
--- 41,47 ----
safe_mode.c debugger.c mime.c snprintf.c fopen-wrappers.c \
operators.c stack.c head.c php3_hash.c tls.c highlight.c \
php3_ini.c token_cache.c internal_functions.c php3_sprintf.c \
! variables.c post.c php3_realpath.c string_buffer.c
configuration-parser.h: $(srcdir)/configuration-parser.y
bison -p cfg -v -d $< -o configuration-parser.c
Index: php31/main/fopen-wrappers.h
diff -c php31/main/fopen-wrappers.h:2.2 php31/main/fopen-wrappers.h:2.3
*** php31/main/fopen-wrappers.h:2.2 Fri Aug 14 19:57:41 1998
--- php31/main/fopen-wrappers.h Fri Aug 21 09:48:42 1998
***************
*** 26,32 ****
| Authors: Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
! /* $Id: fopen-wrappers.h,v 2.2 1998/08/14 23:57:41 steffann Exp $ */
#ifndef _FOPEN_WRAPPERS_H
#define _FOPEN_WRAPPERS_H
--- 26,32 ----
| Authors: Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
! /* $Id: fopen-wrappers.h,v 2.3 1998/08/21 13:48:42 zeev Exp $ */
#ifndef _FOPEN_WRAPPERS_H
#define _FOPEN_WRAPPERS_H
***************
*** 75,81 ****
extern PHPAPI int php3_isurl(char *path);
extern PHPAPI char *php3_strip_url_passwd(char *path);
- extern PHPAPI int php3_write(void *buf, int size);
extern PHPAPI char *expand_filepath(char *filepath);
extern PHPAPI int _php3_check_open_basedir(char *path);
--- 75,80 ----
Index: php31/main/main.c
diff -c php31/main/main.c:2.12 php31/main/main.c:2.13
*** php31/main/main.c:2.12 Thu Aug 20 23:48:56 1998
--- php31/main/main.c Fri Aug 21 09:48:42 1998
***************
*** 29,35 ****
+----------------------------------------------------------------------+
*/
! /* $Id: main.c,v 2.12 1998/08/21 03:48:56 zeev Exp $ */
/* #define CRASH_DETECTION */
--- 29,35 ----
+----------------------------------------------------------------------+
*/
! /* $Id: main.c,v 2.13 1998/08/21 13:48:42 zeev Exp $ */
/* #define CRASH_DETECTION */
***************
*** 162,170 ****
-
-
-
/* string destructor for hash */
static void str_free(void **ptr)
{
--- 162,167 ----
***************
*** 230,242 ****
/* is 4K big enough? */
#define PRINTF_BUFFER_SIZE 1024*4
/*wrapper for modules to use PHPWRITE */
PHPAPI int php3_write(void *buf, int size)
{
TLS_VARS;
! return GLOBAL(sapi_rqst)->writeclient(SAPI_GLOBAL_PASS buf,size);
}
PHPAPI int php3_printf(const char *format,...)
{
va_list args;
--- 227,267 ----
/* is 4K big enough? */
#define PRINTF_BUFFER_SIZE 1024*4
+
+ PHPAPI int php3_putc(char c)
+ {
+ return php3_write(&c, 1);
+ }
+
+ PHPAPI int php3_puts(char *buf)
+ {
+ return php3_write(buf, strlen(buf));
+ }
+
/*wrapper for modules to use PHPWRITE */
PHPAPI int php3_write(void *buf, int size)
{
TLS_VARS;
!
! if (GLOBAL(sapi_rqst)->buffered_output) {
! string_buffer_concat(&GLOBAL(sapi_rqst)->output_buffer, buf, size);
! return size;
! } else {
! return GLOBAL(sapi_rqst)->writeclient(SAPI_GLOBAL_PASS buf,size);
! }
!
}
+ int php3_sapi_writeclient(SAPI_GLOBAL_INCLUDE void *buf, int size)
+ {
+ if (GLOBAL(sapi_rqst)->buffered_output) {
+ string_buffer_concat(&GLOBAL(sapi_rqst)->output_buffer, buf, size);
+ return size;
+ } else {
+ return GLOBAL(sapi_rqst)->writeclient(SAPI_GLOBAL_PASS buf,size);
+ }
+ }
+
PHPAPI int php3_printf(const char *format,...)
{
va_list args;
***************
*** 1556,1562 ****
#if defined(CRASH_DETECTION)
debug_log("%d:main tls initialized\n",GetCurrentThreadId());
#endif
! if(!php3_globals){
/* uninitialized thread, initialize now */
_php3_sapi_thread_start(module_info);
PHP3_TLS_GET(TlsIndex,php3_globals);
--- 1581,1587 ----
#if defined(CRASH_DETECTION)
debug_log("%d:main tls initialized\n",GetCurrentThreadId());
#endif
! if (!php3_globals) {
/* uninitialized thread, initialize now */
_php3_sapi_thread_start(module_info);
PHP3_TLS_GET(TlsIndex,php3_globals);
***************
*** 1568,1574 ****
is (should be) initialized
*/
sapi_info->send_header(SAPI_GLOBAL_PASS_V);
! sapi_info->puts(SAPI_GLOBAL_PASS "IIS Internal Error: Thread could not
initialized!");
return SUCCESS;
}
}
--- 1593,1599 ----
is (should be) initialized
*/
sapi_info->send_header(SAPI_GLOBAL_PASS_V);
! php3_puts("IIS Internal Error: Thread could not initialized!");
return SUCCESS;
}
}
***************
*** 1578,1583 ****
--- 1603,1609 ----
GLOBAL(php3_preprocess) = sapi_info->preprocess;
GLOBAL(php3_display_source) = sapi_info->display_source_mode;
GLOBAL(sapi_rqst) = sapi_info;
+ GLOBAL(sapi_rqst)->buffered_output = 0;
#if defined(CRASH_DETECTION)
debug_log("%d:enter request startup\n",GetCurrentThreadId());
Index: php31/main/main.h
diff -c php31/main/main.h:2.3 php31/main/main.h:2.4
*** php31/main/main.h:2.3 Thu Aug 20 21:21:38 1998
--- php31/main/main.h Fri Aug 21 09:48:42 1998
***************
*** 29,35 ****
*/
! /* $Id: main.h,v 2.3 1998/08/21 01:21:38 zeev Exp $ */
#ifndef _MAIN_H
--- 29,35 ----
*/
! /* $Id: main.h,v 2.4 1998/08/21 13:48:42 zeev Exp $ */
#ifndef _MAIN_H
***************
*** 85,89 ****
--- 85,94 ----
extern int initialized;
extern unsigned char header_is_being_sent;
#endif
+
+ extern int php3_putc(char c);
+ extern int php3_puts(char *buf);
+ extern int php3_write(void *buf, int size);
+ extern int php3_sapi_writeclient(SAPI_GLOBAL_INCLUDE void *buf, int size);
#endif
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net