View | Details | Raw Unified | Return to bug 61189
Collapse All | Expand All

(-)java/org/apache/catalina/servlets/CGIServlet.java (+22 lines)
Lines 311-316 Link Here
311
            shellEnv.putAll(System.getenv());
311
            shellEnv.putAll(System.getenv());
312
        }
312
        }
313
313
314
        String envVarsString = config.getInitParameter("environment-variables");
315
        if (envVarsString != null) {
316
            String[] envVars = envVarsString.split("\n");
317
            for (String envVar : envVars) {
318
                envVar = envVar.trim();
319
                if (envVar.length() != 0) {
320
                    int equalIndex = envVar.indexOf('=');
321
                    if (equalIndex == 0) {
322
                        throw new ServletException("Empty var name in environment-variables.");
323
                    }
324
            	    else if (equalIndex < 0) {
325
                        shellEnv.put(envVar, "");
326
                    }
327
                    else {
328
                        String varName = envVar.substring(0, equalIndex).trim();
329
                        String varValue = envVar.substring(equalIndex + 1).trim();
330
                        shellEnv.put(varName, varValue);
331
                    }
332
                }
333
            }
334
        }
335
314
        if (getServletConfig().getInitParameter("executable") != null) {
336
        if (getServletConfig().getInitParameter("executable") != null) {
315
            cgiExecutable = getServletConfig().getInitParameter("executable");
337
            cgiExecutable = getServletConfig().getInitParameter("executable");
316
        }
338
        }

Return to bug 61189