Index: CGIServlet.java =================================================================== --- CGIServlet.java (revision 478279) +++ CGIServlet.java (working copy) @@ -807,30 +807,22 @@ this.pathInfo = this.servletPath; } - // If request is HEAD or GET and Query String does not contain - // an unencoded "=" this is an indexed query. Parsed Query String - // forms command line parameters for cgi command. - if (!"GET".equals(req.getMethod()) && - !"HEAD".equals(req.getMethod())) - return; - - String qs = req.getQueryString(); - - if (qs == null || qs.indexOf("=")>0) - return; - - int delimIndex = 0; - int lastDelimIndex = 0; - delimIndex = qs.indexOf("+"); - - while (delimIndex >0) { - cmdLineParameters.add(URLDecoder.decode(qs.substring( - lastDelimIndex,delimIndex),parameterEncoding)); - lastDelimIndex = delimIndex + 1; - delimIndex = qs.indexOf("+",lastDelimIndex); + // If the request method is GET, POST or HEAD and the query string + // does not contain an unencoded "=" this is an indexed query. + // The parsed query string becomes the command line parameters + // for the cgi command. + if (req.getMethod().equals("GET") + || req.getMethod().equals("POST") + || req.getMethod().equals("HEAD")) { + String qs = req.getQueryString(); + if (qs != null && qs.indexOf("=") == -1) { + StringTokenizer qsTokens = new StringTokenizer(qs, "+"); + while ( qsTokens.hasMoreTokens() ) { + cmdLineParameters.add(URLDecoder.decode(qsTokens.nextToken(), + parameterEncoding)); + } + } } - cmdLineParameters.add(URLDecoder.decode(qs.substring( - lastDelimIndex),parameterEncoding)); }