cgi-servlet environment parameters
Good morning. I'm working with Tomcat 4.1.31 and am trying to catch 500 errors for custom error pages. We host around 400 portals in one instance (kudos to the developers, by the way, it runs great!) The idea is that the Perl script would create a site on the fly with little content in the event of a 500. The original request, then, would be something akin to http://mydomain.com/portal_a/index.jsp. I've got the cgi-servlet set up to run a Perl script and have created a simple JSP that returns response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR) to create the 500 for testing. The Perl script is set to pick up the original URL requested and return some content specific for portal_a. However, the environment does not seem to contain the URL of the original request (i.e., REQUEST_URI or PATH_INFO), as below: runCGI(envp=[{HTTP_USER_AGENT=Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7, HTTP_ACCEPT_ENC DING=gzip,deflate, REQUEST_METHOD=GET, AUTH_TYPE=, HTTP_ACCEPT_LANGUAGE=en-us,e ;q=0.5, SERVER_NAME=harrier.mesas.com, SERVER_SOFTWARE=TOMCAT, HTTP_KEEP_ALIVE= 00, HTTP_ACCEPT_CHARSET=ISO-8859-1,utf-8;q=0.7,*;q=0.7, HTTP_HOST=harrier.mesas com:3233, GATEWAY_INTERFACE=CGI/1.1, X_TOMCAT_SCRIPT_PATH=/private-1/portal/pro uction35/www/500.cgi, REMOTE_ADDR=10.20.2.65, SERVER_PROTOCOL=HTTP/1.1, PATH_IN O=, REMOTE_HOST=kengibson100625.mesas.mis, QUERY_STRING=var1=2, HTTP_CONNECTION keep-alive, SERVER_PORT=3233, HTTP_COOKIE=JSESSIONID=5065D8892D6F8D0FD891483596 283A5, CONTENT_TYPE=, CONTENT_LENGTH=, HTTP_ACCEPT=text/xml,application/xml,app ication/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5, SCRIPT_ AME=/cgi-bin/500.cgi, REMOTE_USER=, REMOTE_IDENT=}], command=/private-1/portal/ roduction35/www/500.cgi) Oddly, adding bogus parameters to the end of the request (var1=2) gets passed to the cgi-servlet in the QUERY_STRING parameter. Any help in finding the original request is greatly appreciated. Thanks Ken
Re: cgi-servlet environment parameters
Ken Gibson wrote: However, the environment does not seem to contain the URL of the original request (i.e., REQUEST_URI or PATH_INFO), as below: Looking at the 4.1.31 source, PATH_INFO should be there but REQUEST_URI is never set. Mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: cgi-servlet environment parameters
Thanks for the quick response. Is there a way to configure the cgi-servlet that I've missed? The PATH_INFO variable is null in my scenario; I've split it out from the other parameters below... runCGI(envp=[{HTTP_USER_AGENT=Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7, HTTP_ACCEPT_ENC DING=gzip,deflate, REQUEST_METHOD=GET, AUTH_TYPE=, HTTP_ACCEPT_LANGUAGE=en-us,e ;q=0.5, SERVER_NAME=harrier.mesas.com, SERVER_SOFTWARE=TOMCAT, HTTP_KEEP_ALIVE= 00, HTTP_ACCEPT_CHARSET=ISO-8859-1,utf-8;q=0.7,*;q=0.7, HTTP_HOST=harrier.mesas com:3233, GATEWAY_INTERFACE=CGI/1.1, X_TOMCAT_SCRIPT_PATH=/private-1/portal/pro uction35/www/500.cgi, REMOTE_ADDR=10.20.2.65, SERVER_PROTOCOL=HTTP/1.1, PATH_INFO=, REMOTE_HOST=kengibson100625.mesas.mis, QUERY_STRING=var1=2, HTTP_CONNECTION keep-alive, SERVER_PORT=3233, HTTP_COOKIE=JSESSIONID=5065D8892D6F8D0FD891483596 283A5, CONTENT_TYPE=, CONTENT_LENGTH=, HTTP_ACCEPT=text/xml,application/xml,app ication/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5, SCRIPT_ AME=/cgi-bin/500.cgi, REMOTE_USER=, REMOTE_IDENT=}], command=/private-1/portal/ roduction35/www/500.cgi) Since this is an older version of Tomcat, would you suggest a local mod to force the PATH_INFO and/or REQUEST_URI? Unfortunately, upgrading isn't really an option. Thanks in advance for your help. Ken - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cgi-servlet environment parameters
Ken Gibson wrote: Thanks for the quick response. Is there a way to configure the cgi-servlet that I've missed? The PATH_INFO variable is null in my scenario; I've split it out from the other parameters below... I have just added REQUEST_URI to svn. I have also ported a couple of patches from TC5. You could build it from source but to save you the trouble I'll e-mail you a completely unofficial if it destroys your computer you are on your own updated servlets-cgi.jar directly. I suspect that the PATH_INFO is correctly null. It depends how the cgi is called. Are you using a forward? If so, you may have hit the requirements of SRV.8.4 which mean you see the PATH_INFO of the request to the CGI, not the PATH_INFO of the original request. Mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]