tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 37285] - POST of document through CGI
Date Mon, 02 Jan 2006 18:02:52 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=37285>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=37285





------- Additional Comments From rdevenezia@wildblue.net  2006-01-02 19:02 -------
Part of the problem is that CGIRunner.run has to deal with the feature of 
HttpServlet that does _not_ discriminate between POST and GET.

I recall reading in passing somewhere, that HttpServlet will parse the POST 
contents into an internal data structure for enumeration via getParameterNames 
and retrieval via getParameterValue, if and only if the CONTENT_TYPE 
is "application/x-www-form-urlencoded".  This act will likely drain the stdin 
and lose whatever original content was there.

Additionally, the parameters parsed from the GET QUERY_STRING are thrown into 
the getParameterNames mix.


In run(), when POST is observed, 
1. stdin is read into a buffer named content.  I speculated stdin is pre-
drained if content type is urlencoded.
2. the HttpServlet parameters are written to the stream (S) that will be the 
cgis stdin.
3. the 'content' buffer is appended to S {buffer is empty if urlencoded and the 
whole thing if multipart form}

One problem I see is that content length is not increased when content buffer 
is written.  Maybe it gets measured elsewhere?

My original foray into this bug is due to that fact I am deploying a cgi app 
(YaBB) that does not use standard parameter separators -- it's legacy nature 
has parameters being separated by & or ; .

The cgi app was not getting the parameters it needed because HttpServlet 
encoded or escaped the semis and subsequent equals to their equivalent %{nn} 
forms.  Since I can't recall the code numbers I'll use %.. For example: 
foo.pl?a=1&b=2;c=3;d=4
got HttpServlet parsed into parameters
a=1
b=2%..c%..3%..d%..4

Things would be much cleaner if (presumably) HttpServlet did not automatically 
drain stdin, and then CGIServelt could output verbatim the POST contents to the 
cgis stdin and not fool around with looping over parsed out parameters.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message