[jboss-remoting-commits] JBoss Remoting SVN: r4477 - remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/http.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Fri Aug 8 01:27:13 EDT 2008


Author: ron.sigal at jboss.com
Date: 2008-08-08 01:27:12 -0400 (Fri, 08 Aug 2008)
New Revision: 4477

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/http/HTTPUnMarshaller.java
Log:
JBREM-1006: read() checks for transfer-encoding=chunked, and, if so, doesn't apply byteOutputStream.size() > contentLength test while reading from inputStream.

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/http/HTTPUnMarshaller.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/http/HTTPUnMarshaller.java	2008-08-07 23:52:28 UTC (rev 4476)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/http/HTTPUnMarshaller.java	2008-08-08 05:27:12 UTC (rev 4477)
@@ -82,6 +82,7 @@
       byte[] byteBuffer = new byte[bufferSize];
       ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream();
       boolean preserveLines = false;
+      boolean isChunked = false;
 
       // check the metadat to see if is entry for content length
       if(metadata != null)
@@ -126,6 +127,12 @@
                preserveLines = Boolean.valueOf((String) value).booleanValue();
             }
          }
+         
+         value = metadata.get("transfer-encoding");
+         if (value instanceof String && "chunked".equalsIgnoreCase((String)value))
+         {
+            isChunked = true;
+         }
       }
 
       int pointer = 0;
@@ -133,7 +140,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