[jboss-remoting-commits] JBoss Remoting SVN: r4580 - remoting2/branches/2.2/src/main/org/jboss/remoting/marshal/http.
jboss-remoting-commits at lists.jboss.org
jboss-remoting-commits at lists.jboss.org
Wed Oct 1 01:52:02 EDT 2008
Author: ron.sigal at jboss.com
Date: 2008-10-01 01:52:02 -0400 (Wed, 01 Oct 2008)
New Revision: 4580
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/marshal/http/HTTPUnMarshaller.java
Log:
JBREM-1037: read() checks for transfer-encoding=chunked, and, if so, doesn't apply byteOutputStream.size() > contentLength test while reading from inputStream.
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/marshal/http/HTTPUnMarshaller.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/marshal/http/HTTPUnMarshaller.java 2008-09-25 17:36:55 UTC (rev 4579)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/marshal/http/HTTPUnMarshaller.java 2008-10-01 05:52:02 UTC (rev 4580)
@@ -79,6 +79,7 @@
int bufferSize = 1024;
byte[] byteBuffer = new byte[bufferSize];
ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream();
+ boolean isChunked = false;
// check the metadat to see if is entry for content length
if(metadata != null)
@@ -114,6 +115,12 @@
log.warn("Can not get Content-Length from header for http unmarshalling.");
}
}
+
+ value = metadata.get("transfer-encoding");
+ if (value instanceof String && "chunked".equalsIgnoreCase((String)value))
+ {
+ isChunked = true;
+ }
}
int pointer = 0;
@@ -121,7 +128,7 @@
while(amtRead > 0)
{
byteOutputStream.write(byteBuffer, pointer, amtRead);
- if(amtRead < bufferSize && byteOutputStream.size() >= contentLength)
+ if(!isChunked && (amtRead < bufferSize && byteOutputStream.size() >= contentLength))
{
//done reading, so process
break;
More information about the jboss-remoting-commits
mailing list