When posting utf-8 data with either \r\n or \n and that data exceeds the MAX_LINE_LENGTH the following I/O exception occurs: Servlet threw exception java.io.IOException at org.apache.coyote.tomcat5.InputBuffer.reset(InputBuffer.java:463) at org.apache.coyote.tomcat5.CoyoteReader.reset(CoyoteReader.java:153) at org.apache.coyote.tomcat5.CoyoteReader.readLine (CoyoteReader.java:207) at symhttp.DBRActivationServlet.doPost(DBRActivationServlet.java:31) at javax.servlet.http.HttpServlet.service(HttpServlet.java:763) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:284) at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:204) at org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:257) at org.apache.catalina.core.StandardValveContext.invokeNext (StandardValveContext.java:151) at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:567) at org.apache.catalina.core.StandardContextValve.invokeInternal (StandardContextValve.java:245) at org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:199) at org.apache.catalina.core.StandardValveContext.invokeNext (StandardValveContext.java:151) at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:567) at org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:184) at org.apache.catalina.core.StandardValveContext.invokeNext (StandardValveContext.java:151) at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:164) at org.apache.catalina.core.StandardValveContext.invokeNext (StandardValveContext.java:149) at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:567) at org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:156) at org.apache.catalina.core.StandardValveContext.invokeNext (StandardValveContext.java:151) at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:567) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972) at org.apache.coyote.tomcat5.CoyoteAdapter.service (CoyoteAdapter.java:206) at org.apache.coyote.http11.Http11Processor.process (Http11Processor.java:833) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnectio n(Http11Protocol.java:732) at org.apache.tomcat.util.net.TcpWorkerThread.runIt (PoolTcpEndpoint.java:619) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run (ThreadPool.java:688) at java.lang.Thread.run(Thread.java:536) If there are NO \r\n or \n then there is no problem sending data greater than MAX_LINE_LENGTH. Here is my servlet test code:public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType(CONTENT_TYPE); System.out.println("Reading body data\n"); String contentLen = request.getHeader("Content-Length"); if ( contentLen != null ) { System.out.println("String Content-Length: " + contentLen); BufferedReader br = request.getReader(); String in = null; while ( (in = br.readLine()) != null ){ System.out.println(in); } } else { System.out.println("Null content-length"); } PrintWriter out = response.getWriter(); sendStuff(out); } //Clean up resources public void destroy() { } I think the problem area is in CoyoteReader.readLine() and the handling of \n and \r\n. This seems to be around lines 178 - 194 of org.apache.coyote.tomcat5.CoyoteReader.java. Problem occurred first in 5.0.16, did an upgrade and still had the problem in 5.0.19, tried it in some version of Tomcat 4 and had no problems.
I will try to fix this. I recommend however that you attempt to design stuff more efficiently. Your web application is very likely slow.
The bug is likely fixed, but this could cause regressions. Please test it.
Thanks for the speedy work, but the problem still exists. I have attached 6 test files and a simple test servlet. If I send these test files using our http client or the curl http client the results are the same. The curl command line I use is: curl -F "name=@postBigLine.txt" http://localhost:8082/Test/TestServlet Thanks
Created attachment 10712 [details] These are some files with text to test. We actually use XML, but these should suffice