CVS update: php31/sapi

From: Date: Fri, 21 Aug 1998 21:00:47 +0000
Subject: CVS update: php31/sapi
Groups: php.dev 
Request: Send a blank email to php-dev+get-448@lists.php.net to get a copy of this message
Date: Friday August 21, 1998 @ 17:00 Author: shane Update of /repository/php31/sapi In directory asf:/tmp/cvs-serv3295/sapi Modified Files: apache_sapi.c cgi_sapi.c isapi_sapi.c sapi.h Log Message: Implement testing to see if the client is still alive. For now, doesnt do anything other than skiping any attempt to send further info to the client. Index: php31/sapi/apache_sapi.c diff -c php31/sapi/apache_sapi.c:2.6 php31/sapi/apache_sapi.c:2.7 *** php31/sapi/apache_sapi.c:2.6 Fri Aug 21 12:41:06 1998 --- php31/sapi/apache_sapi.c Fri Aug 21 17:00:46 1998 *************** *** 590,596 **** sapi_info->page_uid = php3_rqst->finfo.st_uid; sapi_info->page_inode = php3_rqst->finfo.st_ino; sapi_info->page_mtime = php3_rqst->finfo.st_mtime; - sapi_info->aborted = sapi_aborted; return sapi_info; } --- 590,595 ---- Index: php31/sapi/cgi_sapi.c diff -c php31/sapi/cgi_sapi.c:2.14 php31/sapi/cgi_sapi.c:2.15 *** php31/sapi/cgi_sapi.c:2.14 Fri Aug 21 13:16:59 1998 --- php31/sapi/cgi_sapi.c Fri Aug 21 17:00:46 1998 *************** *** 79,103 **** int sapi_insert_header(SAPI_GLOBAL_INCLUDE unsigned char *header) { fputs(header, stdout); ! if (fputs("\015\012", stdout) < 0) { ! sapi_info->abort = 1; ! #if MSVC5 ! OutputDebugString("insert header failed\n"); ! #endif ! } ! return SUCCESS; } int sapi_send_header(SAPI_GLOBAL_INCLUDE_V) { ! if (fputs("\015\012", stdout) < 0) { ! sapi_info->abort = 1; ! #if MSVC5 ! OutputDebugString("send header failed\n"); ! #endif ! } ! return SUCCESS; } --- 79,91 ---- int sapi_insert_header(SAPI_GLOBAL_INCLUDE unsigned char *header) { fputs(header, stdout); ! return fputs("\015\012", stdout); } int sapi_send_header(SAPI_GLOBAL_INCLUDE_V) { ! return fputs("\015\012", stdout); } *************** *** 107,132 **** } - int sapi_putc(SAPI_GLOBAL_INCLUDE unsigned char c) - { - if (putc(c, stdout) < 0) { - sapi_info->abort = 1; - #if MSVC5 - OutputDebugString("putc failed\n"); - #endif - } - return SUCCESS; - } - - int sapi_writeclient(SAPI_GLOBAL_INCLUDE unsigned char *string, int len) { ! if (fwrite(string,len,1,stdout)<(unsigned int)1) { ! #if MSVC5 ! OutputDebugString("write client (fwrite) failed\n"); ! #endif ! } ! return SUCCESS; } --- 95,105 ---- } int sapi_writeclient(SAPI_GLOBAL_INCLUDE unsigned char *string, int len) { ! if(fwrite(string,len,1,stdout)) ! return len; ! return 0; } *************** *** 166,176 **** } - int sapi_aborted(SAPI_GLOBAL_INCLUDE_V) - { - return sapi_info->abort; - } - #if defined(CRASH_DETECTION) /* Crash detection logging */ void sapi_debug_log(SAPI_GLOBAL_INCLUDE char *message) --- 139,144 ---- *************** *** 247,254 **** sapi_info->content_type = getenv("CONTENT_TYPE"); sapi_info->cookies = getenv("HTTP_COOKIE"); - sapi_info->aborted = 0; - sapi_info->getenv = sapi_getenv; sapi_info->writeclient = sapi_writeclient; sapi_info->flush = sapi_flush; --- 215,220 ---- *************** *** 260,267 **** sapi_info->unblockalarms = sapi_unblock; sapi_info->log = sapi_log; sapi_info->info = sapi_print_info; - sapi_info->aborted = sapi_aborted; - sapi_info->abort = 0; sapi_info->interactive=0; /*page stat info */ --- 226,231 ---- Index: php31/sapi/isapi_sapi.c diff -c php31/sapi/isapi_sapi.c:2.13 php31/sapi/isapi_sapi.c:2.14 *** php31/sapi/isapi_sapi.c:2.13 Fri Aug 21 16:15:50 1998 --- php31/sapi/isapi_sapi.c Fri Aug 21 17:00:47 1998 *************** *** 292,312 **** int sapi_writeclient(SAPI_GLOBAL_INCLUDE unsigned char *string, int len) { SAPI_FUNC_VARS; ! if (!lpEcb->WriteClient(lpEcb->ConnID, string, &len, 0)) { ! /*FIXME request_shutdown on failure! */ ! #if defined(CRASH_DETECTION) ! debug_log("sapi_writeclient failure called from %s,%d\n", cfilename, clineno); ! #endif ! sapi_info->abort = 1; ! return FAILURE; ! } ! return SUCCESS; ! } ! ! int sapi_puts(SAPI_GLOBAL_INCLUDE unsigned char *string){ ! int len=strlen(string); ! SAPI_FUNC_VARS; ! sapi_writeclient(SAPI_GLOBAL_PASS string, len); return len; } --- 292,298 ---- int sapi_writeclient(SAPI_GLOBAL_INCLUDE unsigned char *string, int len) { SAPI_FUNC_VARS; ! lpEcb->WriteClient(lpEcb->ConnID, string, &len, 0); return len; } *************** *** 326,337 **** { } - int sapi_aborted(SAPI_GLOBAL_INCLUDE_V) - { - SAPI_FUNC_VARS; - return sapi_info->abort; - } - #if defined(CRASH_DETECTION) /****************************************************************************** /* crash detection logging --- 312,317 ---- *************** *** 400,422 **** int i = 0; SAPI_FUNC_VARS; ! INT_PUTS("<center><h2>ISAPI Request Environment</h2></center>"); ! INT_PUTS("<table border=5 width=\"600\">\n"); ! INT_PUTS("<tr><th bgcolor=\"" HEADER_COLOR "\">Variable</th><th bgcolor=\"" HEADER_COLOR "\">Value</th></tr>\n"); while (isapi_env[i] != NULL) { temp = sapi_getenv(SAPI_GLOBAL_PASS isapi_env[i]); ! INT_PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">"); ! INT_PUTS(isapi_env[i]); ! INT_PUTS("</td><td bgcolor=\"" CONTENTS_COLOR "\">"); if (temp) { ! INT_PUTS(temp); } ! INT_PUTS("&nbsp;</td></tr>\n"); if (temp) efree(temp); i++; } ! INT_PUTS("</table>\n"); } struct sapi_request_info *sapi_init(LPEXTENSION_CONTROL_BLOCK lpEcb) --- 380,402 ---- int i = 0; SAPI_FUNC_VARS; ! PUTS("<center><h2>ISAPI Request Environment</h2></center>"); ! PUTS("<table border=5 width=\"600\">\n"); ! PUTS("<tr><th bgcolor=\"" HEADER_COLOR "\">Variable</th><th bgcolor=\"" HEADER_COLOR "\">Value</th></tr>\n"); while (isapi_env[i] != NULL) { temp = sapi_getenv(SAPI_GLOBAL_PASS isapi_env[i]); ! PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">"); ! PUTS(isapi_env[i]); ! PUTS("</td><td bgcolor=\"" CONTENTS_COLOR "\">"); if (temp) { ! PUTS(temp); } ! PUTS("&nbsp;</td></tr>\n"); if (temp) efree(temp); i++; } ! PUTS("</table>\n"); } struct sapi_request_info *sapi_init(LPEXTENSION_CONTROL_BLOCK lpEcb) *************** *** 445,452 **** sapi_info->unblockalarms = sapi_unblock; sapi_info->log = sapi_log; sapi_info->info = sapi_print_info; - sapi_info->aborted = sapi_aborted; - sapi_info->abort = 0; sapi_info->interactive = 0; sapi_info->insert_header = sapi_insert_header; --- 425,430 ---- Index: php31/sapi/sapi.h diff -c php31/sapi/sapi.h:2.11 php31/sapi/sapi.h:2.12 *** php31/sapi/sapi.h:2.11 Fri Aug 21 16:15:50 1998 --- php31/sapi/sapi.h Fri Aug 21 17:00:47 1998 *************** *** 62,72 **** unsigned char *headers; /*pointer to header list */ unsigned char *http_status; /* such as 401 Access Denied, needed for isapi */ int http_redirect; /*used to signal redirect for isapi */ - int abort; int (*insert_header) (SAPI_GLOBAL_INCLUDE unsigned char *); /*insert header into a list */ int (*send_header) (SAPI_GLOBAL_INCLUDE_V); /*write headers to client */ void (*treat_headers) (SAPI_GLOBAL_INCLUDE_V); - int (*aborted) (SAPI_GLOBAL_INCLUDE_V); /* returns: same as apaches php3_rqst->connection->aborted */ /* io functions */ int (*readclient) (SAPI_GLOBAL_INCLUDE unsigned char *, int); --- 62,70 ---- *************** *** 112,127 **** extern struct sapi_request_info *sapi_rqst; #endif ! /* these three defines must allways be available to deal with function ! modules that may or may not be staticly compiled */ #define PHPWRITE(a,n) php3_write((a),(n)) #define PUTS(s) { unsigned char *str=(s); PHPWRITE(str,strlen(str)); } #define PUTC(c) { unsigned char ch=(c); PHPWRITE(&ch, 1); } ! #ifndef COMPILE_DL ! #define INT_PHPWRITE(a,n) php3_sapi_writeclient((a),(n) _INLINE_TLS) ! #define INT_PUTS(s) { unsigned char *str=(s); INT_PHPWRITE(str,strlen(str)); } ! #define INT_PUTC(c) { unsigned char ch=(c); INT_PHPWRITE(&ch, 1); } #define BLOCK_INTERRUPTIONS if(GLOBAL(sapi_rqst))GLOBAL(sapi_rqst)->blockalarms(SAPI_GLOBAL_PASS_V) #define UNBLOCK_INTERRUPTIONS if(GLOBAL(sapi_rqst))GLOBAL(sapi_rqst)->unblockalarms(SAPI_GLOBAL_PASS_V) --- 110,127 ---- extern struct sapi_request_info *sapi_rqst; #endif ! /* FIXME! every function module that can be compiled as a DL OR staticly ! must define IS_EXT_MODULE. Leaving COMPILE_DL in for now just ! to catch stuff until that change is made */ ! #if defined(COMPILE_DL) || defined(IS_EXT_MODULE) #define PHPWRITE(a,n) php3_write((a),(n)) #define PUTS(s) { unsigned char *str=(s); PHPWRITE(str,strlen(str)); } #define PUTC(c) { unsigned char ch=(c); PHPWRITE(&ch, 1); } ! #else ! #define PHPWRITE(a,n) php3_sapi_writeclient((a),(n) _INLINE_TLS) ! #define PUTS(s) { unsigned char *str=(s); PHPWRITE(str,strlen(str)); } ! #define PUTC(c) { unsigned char ch=(c); PHPWRITE(&ch, 1); } #define BLOCK_INTERRUPTIONS if(GLOBAL(sapi_rqst))GLOBAL(sapi_rqst)->blockalarms(SAPI_GLOBAL_PASS_V) #define UNBLOCK_INTERRUPTIONS if(GLOBAL(sapi_rqst))GLOBAL(sapi_rqst)->unblockalarms(SAPI_GLOBAL_PASS_V) -- 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

« previous php.dev (#448) next »