]> granicus.if.org Git - php/commitdiff
Fixed bug #40419 (Trailing Slash in CGI request don't work)
authorDmitry Stogov <dmitry@php.net>
Tue, 26 Jun 2007 14:47:33 +0000 (14:47 +0000)
committerDmitry Stogov <dmitry@php.net>
Tue, 26 Jun 2007 14:47:33 +0000 (14:47 +0000)
sapi/cgi/cgi_main.c

index 15a4ffa662014dd903191b2eb8d9194a97212f93..94ecad14cbba536239aaa16620deccf27293ffd4 100644 (file)
@@ -738,9 +738,9 @@ static void init_request_info(TSRMLS_D)
                char *env_path_info = sapi_cgibin_getenv("PATH_INFO", sizeof("PATH_INFO")-1 TSRMLS_CC);
                char *env_script_name = sapi_cgibin_getenv("SCRIPT_NAME", sizeof("SCRIPT_NAME")-1 TSRMLS_CC);
 
-               if (CGIG(fix_pathinfo)) {
+               if (CGIG(fix_pathinfo)) {                       
                        struct stat st;
-                       char *real_path;
+                       char *real_path = NULL;
                        char *env_redirect_url = sapi_cgibin_getenv("REDIRECT_URL", sizeof("REDIRECT_URL")-1 TSRMLS_CC);
                        char *env_document_root = sapi_cgibin_getenv("DOCUMENT_ROOT", sizeof("DOCUMENT_ROOT")-1 TSRMLS_CC);
                        char *orig_path_translated = env_path_translated;
@@ -902,6 +902,9 @@ static void init_request_info(TSRMLS_D)
                                        efree(pt);
                                }
                        } else {
+                               if (real_path) {
+                                       script_path_translated = real_path;
+                               }
                                /* make sure path_info/translated are empty */
                                if (!orig_script_filename ||
                                        (script_path_translated != orig_script_filename) ||
@@ -927,8 +930,10 @@ static void init_request_info(TSRMLS_D)
                                } else {
                                        SG(request_info).request_uri = env_script_name;
                                }
+                               if (real_path) {
+                                       free(real_path);
+                               }
                        }
-                       free(real_path);
                } else {
                        /* pre 4.3 behaviour, shouldn't be used but provides BC */
                        if (env_path_info) {