[PHP-DEV] CVS update: php3 From: rasmus (php-dev <email protected>)
Date: 01/28/99

Date: Thursday January 28, 1999 @ 21:39
Author: rasmus

Update of /repository/php3
In directory asf:/u/temp/cvs-serv534

Modified Files:
        ChangeLog main.c php.h
Log Message:
- Add connection_status() function. This returns the raw bitfield which
  indicates whether the script terminated due to a user abort, a timeout
  or normally. Note that if ignore_user_abort is enabled, then both the
  timeout state and the user abort state can be active
- Add connection_timeout() function. This one can be called in a shutdown
  function to tell you if you got there because of a timeout

Index: php3/ChangeLog
diff -c php3/ChangeLog:1.565 php3/ChangeLog:1.566
*** php3/ChangeLog:1.565 Wed Jan 27 16:55:46 1999
--- php3/ChangeLog Thu Jan 28 21:39:50 1999
***************
*** 3,8 ****
--- 3,14 ----
  xxx xx xxxx, Version 3.0.7
  - Fix implode() bug - When imploding an array that contained unset() elements
    it wasn't correctly skipping past these
+ - Add connection_status() function. This returns the raw bitfield which
+ indicates whether the script terminated due to a user abort, a timeout
+ or normally. Note that if ignore_user_abort is enabled, then both the
+ timeout state and the user abort state can be active
+ - Add connection_timeout() function. This one can be called in a shutdown
+ function to tell you if you got there because of a timeout
  - Add ignore_user_abort() function and .ini/.conf directive of same name
  - Fix connection abort detection code - It should now work reliably with
    Apache. Also added a user-level connection_aborted() function designed to
Index: php3/main.c
diff -c php3/main.c:1.493 php3/main.c:1.494
*** php3/main.c:1.493 Wed Jan 27 16:55:47 1999
--- php3/main.c Thu Jan 28 21:39:50 1999
***************
*** 29,35 ****
     +----------------------------------------------------------------------+
   */
  
! /* $Id: main.c,v 1.493 1999/01/27 21:55:47 rasmus Exp $ */
  
  /* #define CRASH_DETECTION */
  
--- 29,35 ----
     +----------------------------------------------------------------------+
   */
  
! /* $Id: main.c,v 1.494 1999/01/29 02:39:50 rasmus Exp $ */
  
  /* #define CRASH_DETECTION */
  
***************
*** 99,105 ****
  void *gLock; /*mutex variable */
  
  #ifndef THREAD_SAFE
! int connection_aborted;
  int ignore_user_abort;
  int error_reporting, tmp_error_reporting;
  int initialized; /* keep track of which resources were successfully initialized */
--- 99,105 ----
  void *gLock; /*mutex variable */
  
  #ifndef THREAD_SAFE
! int php_connection_status;
  int ignore_user_abort;
  int error_reporting, tmp_error_reporting;
  int initialized; /* keep track of which resources were successfully initialized */
***************
*** 180,186 ****
          ret = rwrite(a,n,GLOBAL(php3_rqst));
  
          if (ret != n) {
! GLOBAL(connection_aborted) = 1;
          }
  
          return ret;
--- 180,186 ----
          ret = rwrite(a,n,GLOBAL(php3_rqst));
  
          if (ret != n) {
! GLOBAL(php_connection_status) |= PHP_CONNECTION_ABORTED;
          }
  
          return ret;
