You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2016/11/21 22:28:11 UTC
[Bug 60400] New: HttpServletRequest.getReader doesn't correctly read
data
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: clement@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 60400] HttpServletRequest.getReader doesn't correctly read data
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60400
Violeta Georgieva <vi...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from Violeta Georgieva <vi...@apache.org> ---
Hi,
The issue was the following:
In some cases the buffer used for the request data needs to be expanded. The
read position after the expansion was not returned to the correct one.
This has been fixed in
- 9.0.x for 9.0.0.M14 onwards and
- 8.5.x for 8.5.9 onwards
Regard,
Violeta
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 60400] HttpServletRequest.getReader doesn't correctly read data
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60400
--- Comment #1 from Violeta Georgieva <vi...@apache.org> ---
Hi,
I was not able to reproduce the issue with the provided example.
I received:
- input with size 12289
- output with size 12302. The output contains two rows:
- the first one contains information for the input and output size: 12289
12289
- the second one contains the input that was sent.
If I remove the first line then the both files are identical.
Regards,
Violeta
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 60400] HttpServletRequest.getReader doesn't correctly read data
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60400
--- Comment #3 from Violeta Georgieva <vi...@apache.org> ---
Thanks,
I reproduced the issue.
I'll update the issue with my findings later.
Regards,
Violeta
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 60400] HttpServletRequest.getReader doesn't correctly read data
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60400
--- Comment #2 from clement@guillaume.bzh ---
Created attachment 34466
--> https://bz.apache.org/bugzilla/attachment.cgi?id=34466&action=edit
server configuration
Here is what I get:
-rw-r--r-- 1 cguillaume cguillaume 12289 Nov 22 10:30 input
-rw-r--r-- 1 cguillaume cguillaume 21302 Nov 22 10:30 output
First line: 12289 21289
It seems to happen only when using the apr connector. I attached my server.xml.
The apr version I'm using is:
INFO: Loaded APR based Apache Tomcat Native library 1.2.10 using APR version
1.5.2.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org