From 74b4b72cfc6ae6e61b2a50ba8ef89ed6d880c997 Mon Sep 17 00:00:00 2001 From: billbarker Date: Thu, 14 Jun 2007 01:56:16 +0000 Subject: [PATCH] Porting large-file support for the AJP Connectors from 5.5 git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@547078 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/coyote/ajp/AjpAprProcessor.java | 6 ++++-- java/org/apache/coyote/ajp/AjpProcessor.java | 6 ++++-- java/org/apache/jk/common/HandlerRequest.java | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/java/org/apache/coyote/ajp/AjpAprProcessor.java b/java/org/apache/coyote/ajp/AjpAprProcessor.java index 786b32943..72c9d78a1 100644 --- a/java/org/apache/coyote/ajp/AjpAprProcessor.java +++ b/java/org/apache/coyote/ajp/AjpAprProcessor.java @@ -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; diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java b/java/org/apache/coyote/ajp/AjpProcessor.java index 5f4a3a3f0..7f7e85330 100644 --- a/java/org/apache/coyote/ajp/AjpProcessor.java +++ b/java/org/apache/coyote/ajp/AjpProcessor.java @@ -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; diff --git a/java/org/apache/jk/common/HandlerRequest.java b/java/org/apache/jk/common/HandlerRequest.java index 828bd99c8..ead0bbdb6 100644 --- a/java/org/apache/jk/common/HandlerRequest.java +++ b/java/org/apache/jk/common/HandlerRequest.java @@ -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 -- 2.11.0