In addition to bug 32429, there are other issues I found with the CGI servlet.
There was a type-o in sending the content to the process, a problem with
printing debug output, and a problem processing large content. The large
content issue is the big one.
The problem is the existing 4.1.31 code is this:
int lenRead = stdin.read(content);
when it should be in some sort of read loop to ensure all the data is read.
I don't know if fix I did to the toString() and blanksToString() is valid, but
I was repeatedly getting:
java.lang.ClassCastException
at dsi.app.tomcat.DCGIServlet$CGIEnvironment.toString
(DCGIServlet.java:1241)
at dsi.app.tomcat.DCGIServlet.doGet(DCGIServlet.java:596)
at dsi.app.tomcat.DCGIServlet.doPost(DCGIServlet.java:544)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
...
Attached is the file I made to fix the issues we were having. It is based on
the 4.1.31 source code and a diff with tell what changes I made. The 5.0.28
source looks similar to the 4.1 source and so will have the problem as well.

Everything but the toString() issue has been fixed as a result of fixing other
bugs. Fix for this has been applied to 4.1.x and 5.5.x
The root cause of the cast exception is at line 1710 (for CVS revision 1.31 in
TC4.1.x) where the content length is added as an integer rather than as a
string. I have fixed the root cause rather than apply your toString() changes.
Thanks again for your CGI bug reports. If you find any more, let us know.

This is ASF Bugzilla: the Apache Software Foundation bug system. In case
of problems with the functioning of ASF Bugzilla, please contact
bugzilla-admin@apache.org.
Please Note: this e-mail address is only for reporting problems
with ASF Bugzilla. Mail about any other subject will be silently
ignored.