Porting large-file support for the AJP Connectors from 5.5
authorbillbarker <billbarker@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 14 Jun 2007 02:55:26 +0000 (02:55 +0000)
committerbillbarker <billbarker@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 14 Jun 2007 02:55:26 +0000 (02:55 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@547096 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/coyote/ajp/AjpAprProcessor.java
java/org/apache/coyote/ajp/AjpProcessor.java
java/org/apache/jk/common/HandlerRequest.java

index 786b329..72c9d78 100644 (file)
@@ -680,7 +680,9 @@ public class AjpAprProcessor implements ActionHook {
             if (hId == Constants.SC_REQ_CONTENT_LENGTH ||
                     (hId == -1 && tmpMB.equalsIgnoreCase("Content-Length"))) {
                 // just read the content-length header, so set it
-                request.setContentLength( vMB.getInt() );
+                long cl = vMB.getLong();
+                if(cl < Integer.MAX_VALUE)
+                    request.setContentLength( (int)cl );
             } else if (hId == Constants.SC_REQ_CONTENT_TYPE ||
                     (hId == -1 && tmpMB.equalsIgnoreCase("Content-Type"))) {
                 // just read the content-type header, so set it
@@ -1204,7 +1206,7 @@ public class AjpAprProcessor implements ActionHook {
             if (endOfStream) {
                 return -1;
             }
-            if (first && req.getContentLength() > 0) {
+            if (first && req.getContentLengthLong() > 0) {
                 // Handle special first-body-chunk
                 if (!receive()) {
                     return 0;
index 5f4a3a3..7f7e853 100644 (file)
@@ -688,7 +688,9 @@ public class AjpProcessor implements ActionHook {
             if (hId == Constants.SC_REQ_CONTENT_LENGTH ||
                     (hId == -1 && tmpMB.equalsIgnoreCase("Content-Length"))) {
                 // just read the content-length header, so set it
-                request.setContentLength( vMB.getInt() );
+                long cl = vMB.getLong();
+                if(cl < Integer.MAX_VALUE)
+                    request.setContentLength( (int)cl );
             } else if (hId == Constants.SC_REQ_CONTENT_TYPE ||
                     (hId == -1 && tmpMB.equalsIgnoreCase("Content-Type"))) {
                 // just read the content-type header, so set it
@@ -1144,7 +1146,7 @@ public class AjpProcessor implements ActionHook {
             if (endOfStream) {
                 return -1;
             }
-            if (first && req.getContentLength() > 0) {
+            if (first && req.getContentLengthLong() > 0) {
                 // Handle special first-body-chunk
                 if (!receive()) {
                     return 0;
index 828bd99..3dc5db8 100644 (file)
@@ -407,7 +407,7 @@ public class HandlerRequest extends JkHandler
 
         // Check to see if there should be a body packet coming along
         // immediately after
-        int cl=req.getContentLength();
+        long cl=req.getContentLengthLong();
         if(cl > 0) {
             JkInputStream jkIS = ep.getInputStream();
             jkIS.setIsReadRequired(true);
@@ -577,7 +577,9 @@ public class HandlerRequest extends JkHandler
             if (hId == AjpConstants.SC_REQ_CONTENT_LENGTH ||
                 (hId == -1 && tmpMB.equalsIgnoreCase("Content-Length"))) {
                 // just read the content-length header, so set it
-                req.setContentLength( vMB.getInt() );
+                long cl = vMB.getLong();
+                if(cl < Integer.MAX_VALUE)
+                    req.setContentLength( (int)cl );
             } else if (hId == AjpConstants.SC_REQ_CONTENT_TYPE ||
                 (hId == -1 && tmpMB.equalsIgnoreCase("Content-Type"))) {
                 // just read the content-type header, so set it