***************
*** 192,198 ****
  
          if (GLOBAL(php3_rqst)) {
                  if (rputs(s, GLOBAL(php3_rqst)) == -1) {
! GLOBAL(connection_aborted) = 1;
                  }
          } else {
                  fputs(s, stdout);
--- 192,198 ----
  
          if (GLOBAL(php3_rqst)) {
                  if (rputs(s, GLOBAL(php3_rqst)) == -1) {
! GLOBAL(php_connection_status) |= PHP_CONNECTION_ABORTED;
                  }
          } else {
                  fputs(s, stdout);
***************
*** 205,211 ****
  
          if (GLOBAL(php3_rqst)) {
                  if (rputc(c, GLOBAL(php3_rqst)) != c) {
! GLOBAL(connection_aborted) = 1;
                  }
          } else {
                  fputc(c, stdout);
--- 205,211 ----
  
          if (GLOBAL(php3_rqst)) {
                  if (rputc(c, GLOBAL(php3_rqst)) != c) {
! GLOBAL(php_connection_status) |= PHP_CONNECTION_ABORTED;
                  }
          } else {
                  fputc(c, stdout);
***************
*** 442,448 ****
                  return 0;
          }
  #if APACHE
! if ((php3_rqst->connection->aborted || GLOBAL(connection_aborted)) && !GLOBAL(ignore_user_abort)) {
                  GLOBAL(shutdown_requested) = ABNORMAL_SHUTDOWN;
                  /*
                          ignore_user_abort is used to tell phplex() that even though we know that the
--- 442,449 ----
                  return 0;
          }
  #if APACHE
! if ((php3_rqst->connection->aborted || GLOBAL(php_connection_status)&PHP_CONNECTION_ABORTED)
! && !GLOBAL(ignore_user_abort)) {
                  GLOBAL(shutdown_requested) = ABNORMAL_SHUTDOWN;
                  /*
                          ignore_user_abort is used to tell phplex() that even though we know that the
***************
*** 485,490 ****
--- 486,492 ----
  
          if (!GLOBAL(shutdown_requested)) {
                  php3_error(E_ERROR, "Maximum execution time exceeded");
+ GLOBAL(php_connection_status) |= PHP_CONNECTION_TIMEOUT;
                  /* 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
                   */
***************
*** 625,631 ****
                  GLOBAL(shutdown_requested) = 0;
                  GLOBAL(header_is_being_sent) = 0;
                  GLOBAL(php3_track_vars) = php3_ini.track_vars;
! GLOBAL(connection_aborted) = 0;
                  GLOBAL(ignore_user_abort) = 0;
          }
  
--- 627,633 ----
                  GLOBAL(shutdown_requested) = 0;
                  GLOBAL(header_is_being_sent) = 0;
                  GLOBAL(php3_track_vars) = php3_ini.track_vars;
! GLOBAL(php_connection_status) = PHP_CONNECTION_NORMAL;
                  GLOBAL(ignore_user_abort) = 0;
          }
  
Index: php3/php.h
diff -c php3/php.h:1.44 php3/php.h:1.45
*** php3/php.h:1.44 Wed Jan 27 16:55:47 1999
--- php3/php.h Thu Jan 28 21:39:50 1999
***************
*** 28,34 ****
     +----------------------------------------------------------------------+
   */
  
! /* $Id: php.h,v 1.44 1999/01/27 21:55:47 rasmus Exp $ */
  
  #ifndef _PHP_H
  #define _PHP_H
--- 28,34 ----
     +----------------------------------------------------------------------+
   */
  
! /* $Id: php.h,v 1.45 1999/01/29 02:39:50 rasmus Exp $ */
  
  #ifndef _PHP_H
  #define _PHP_H
***************
*** 442,455 ****
          pval *object_pointer;
  } FunctionState;
  
  
  /* global variables */
  #ifndef THREAD_SAFE
  extern HashTable symbol_table, function_table;
  extern HashTable include_names;
  extern HashTable *active_symbol_table;
  extern int phplineno, current_lineno;
! extern int connection_aborted;
  extern int ignore_user_abort;
  extern int error_reporting,tmp_error_reporting;
  extern pval *data,globals;
--- 442,460 ----
          pval *object_pointer;
  } FunctionState;
  
+ /* Connection states */
+ #define PHP_CONNECTION_NORMAL 0
+ #define PHP_CONNECTION_ABORTED 1
+ #define PHP_CONNECTION_TIMEOUT 2
  
+
  /* global variables */
  #ifndef THREAD_SAFE
  extern HashTable symbol_table, function_table;
  extern HashTable include_names;
  extern HashTable *active_symbol_table;
  extern int phplineno, current_lineno;
! extern int php_connection_status;
  extern int ignore_user_abort;
  extern int error_reporting,tmp_error_reporting;
  extern pval *data,globals;

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>