Re: CVS update: php3

From: Date: Wed, 27 Jan 1999 21:13:33 +0000
Subject: Re: CVS update: php3
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-3752@lists.php.net to get a copy of this message
"Thies C. Arntzen" wrote: > hi rasmus, > i'm glad this feature finally got it's way into php3.... > > one thing i'm curious about is: will i be able to check at the end of a script if all data > was sent?? (i NEED this for > logging puposes)... sorry rasmus, didn't read the cvs-mail "complete".... (rest still applies...) regards, tc > > > as discussed earlier i think it would be cool if we had a php3.ini setting (nohup=true; //???) > that allows one to > specify the default php behaviour (terminate the script as soon as no more data can be > delivered - or, keep the script > running to allow logging of aborted downloads/scripts via the script itself....) it would also > be desireable to have > an user lever function (like error_reporting) to chenge that behaviour for certain pages.... > > anyway, i owe you a beer! > tc > > rasmus wrote: > > > Date: Wednesday January 27, 1999 @ 14:18 > > Author: rasmus > > > > Update of /repository/php3 > > In directory asf:/u/temp/cvs-serv8695 > > > > Modified Files: > > internal_functions.c main.c php.h > > Log Message: > > Heads up! The following completely cleans up the aborted connection > > mess that never worked reliably. Thanks to Thies C. Arntzen for getting > > me started on this. There was a bit more to it than his initial work. > > > > As discussed with some Apache guys, we are now checking the return status > > of each write and set a global connection_aborted variable if the number of > > bytes written do not match the number of bytes sent. A user-level > > connection_aborted() function has been added. This returns true if the > > connection was aborted, obviously. This is useful in a user-level > > registered shutdown function if something needs to be cleaned up > > differently if the remote user hit his stop button. > > > > Index: php3/internal_functions.c > > diff -c php3/internal_functions.c:1.341 php3/internal_functions.c:1.342 > > *** php3/internal_functions.c:1.341 Tue Jan 26 17:32:35 1999 > > --- php3/internal_functions.c Wed Jan 27 14:18:09 1999 > > *************** > > *** 29,35 **** > > */ > > > > > > ! /* $Id: internal_functions.c,v 1.341 1999/01/26 22:32:35 timothy Exp $ */ > > > > #ifdef THREAD_SAFE > > #include "tls.h" > > --- 29,35 ---- > > */ > > > > > > ! /* $Id: internal_functions.c,v 1.342 1999/01/27 19:18:09 rasmus Exp $ */ > > > > #ifdef THREAD_SAFE > > #include "tls.h" > > *************** > > *** 165,173 **** > > {"PDF", pdf_module_ptr}, > > {"FDF", fdf_module_ptr}, > > {"System V semaphores", sysvsem_module_ptr}, > > ! {"System V shared memory", sysvshm_module_ptr}, > > {"DAV", > > phpdav_module_ptr}, > > ! {"MCK Crypt", mckcrypt_module_ptr}, > > {NULL, NULL} > > }; > > > > --- 165,173 ---- > > {"PDF", pdf_module_ptr}, > > {"FDF", fdf_module_ptr}, > > {"System V semaphores", sysvsem_module_ptr}, > > ! {"System V shared memory", sysvshm_module_ptr}, > > {"DAV", > > phpdav_module_ptr}, > > ! {"MCK Crypt", mckcrypt_module_ptr}, > > {NULL, NULL} > > }; > > > > Index: php3/main.c > > diff -c php3/main.c:1.491 php3/main.c:1.492 > > *** php3/main.c:1.491 Fri Jan 15 12:19:58 1999 > > --- php3/main.c Wed Jan 27 14:18:10 1999 > > *************** > > *** 29,35 **** > > +----------------------------------------------------------------------+ > > */ > > > > ! /* $Id: main.c,v 1.491 1999/01/15 17:19:58 zeev Exp $ */ > > > > /* #define CRASH_DETECTION */ > > > > --- 29,35 ---- > > +----------------------------------------------------------------------+ > > */ > > > > ! /* $Id: main.c,v 1.492 1999/01/27 19:18:10 rasmus Exp $ */ > > > > /* #define CRASH_DETECTION */ > > > > *************** > > *** 99,104 **** > > --- 99,106 ---- > > void *gLock; /*mutex variable */ > > > > #ifndef THREAD_SAFE > > + int connection_aborted; > > + int abort_shutdown_pending; > > int error_reporting, tmp_error_reporting; > > int initialized; /* keep track of which resources were > > successfully initialized */ > > static int module_initialized = 0; > > *************** > > *** 170,181 **** > > > > > > #if APACHE > > void php3_apache_puts(const char *s) > > { > > TLS_VARS; > > > > if (GLOBAL(php3_rqst)) { > > ! rputs(s, GLOBAL(php3_rqst)); > > } else { > > fputs(s, stdout); > > } > > --- 172,199 ---- > > > > > > #if APACHE > > + int php3_apache_write(const void *a, int n) > > + { > > + int ret; > > + TLS_VARS; > > + > > + ret = rwrite(a,n,GLOBAL(php3_rqst)); > > + > > + if (ret != n) { > > + GLOBAL(connection_aborted) = 1; > > + } > > + > > + return ret; > > + } > > + > > void php3_apache_puts(const char *s) > > { > > TLS_VARS; > > > > if (GLOBAL(php3_rqst)) { > > ! if (rputs(s, GLOBAL(php3_rqst)) == -1) { > > ! GLOBAL(connection_aborted) = 1; > > ! } > > } else { > > fputs(s, stdout); > > } > > *************** > > *** 186,192 **** > > TLS_VARS; > > > > if (GLOBAL(php3_rqst)) { > > ! rputc(c, GLOBAL(php3_rqst)); > > } else { > > fputc(c, stdout); > > } > > --- 204,212 ---- > > TLS_VARS; > > > > if (GLOBAL(php3_rqst)) { > > ! if (rputc(c, GLOBAL(php3_rqst)) != c) { > > ! GLOBAL(connection_aborted) = 1; > > ! } > > } else { > > fputc(c, stdout); > > } > > *************** > > *** 422,429 **** > > return 0; > > } > > #if APACHE > > ! if (php3_rqst->connection->aborted) { > > GLOBAL(shutdown_requested) = ABNORMAL_SHUTDOWN; > > return 0; > > } > > #endif > > --- 442,456 ---- > > return 0; > > } > > #if APACHE > > ! if ((php3_rqst->connection->aborted || GLOBAL(connection_aborted)) > > && !GLOBAL(abort_shutdown_pending)) { > > GLOBAL(shutdown_requested) = ABNORMAL_SHUTDOWN; > > + /* > > + abort_shutdown_pending is used to tell phplex() that even though > > we know that the > > + remote client is no longer listening to us, we still want it to > > continue in case > > + we come back here as part of a registered shutdown function. > > Without this flag > > + a user-registered shutdown function would never run to completion. > > + */ > > + GLOBAL(abort_shutdown_pending) = 1; > > return 0; > > } > > #endif > > *************** > > *** 457,463 **** > > TLS_VARS; > > > > if (!GLOBAL(shutdown_requested)) { > > ! php3_error(E_ERROR, "Maximum execution time of %d seconds > > exceeded", php3_ini.max_execution_time); > > /* Now, schedule another alarm. If we're stuck in a code portion > > that will not go through > > * phplex() or if the parser is broken, end the process ungracefully > > */ > > --- 484,490 ---- > > TLS_VARS; > > > > if (!GLOBAL(shutdown_requested)) { > > ! php3_error(E_ERROR, "Maximum execution time exceeded"); > > /* Now, schedule another alarm. If we're stuck in a code portion > > that will not go through > > * phplex() or if the parser is broken, end the process ungracefully > > */ > > *************** > > *** 532,537 **** > > --- 559,570 ---- > > be. If we use a bound thread and proper masking it > > should work fine. Is this FIXME a WIN32 problem? Is > > there no way to do per-thread timers on WIN32? > > + > > + Something to keep in mind here is that the SIGPROF itimer > > + we are currently using is not a real-time timer. It is > > + only active when the process is in user or kernel space. > > + ie. a sleep(10); call in a script will not count towards > > + the timeout limit. -RL > > */ > > GLOBAL(max_execution_time) = new_timeout->value.lval; > > php3_unset_timeout(_INLINE_TLS_VOID); > > *************** > > *** 592,597 **** > > --- 625,632 ---- > > GLOBAL(shutdown_requested) = 0; > > GLOBAL(header_is_being_sent) = 0; > > GLOBAL(php3_track_vars) = php3_ini.track_vars; > > + GLOBAL(connection_aborted) = 0; > > + GLOBAL(abort_shutdown_pending) = 0; > > } > > > > if (php3_init_request_info((void *) &php3_ini)) { > > *************** > > *** 702,708 **** > > log_error(log_message, php3_rqst->server); > > } > > #endif > > - > > php3_call_shutdown_functions(); > > > > if (GLOBAL(initialized) & INIT_LIST) { > > --- 737,742 ---- > > Index: php3/php.h > > diff -c php3/php.h:1.42 php3/php.h:1.43 > > *** php3/php.h:1.42 Fri Jan 1 12:58:51 1999 > > --- php3/php.h Wed Jan 27 14:18:11 1999 > > *************** > > *** 28,34 **** > > +----------------------------------------------------------------------+ > > */ > > > > ! /* $Id: php.h,v 1.42 1999/01/01 17:58:51 zeev Exp $ */ > > > > #ifndef _PHP_H > > #define _PHP_H > > --- 28,34 ---- > > +----------------------------------------------------------------------+ > > */ > > > > ! /* $Id: php.h,v 1.43 1999/01/27 19:18:11 rasmus Exp $ */ > > > > #ifndef _PHP_H > > #define _PHP_H > > *************** > > *** 248,257 **** > > #if APACHE > > extern PHPAPI void php3_apache_puts(const char *s); > > extern PHPAPI void php3_apache_putc(char c); > > # if !defined(COMPILE_DL) > > # define PUTS(s) php3_apache_puts(s) > > # define PUTC(c) php3_apache_putc(c) > > ! # define PHPWRITE(a,n) rwrite((a),(n),GLOBAL(php3_rqst)) > > # endif > > #endif > > > > --- 248,259 ---- > > #if APACHE > > extern PHPAPI void php3_apache_puts(const char *s); > > extern PHPAPI void php3_apache_putc(char c); > > + extern PHPAPI int php3_apache_write(const void *a, int n); > > # if !defined(COMPILE_DL) > > # define PUTS(s) php3_apache_puts(s) > > # define PUTC(c) php3_apache_putc(c) > > ! # define PHPWRITE(a,n) php3_apache_write(a,n) > > ! /* thies@digicol.de 990119 # define PHPWRITE(a,n) rwrite((a),(n),GLOBAL(php3_rqst)) */ > > # endif > > #endif > > > > *************** > > *** 447,452 **** > > --- 449,456 ---- > > extern HashTable include_names; > > extern HashTable *active_symbol_table; > > extern int phplineno, current_lineno; > > + extern int connection_aborted; > > + extern int abort_shutdown_pending; > > extern int error_reporting,tmp_error_reporting; > > extern pval *data,globals; > > extern FunctionState function_state; > > > > -- > > 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 > > -- > 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 -- 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 (#3752) next »