cvs commit: jakarta-tomcat-4.0/webapps/tomcat-docs cgi-howto.xml
markt 2005/05/23 15:46:57 Modified:.RUNNING.txt webapps/tomcat-docs cgi-howto.xml Log: Fix bug 13240. Add note to docs that 1.3 JDK is required to use CGI. Revision ChangesPath 1.8 +4 -1 jakarta-tomcat-4.0/RUNNING.txt Index: RUNNING.txt === RCS file: /home/cvs/jakarta-tomcat-4.0/RUNNING.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- RUNNING.txt 18 Jun 2004 23:32:27 - 1.7 +++ RUNNING.txt 23 May 2005 22:46:57 - 1.8 @@ -21,6 +21,9 @@ present in the JRE to compile JSP pages. Unless you are *very* sure of what you are doing, please use the full SDK. +NOTE: Use of the CGI Servlet requires Java 2 Standard Edition (J2SE) SDK, +release version 1.3 or later. + * Install the SDK according to the instructions included with the release. * Set an environment variable JAVA_HOME to the pathname of the directory 1.7 +2 -0 jakarta-tomcat-4.0/webapps/tomcat-docs/cgi-howto.xml Index: cgi-howto.xml === RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/tomcat-docs/cgi-howto.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- cgi-howto.xml 28 Sep 2004 21:51:50 - 1.6 +++ cgi-howto.xml 23 May 2005 22:46:57 - 1.7 @@ -29,6 +29,8 @@ this servlet is mapped to the URL pattern "/cgi-bin/*". By default CGI support is disabled in Tomcat. + +Note that the CGI Servlet requires a 1.3 or later JDK. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-4.0/webapps/tomcat-docs cgi-howto.xml
markt 2004/09/28 14:51:50 Modified:catalina/src/conf web.xml catalina/src/share/org/apache/catalina/servlets CGIServlet.java webapps/tomcat-docs cgi-howto.xml Log: Revert RFE 27090 as it introduced a JDK 1.4 dependency Revision ChangesPath 1.59 +0 -4 jakarta-tomcat-4.0/catalina/src/conf/web.xml Index: web.xml === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/conf/web.xml,v retrieving revision 1.58 retrieving revision 1.59 diff -u -r1.58 -r1.59 --- web.xml 17 Aug 2004 21:44:32 - 1.58 +++ web.xml 28 Sep 2004 21:51:49 - 1.59 @@ -236,10 +236,6 @@ - - - - 1.28 +6 -11 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/CGIServlet.java Index: CGIServlet.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/CGIServlet.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- CGIServlet.java 26 Aug 2004 21:38:13 - 1.27 +++ CGIServlet.java 28 Sep 2004 21:51:49 - 1.28 @@ -263,10 +263,6 @@ /** the executable to use with the script */ private String cgiExecutable = "perl"; -/** the encoding to use for parameters */ -private String parameterEncoding = System.getProperty("file.encoding", - "UTF-8"); - /** object used to ensure multiple threads don't try to expand same file */ static Object expandFileLock = new Object(); @@ -768,8 +764,7 @@ if (param != null) { String values[] = req.getParameterValues(param); for (int i=0; i < values.length; i++) { -String value = URLEncoder.encode(values[i], - parameterEncoding); +String value = URLEncoder.encode(values[i]); NameValuePair nvp = new NameValuePair(param, value); queryParameters.add(nvp); } 1.6 +0 -3 jakarta-tomcat-4.0/webapps/tomcat-docs/cgi-howto.xml Index: cgi-howto.xml === RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/tomcat-docs/cgi-howto.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- cgi-howto.xml 17 Aug 2004 21:44:32 - 1.5 +++ cgi-howto.xml 28 Sep 2004 21:51:50 - 1.6 @@ -56,9 +56,6 @@ by this servlet. Default 0. executable - The of the executable to be used to run the script. Default is perl. -parameterEncoding - Name of the parameter encoding -to be used with the GCI servlet. Default is -System.getProperty("file.encoding","UTF-8"). passShellEnvironment - Should the shell environment variables (if any) be passed to the CGI script? Default is false. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-4.0/webapps/tomcat-docs cgi-howto.xml
markt 2004/08/17 14:44:33 Modified:catalina/src/conf web.xml catalina/src/share/org/apache/catalina/servlets CGIServlet.java webapps/tomcat-docs cgi-howto.xml Log: Fix bug 18273. Add support for optionally passing the shell environment variables to the CGI script. - Based heavily on http://www.rgagnon.com/javadetails/java-0150.html";> Read environment variables from an application by Real Gagnon Revision ChangesPath 1.58 +14 -12jakarta-tomcat-4.0/catalina/src/conf/web.xml Index: web.xml === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/conf/web.xml,v retrieving revision 1.57 retrieving revision 1.58 diff -u -r1.57 -r1.58 --- web.xml 16 Aug 2004 22:29:33 - 1.57 +++ web.xml 17 Aug 2004 21:44:32 - 1.58 @@ -226,19 +226,22 @@ - - - + + + - - + + - - + + - - - + + + + + + @@ -256,10 +259,9 @@ cgiPathPrefix WEB-INF/cgi - 5 +5 --> - 1.26 +69 -9 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/CGIServlet.java Index: CGIServlet.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/CGIServlet.java,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- CGIServlet.java 16 Aug 2004 22:29:33 - 1.25 +++ CGIServlet.java 17 Aug 2004 21:44:32 - 1.26 @@ -315,6 +315,8 @@ /** object used to ensure multiple threads don't try to expand same file */ static Object expandFileLock = new Object(); +/** the shell environment variables to be passed to the CGI script */ +static Hashtable shellEnv = new Hashtable(); /** * Sets instance variables. @@ -343,6 +345,8 @@ throw new UnavailableException ("Cannot invoke CGIServlet through the invoker"); +boolean passShellEnvironment = false; + // Set our properties from the initialization parameters String value = null; try { @@ -350,11 +354,22 @@ debug = Integer.parseInt(value); cgiPathPrefix = getServletConfig().getInitParameter("cgiPathPrefix"); +value = getServletConfig().getInitParameter("passShellEnvironment"); +passShellEnvironment = Boolean.valueOf(value).booleanValue(); } catch (Throwable t) { //NOOP } log("init: loglevel set to " + debug); +if (passShellEnvironment) { +try { +shellEnv.putAll(getShellEnvironment()); +} catch (IOException ioe) { +ServletException e = new ServletException( +"Unable to read shell environment variables", ioe); +} +} + value = getServletConfig().getInitParameter("executable"); if (value != null) { cgiExecutable = value; @@ -682,8 +697,49 @@ System.out.println("$Header$"); } - - +/** + * Get all shell environment variables. Have to do it this rather ugly way + * as the API to obtain is not available in 1.4 and earlier APIs. + * + * See http://www.rgagnon.com/javadetails/java-0150.html";>Read environment + * variables from an application for original source and article. + */ +private Hashtable getShellEnvironment() throws IOException { +Hashtable envVars = new Hashtable(); +Process p = null; +Runtime r = Runtime.getRuntime(); +String OS = System.getProperty("os.name").toLowerCase(); +boolean ignoreCase; + +if (OS.indexOf("windows 9") > -1) { +p = r.exec( "command.com /c set" ); +ignoreCase = true; +} else if ( (OS.indexOf("nt") > -1) +|| (OS.indexOf("windows 2000") > -1) +|| (OS.indexOf("windows xp") > -1) ) { +// thanks to JuanFran for the xp fix! +p = r.exec( "cmd.exe /c set" ); +ignoreCase = true; +} else { +// our last hope, we assume Unix (thanks to H. Ware for the fix) +p = r.exec( "env" ); +ignoreCase = false; +} + +BufferedReader br = new BufferedReader +( new InputStreamReader( p.getInputStream() ) ); +String line; +while( (line = br.readLine()) != null ) { +int idx = line.indexOf( '=' ); +Strin
cvs commit: jakarta-tomcat-4.0/webapps/tomcat-docs cgi-howto.xml
markt 2004/08/16 15:29:34 Modified:catalina/src/conf web.xml catalina/src/share/org/apache/catalina/servlets CGIServlet.java webapps/tomcat-docs cgi-howto.xml Log: Housekeeping in CGI servlet Revision ChangesPath 1.57 +0 -8 jakarta-tomcat-4.0/catalina/src/conf/web.xml Index: web.xml === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/conf/web.xml,v retrieving revision 1.56 retrieving revision 1.57 diff -u -r1.56 -r1.57 --- web.xml 20 Apr 2004 22:21:09 - 1.56 +++ web.xml 16 Aug 2004 22:29:33 - 1.57 @@ -230,10 +230,6 @@ - - - - @@ -252,10 +248,6 @@ cgi org.apache.catalina.servlets.CGIServlet - - clientInputTimeout - 100 - debug 6 1.25 +7 -25 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/CGIServlet.java Index: CGIServlet.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/CGIServlet.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- CGIServlet.java 16 Jun 2004 18:21:54 - 1.24 +++ CGIServlet.java 16 Aug 2004 22:29:33 - 1.25 @@ -291,21 +291,12 @@ /* some vars below copied from Craig R. McClanahan's InvokerServlet */ -/** the string manager for this package. */ -/* YAGNI -private static StringManager sm = -StringManager.getManager(Constants.Package); -*/ - /** the Context container associated with our web application. */ private ServletContext context = null; /** the debugging detail level for this servlet. */ private int debug = 0; -/** the time in ms to wait for the client to send us CGI input data */ -private int iClientInputTimeout = 100; - /** * The CGI search path will start at *webAppRootDir + File.separator + cgiPathPrefix @@ -359,9 +350,6 @@ debug = Integer.parseInt(value); cgiPathPrefix = getServletConfig().getInitParameter("cgiPathPrefix"); -value = -getServletConfig().getInitParameter("iClientInputTimeout"); -iClientInputTimeout = Integer.parseInt(value); } catch (Throwable t) { //NOOP } @@ -373,13 +361,7 @@ } // Identify the internal container resources we need -//Wrapper wrapper = (Wrapper) getServletConfig(); -//context = (Context) wrapper.getParent(); - context = config.getServletContext(); -if (debug >= 1) { -//log("init: Associated with Context '" + context.getPath() + "'"); -} } 1.4 +0 -3 jakarta-tomcat-4.0/webapps/tomcat-docs/cgi-howto.xml Index: cgi-howto.xml === RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/tomcat-docs/cgi-howto.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- cgi-howto.xml 19 Feb 2004 21:38:50 - 1.3 +++ cgi-howto.xml 16 Aug 2004 22:29:34 - 1.4 @@ -52,9 +52,6 @@ cgiPathPrefix - The CGI search path will start at the web application root directory + File.separator + this prefix. The default cgiPathPrefix is /WEB-INF/cgi -clientInputTimeout - The time (in milliseconds) to -wait for input from the browser before assuming that there is none. -Default is 100 seconds. debug - Debugging detail level for messages logged by this servlet. Default 0. executable - The of the executable to be used to - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-4.0/webapps/tomcat-docs cgi-howto.xml
markt 2004/02/19 13:38:50 Modified:catalina/src/conf web.xml catalina/src/share/org/apache/catalina/servlets CGIServlet.java webapps/tomcat-docs cgi-howto.xml Log: Fix bug 27090. Make parameter encoding configurable. Default remains as is. Update docs. Add executable paramater to docs. Port from TC5. Revision ChangesPath 1.53 +4 -0 jakarta-tomcat-4.0/catalina/src/conf/web.xml Index: web.xml === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/conf/web.xml,v retrieving revision 1.52 retrieving revision 1.53 diff -u -r1.52 -r1.53 --- web.xml 10 Dec 2003 22:15:03 - 1.52 +++ web.xml 19 Feb 2004 21:38:49 - 1.53 @@ -244,6 +244,10 @@ + + + + 1.19 +14 -9 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/CGIServlet.java Index: CGIServlet.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/CGIServlet.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- CGIServlet.java 16 Feb 2004 23:41:54 - 1.18 +++ CGIServlet.java 19 Feb 2004 21:38:49 - 1.19 @@ -314,6 +314,10 @@ /** the executable to use with the script */ private String cgiExecutable = "perl"; +/** the encoding to use for parameters */ +private String parameterEncoding = System.getProperty("file.encoding", + "UTF-8"); + /** object used to ensure multiple threads don't try to expand same file */ static Object expandFileLock = new Object(); @@ -768,7 +772,8 @@ String param = paramNames.nextElement().toString(); if (param != null) { queryParameters.put( -param, URLEncoder.encode(req.getParameter(param))); +param, URLEncoder.encode(req.getParameter(param), + parameterEncoding)); } } @@ -1664,7 +1669,7 @@ if ((k.indexOf("=") < 0) && (v.indexOf("=") < 0)) { StringBuffer arg = new StringBuffer(k); arg.append("="); -v = java.net.URLEncoder.encode(v); +v = java.net.URLEncoder.encode(v, parameterEncoding); arg.append(v); if (arg.toString().indexOf(" ") < 0) { cmdAndArgs.append(arg); 1.3 +5 -0 jakarta-tomcat-4.0/webapps/tomcat-docs/cgi-howto.xml Index: cgi-howto.xml === RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/tomcat-docs/cgi-howto.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- cgi-howto.xml 12 Jan 2003 17:26:46 - 1.2 +++ cgi-howto.xml 19 Feb 2004 21:38:50 - 1.3 @@ -57,6 +57,11 @@ Default is 100 seconds. debug - Debugging detail level for messages logged by this servlet. Default 0. +executable - The of the executable to be used to +run the script. Default is perl. +parameterEncoding - Name of the parameter encoding +to be used with the GCI servlet. Default is +System.getProperty("file.encoding","UTF-8"). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]