joosters                Tue Jan 16 02:44:52 2001 EDT

  Modified files:              
    /php4       README.Zeus 
    /php4/sapi/isapi    php4isapi.c 
  Log:
  @ Support Zeus 3.3.8
  Added changes to environment variable manipulations, to support Zeus 3.3.8
  and increase compatibility between Zeus/IIS/Apache. Now, URLs like
  http://foo.org/file.php/a/b/c/d work correctly.
  # While testing, it looks like IIS+ISAPI is mishandling URLs like the above.
  # The PATH_TRANSLATED given by ISAPI includes the /a/b/c/d bit of the URL,
  # so using this var to find the script file to open on disk will not work.
  # We now use SCRIPT_FILENAME if it is present (in Zeus 3.3.8)
  # IIS doesn't seem to set this variable, it might be necessary to mangle
  # SCRIPT_NAME and APPL_PHYSICAL_PATH together?
  
  
Index: php4/README.Zeus
diff -u php4/README.Zeus:1.6 php4/README.Zeus:1.7
--- php4/README.Zeus:1.6        Fri Nov 10 08:14:00 2000
+++ php4/README.Zeus    Tue Jan 16 02:44:51 2001
@@ -6,9 +6,11 @@
 ISAPI module, giving great performance benefits over traditional CGI
 code.
 
-Note that you will need to be running at least version 3.3.6 of the
+Note that you will need to be running at least version 3.3.8 of the
 webserver. If you are running an earlier version, please see our
 website (http://www.zeus.com) for upgrade instructions.
+Earlier versions of Zeus (3.3.6) can also run PHP, but it is
+suggested that you upgrade for full compatibility.
 
 
 To build the ISAPI version of PHP, start the configuration with:
Index: php4/sapi/isapi/php4isapi.c
diff -u php4/sapi/isapi/php4isapi.c:1.64 php4/sapi/isapi/php4isapi.c:1.65
--- php4/sapi/isapi/php4isapi.c:1.64    Sun Jan  7 15:45:24 2001
+++ php4/sapi/isapi/php4isapi.c Tue Jan 16 02:44:52 2001
@@ -65,8 +65,6 @@
        "HTTPS",
 #ifndef WITH_ZEUS
        "SCRIPT_NAME",
-#else
-       "PATH_INFO",
 #endif
        NULL
 };
@@ -349,33 +347,44 @@
 {
        char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE];
        DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
+       DWORD scriptname_len = ISAPI_SERVER_VAR_BUF_SIZE;
+       DWORD pathinfo_len = 0;
        char *strtok_buf = NULL;
 
