dmitry          Fri Mar 17 09:32:30 2006 UTC

  Modified files:              (Branch: PHP_5_1)
    /php-src/sapi/cgi   cgi_main.c 
  Log:
  Optimized FastCGI SAPI check. Check for ini options only once.
  
  
http://cvs.php.net/viewcvs.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.8&r2=1.267.2.9&diff_format=u
Index: php-src/sapi/cgi/cgi_main.c
diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.8 
php-src/sapi/cgi/cgi_main.c:1.267.2.9
--- php-src/sapi/cgi/cgi_main.c:1.267.2.8       Tue Mar  7 22:37:53 2006
+++ php-src/sapi/cgi/cgi_main.c Fri Mar 17 09:32:30 2006
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: cgi_main.c,v 1.267.2.8 2006/03/07 22:37:53 alexwaugh Exp $ */
+/* $Id: cgi_main.c,v 1.267.2.9 2006/03/17 09:32:30 dmitry Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -151,6 +151,13 @@
 long fix_pathinfo = 1;
 #endif
 
+#if PHP_FASTCGI
+long fcgi_logging = 1;
+#endif
+
+static long rfc2616_headers = 0;
+static long cgi_nph = 0;
+
 #ifdef PHP_WIN32
 #define TRANSLATE_SLASHES(path) \
        { \
@@ -293,25 +300,12 @@
        char buf[SAPI_CGI_MAX_HEADER_LENGTH];
        sapi_header_struct *h;
        zend_llist_position pos;
-       long rfc2616_headers = 0, nph = 0;
 
        if (SG(request_info).no_headers == 1) {
                return  SAPI_HEADER_SENT_SUCCESSFULLY;
        }
-       /* Check wheater to send RFC2616 style headers compatible with
-        * PHP versions 4.2.3 and earlier compatible with web servers
-        * such as IIS. Default is informal CGI RFC header compatible
-        * with Apache.
-        */
-       if (cfg_get_long("cgi.rfc2616_headers", &rfc2616_headers) == FAILURE) {
-               rfc2616_headers = 0;
-       }
-
-       if (cfg_get_long("cgi.nph", &nph) == FAILURE) {
-               nph = 0;
-       }
 
-       if (nph || SG(sapi_headers).http_response_code != 200)
+       if (cgi_nph || SG(sapi_headers).http_response_code != 200)
        {
                int len;
 
@@ -473,15 +467,11 @@
 static void sapi_cgi_log_message(char *message)
 {
 #if PHP_FASTCGI
-       long logging = 1;
-       TSRMLS_FETCH();
-
-       if (cfg_get_long("fastcgi.logging", &logging) == FAILURE) {
-               logging = 1;
-       }
-
-       if (!FCGX_IsCGI() && logging) {
-               FCGX_Request *request = (FCGX_Request *) SG(server_context);
+       if (!FCGX_IsCGI() && fcgi_logging) {
+               FCGX_Request *request;
+               TSRMLS_FETCH();
+               
+                request = (FCGX_Request *) SG(server_context);
                if (request) {
                        FCGX_FPrintF(request->err, "%s\n", message);
                }
@@ -1126,6 +1116,25 @@
 #endif
 
 #if PHP_FASTCGI
+       if (cfg_get_long("fastcgi.logging", &fcgi_logging) == FAILURE) {
+               fcgi_logging = 1;
+       }
+#endif
+
+       /* Check wheater to send RFC2616 style headers compatible with
+        * PHP versions 4.2.3 and earlier compatible with web servers
+        * such as IIS. Default is informal CGI RFC header compatible
+        * with Apache.
+        */
+       if (cfg_get_long("cgi.rfc2616_headers", &rfc2616_headers) == FAILURE) {
+               rfc2616_headers = 0;
+       }
+
+       if (cfg_get_long("cgi.nph", &cgi_nph) == FAILURE) {
+               cgi_nph = 0;
+       }
+
+#if PHP_FASTCGI
 #ifndef PHP_WIN32
        /* for windows, socket listening is broken in the fastcgi library itself
           so dissabling this feature on windows till time is available to fix 
it */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to