From 7806711b85b46c3caad150c8fde97f29f32ae6f8 Mon Sep 17 00:00:00 2001
From: Jim Jagielski <jim@apache.org>
Date: Mon, 3 Jul 2017 10:22:07 +0000
Subject: [PATCH] Merge r1800306, r1800393 from trunk:

proxy_fcgi: remove FPM-specific logic

Reverts r1780328, r1780329, and their associated followups, which
incorrectly manipulated SCRIPT_NAME by default. All proxy_fcgi.t
regression tests now pass.

PR: 61202

Partial reversal of r1800306... note virtual scripts in notes

Submitted by: jchampion, jim
Reviewed by: jchampion, jim, covener


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1800618 13f79535-47bb-0310-9956-ffa450edef68
---
 modules/proxy/mod_proxy_fcgi.c | 32 --------------------------------
 3 files changed, 4 insertions(+), 39 deletions(-)

diff --git a/modules/proxy/mod_proxy_fcgi.c b/modules/proxy/mod_proxy_fcgi.c
index a268556e302..41292e87267 100644
--- a/modules/proxy/mod_proxy_fcgi.c
+++ b/modules/proxy/mod_proxy_fcgi.c
@@ -321,7 +321,6 @@ static apr_status_t send_environment(proxy_conn_rec *conn, request_rec *r,
     apr_status_t rv;
     apr_size_t avail_len, len, required_len;
     int next_elem, starting_elem;
-    int fpm = 0;
     fcgi_req_config_t *rconf = ap_get_module_config(r->request_config, &proxy_fcgi_module);
     fcgi_dirconf_t *dconf = ap_get_module_config(r->per_dir_config, &proxy_fcgi_module);
 
@@ -354,8 +353,6 @@ static apr_status_t send_environment(proxy_conn_rec *conn, request_rec *r,
                     *qs = '\0';
                 }
             }
-        } else {
-            fpm = 1;
         }
 
         if (newfname) {
@@ -364,38 +361,9 @@ static apr_status_t send_environment(proxy_conn_rec *conn, request_rec *r,
         }
     }
 
-#if 0
-    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(09999)
-                  "r->filename: %s", (r->filename ? r->filename : "nil"));
-    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(09999)
-                  "r->uri: %s", (r->uri ? r->uri : "nil"));
-    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(09999)
-                  "r->path_info: %s", (r->path_info ? r->path_info : "nil"));
-#endif
-
     ap_add_common_vars(r);
     ap_add_cgi_vars(r);
 
-    if (fpm || apr_table_get(r->notes, "virtual_script")) {
-        /*
-         * Adjust SCRIPT_NAME, PATH_INFO and PATH_TRANSLATED for PHP-FPM
-         * TODO: Right now, PATH_INFO and PATH_TRANSLATED look OK...
-         */
-        const char *pend;
-        const char *script_name = apr_table_get(r->subprocess_env, "SCRIPT_NAME");
-        pend = script_name + strlen(script_name);
-        if (r->path_info && *r->path_info) {
-            pend = script_name + ap_find_path_info(script_name, r->path_info) - 1;
-        }
-        while (pend != script_name && *pend != '/') {
-            pend--;
-        }
-        apr_table_setn(r->subprocess_env, "SCRIPT_NAME", pend);
-        ap_log_rerror(APLOG_MARK, APLOG_TRACE4, 0, r,
-                      "fpm:virtual_script: Modified SCRIPT_NAME to: %s",
-                      pend);
-    }
-
     /* XXX are there any FastCGI specific env vars we need to send? */
 
     /* Give admins final option to fine-tune env vars */
