Re: Improving CGIServlet - path and args to the executable
On 18/01/2011 16:19, Konstantin Kolinko wrote: > So I think of the following: > 1. Allow empty value of "executable" init-param +1. We can just drop that element from the String[] > 2. Introduce additional init-params to explicitly specify additional > arguments: > "executable-arg-1" > "executable-arg-2" > etc. starting with "1" +1. I assume you'd do this in a loop looking for executable-arg-N starting with N=1 and incrementing until the parameter didn't exist. > What do you think? Go for it. Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Improving CGIServlet - path and args to the executable
On 18 January 2011 19:48, Konstantin Kolinko wrote: > 2011/1/18 sebb : >> >> The empty string is assumed to be "perl", according to: >> > > No. Absence of this init-param is what will be "perl". > > Setting it explicitly overwrites the default. > > if (getServletConfig().getInitParameter("executable") != null) { > cgiExecutable = getServletConfig().getInitParameter("executable"); > } I see, perhaps the docs could make this more obvious? >>> So cmd /q /c will be written as >>> >>> >>> executable >>> cmd.exe >>> >>> >>> executable-arg-1 >>> /q >>> >>> >>> executable-arg-2 >>> /c >>> >>> >>> What do you think? >> >> Ant has a nicer format: >> >> >> >> >> >> > > That above was a part of web.xml. Maybe you mean "arg-1", "arg-2" etc > (instead of "executable-arg-1")? No, I meant that the Ant format is much easier to use, and could perhaps be added to web.xml. Instead of executable cmd.exe executable-arg-1 /q executable-arg-2 /c you would allow: which is very much simpler Or perhaps extend param to allow multiple values: executable cmd.exe /q /c But maybe they would both be too hard to add to the current XML syntax. And both assume that ordering is preserved when parsing multiple tags with the same name. > > Best regards, > Konstantin Kolinko > > - > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > > - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Improving CGIServlet - path and args to the executable
2011/1/18 sebb : > > The empty string is assumed to be "perl", according to: > No. Absence of this init-param is what will be "perl". Setting it explicitly overwrites the default. if (getServletConfig().getInitParameter("executable") != null) { cgiExecutable = getServletConfig().getInitParameter("executable"); } >> So cmd /q /c will be written as >> >> >> executable >> cmd.exe >> >> >> executable-arg-1 >> /q >> >> >> executable-arg-2 >> /c >> >> >> What do you think? > > Ant has a nicer format: > > > > > > That above was a part of web.xml. Maybe you mean "arg-1", "arg-2" etc (instead of "executable-arg-1")? Best regards, Konstantin Kolinko - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Improving CGIServlet - path and args to the executable
On 18 January 2011 16:19, Konstantin Kolinko wrote: > Hi! > > In 6.0.30 to fix BZ 49657 we changed the way how cgi command is built > in CGI Servlet: > http://svn.apache.org/viewvc?view=revision&revision=1004424 > > Earlier implementation used to build the command as a single string, > wrapping parts of it in double quotes. The new implementation uses > Runtime.exec(String[]) and passes all arguments separate from each > other as an array. > > This causes regression for people using empty value for "executable" > init-param, as reported in > https://issues.apache.org/bugzilla/show_bug.cgi?id=50606 > > I closed BZ 50606 as INVALID but now I am changing my mind. Looking around > > 1) there are sites that recommend using an empty string for "executable" > http://stackoverflow.com/questions/499456/cgi-and-tomcat/500527#500527 > > Apparently it is to run programs that themselves are executables, as > *.exe on Windows. The empty string is assumed to be "perl", according to: http://tomcat.apache.org/tomcat-6.0-doc/cgi-howto.html#Configuration and http://tomcat.apache.org/tomcat-7.0-doc/cgi-howto.html#Configuration which says: "executable - The of the executable to be used to run the script. Default is perl." (sic) BTW: s/The of/The name of/ > 2) some put in arguments for the executable, as "cmd /q /c" > http://webcache.googleusercontent.com/search?q=cache:njmdNKdXzNMJ:www.tek-tips.com/faqs.cfm%3Ffid%3D6467 > (Should be http://www.tek-tips.com/faqs.cfm?fid=6467 but the original > site is inaccessible now). > > I do not like to revert r1004424 and bother with quotes, nor I want to > parse "executable" into separate strings. > So I think of the following: > 1. Allow empty value of "executable" init-param See above. > 2. Introduce additional init-params to explicitly specify additional > arguments: > "executable-arg-1" > "executable-arg-2" > etc. starting with "1" > > So cmd /q /c will be written as > > > executable > cmd.exe > > > executable-arg-1 > /q > > > executable-arg-2 > /c > > > What do you think? Ant has a nicer format: This would be tricky to fit into the existing scheme, but something similar could perhaps be added as an alternative to the current scheme? I.e. leave the existing scheme (and don't bother trying to deal with quotes), and add the new scheme for handling parameters properly. > Best regards, > Konstantin Kolinko > > - > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > > - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org