https://bz.apache.org/bugzilla/show_bug.cgi?id=60400

            Bug ID: 60400
           Summary: HttpServletRequest.getReader doesn't correctly read
                    data
           Product: Tomcat 8
           Version: 8.5.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: clem...@guillaume.bzh
  Target Milestone: ----

The HttpServletRequest.getReader doesn't correctly read large entity and
returns more data than expected.
This happens only with version 8.5.8 (working fine on 8.5.6).
I was able to reproduce this with a really simple web app where the issue is
occurring for entity larger that 12288 characters.

@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws
IOException{
        StringBuilder builder = new StringBuilder();
        try(BufferedReader reader = req.getReader()){
                String line;
                while((line = reader.readLine()) != null){
                        builder.append(line);
                }
        }
        resp.getWriter().println(req.getContentLength() + " " +
builder.length());
        resp.getWriter().println(builder);
}

Then I use this command and I'm able to compare input and parsed data:
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 12289 > input && curl -X POST
http://localhost:8080/example -d @input > output

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to