tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anantaneni Harish <anantaneni.har...@vertexsoft.com>
Subject RE: cannot read complete HTTP request body. It reads only 8192 characters
Date Tue, 01 Nov 2011 11:31:02 GMT
Dear Kolinko,

Thanks for the link below. 
I have seen this resolution before.
But the tomcat version is not applicable. I was wondering what else might cause this issue.

The exact issue is that only 8192 bytes of POST request are read, when using below code.

> BufferedReader in = request.getReader();
> while ((keyValuePair = in.readLine()) != null) {
> arrKeyValue = keyValuePair.split("=");

Same code reads whole data within one environment and reads only 8192 bytes in other environment.

All the software versions in both environments are same. 

Only diff is that they physically 2 different hardware servers. I am sure some setting must
be different. Would like to know, which is that setting to cause this issue.

Thanks and Regards,
Harish 
-----Original Message-----
From: Konstantin Kolinko [mailto:knst.kolinko@gmail.com] 
Sent: Tuesday, November 01, 2011 7:45 PM
To: Tomcat Users List
Subject: Re: cannot read complete HTTP request body. It reads only 8192 characters

2011/10/31 Anantaneni Harish <anantaneni.harish@vertexsoft.com>:
> String keyValuePair = null;
> String[] arrKeyValue = null;
> BufferedReader in = request.getReader();
> while ((keyValuePair = in.readLine()) != null) {
> arrKeyValue = keyValuePair.split("=");
>
> Above code reads incomplete data(read only 8192 bytes) at my customer's environment,
but reads complete data in my environment.
>
> String keyValuePair = null;
> String[] arrKeyValue = null;
> BufferedReader in = new BufferedReader(new InputStreamReader(request.getInputStream()));
> while ((keyValuePair = in.readLine()) != null) {
> arrKeyValue = keyValuePair.split("=");
>
> Above code reads complete data in both the environments. *no changes done to customer's
environment.
>
> I hope you can help me now by finding the reason for data lost at my customer's environment
when using request.getReader().
>
> Thanks and Regards,
> Harish
>

The code looks OK.
The readLine() implementation is provided by
org.apache.catalina.connector.CoyoteReader.

Looking at the history of that class, there is a known issue
https://issues.apache.org/bugzilla/show_bug.cgi?id=42727
"CoyoteReader readLine returns null for some post request bodies that
are a multiple of MAX_LINE_LENGTH in size"

but it should have been fixed in 5.5.27 and thus in 5.5.28 if that is
the version that your customer is using.

Best regards,
Konstantin Kolinko

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


Mime
View raw message