-    /*
-     * Zeus' map module translates the given URL onto the PHP ISAPI library;
-     * from an internal point of view, SCRIPT_NAME and URL are correct,
-     * but from the end-users point of view, it is not... We need to
-     * reconstruct the SCRIPT_NAME and URL from PATH_INFO, and then
-     * finally clear out PATH_INFO.
-     */
-    variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
-    if ( lpECB->GetServerVariable(lpECB->ConnID, "PATH_INFO", static_variable_buf, 
&variable_len) && static_variable_buf[0] ) {
-        php_register_variable( "SCRIPT_NAME", static_variable_buf, track_vars_array 
ELS_CC PLS_CC );
-        /* append query string to give url... extra byte for '?' */
-        if ( strlen(lpECB->lpszQueryString) + variable_len + 1 < 
ISAPI_SERVER_VAR_BUF_SIZE ) {
+       /* Get SCRIPT_NAME, we use this to work out which bit of the URL
+        * belongs in PHP's version of PATH_INFO
+        */
+       lpECB->GetServerVariable(lpECB->ConnID, "SCRIPT_NAME", static_variable_buf, 
+&scriptname_len);
+
+       /* Adjust Zeus' version of PATH_INFO, set PHP_SELF,
+        * and generate REQUEST_URI
+        */
+       if ( lpECB->GetServerVariable(lpECB->ConnID, "PATH_INFO", static_variable_buf, 
+&variable_len) && static_variable_buf[0] ) {
+
+               /* PHP_SELF is just PATH_INFO */
+               php_register_variable( "PHP_SELF", static_variable_buf, 
+track_vars_array ELS_CC PLS_CC );
+
+               /* Chop off filename to get just the 'real' PATH_INFO' */
+               pathinfo_len = variable_len - scriptname_len;
+               php_register_variable( "PATH_INFO", static_variable_buf + 
+scriptname_len - 1, track_vars_array ELS_CC PLS_CC );
+               /* append query string to give url... extra byte for '?' */
+               if ( strlen(lpECB->lpszQueryString) + variable_len + 1 < 
+ISAPI_SERVER_VAR_BUF_SIZE ) {
                        /* append query string only if it is present... */
                        if ( strlen(lpECB->lpszQueryString) ) {
                                static_variable_buf[ variable_len - 1 ] = '?';
                                strcpy( static_variable_buf + variable_len, 
lpECB->lpszQueryString );
                        }
-            php_register_variable( "URL", static_variable_buf, track_vars_array 
ELS_CC PLS_CC );
-            php_register_variable( "REQUEST_URI", static_variable_buf, 
track_vars_array ELS_CC PLS_CC );
-        }
-    }
-    variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
-    if ( lpECB->GetServerVariable(lpECB->ConnID, "PATH_TRANSLATED", 
static_variable_buf, &variable_len) && static_variable_buf[0] ) {
-        php_register_variable( "SCRIPT_FILENAME", static_variable_buf, 
track_vars_array ELS_CC PLS_CC );
-    }
+                       php_register_variable( "URL", static_variable_buf, 
+track_vars_array ELS_CC PLS_CC );
+                       php_register_variable( "REQUEST_URI", static_variable_buf, 
+track_vars_array ELS_CC PLS_CC );
+               }
+       }
+
+       /* Get and adjust PATH_TRANSLATED to what PHP wants */
+       variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
+       if ( lpECB->GetServerVariable(lpECB->ConnID, "PATH_TRANSLATED", 
+static_variable_buf, &variable_len) && static_variable_buf[0] ) {
+               static_variable_buf[ variable_len - pathinfo_len - 1 ] = '\0';
+               php_register_variable( "PATH_TRANSLATED", static_variable_buf, 
+track_vars_array ELS_CC PLS_CC );
+       }
 }
 #endif
 
@@ -550,7 +559,7 @@
 
                                if (auth_user && auth_user[0]) {
                                        SG(request_info).auth_user = 
estrdup(auth_user);
-                               }   
+                               }       
                                if (auth_password && auth_password[0]) {
                                        SG(request_info).auth_password = 
estrdup(auth_password);
                                }
@@ -652,8 +661,27 @@
                init_request_info(sapi_globals, lpECB);
                SG(server_context) = lpECB;
 
+#ifdef WITH_ZEUS
+               /* PATH_TRANSLATED can contain extra PATH_INFO stuff after the
+                * file being loaded, so we must use SCRIPT_FILENAME instead
+                */
+               file_handle.filename = (char *)emalloc( ISAPI_SERVER_VAR_BUF_SIZE );
+               file_handle.free_filename = 1;
+               {
+                       DWORD filename_len = ISAPI_SERVER_VAR_BUF_SIZE;
+                       if( !lpECB->GetServerVariable(lpECB->ConnID, 
+"SCRIPT_FILENAME", file_handle.filename, &filename_len) || file_handle.filename[ 0 ] 
+== '\0' ) {
+                /* If we're running on an earlier version of Zeus, this
+                 * variable won't be present, so fall back to old behaviour.
+                 */
+                efree( file_handle.filename );
+                file_handle.filename = sapi_globals->request_info.path_translated;
+                file_handle.free_filename = 0;
+            }
+               }
+#else
                file_handle.filename = sapi_globals->request_info.path_translated;
                file_handle.free_filename = 0;
+#endif
                file_handle.type = ZEND_HANDLE_FILENAME;
                file_handle.opened_path = NULL;
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to