keith 2005/02/09 21:25:42 Modified: http11/src/java/org/apache/coyote/http11/filters Tag: TOMCAT_5_0 IdentityOutputFilter.java coyote/src/java/org/apache/coyote Tag: TOMCAT_5_0 Response.java util/java/org/apache/tomcat/util/buf Tag: TOMCAT_5_0 MessageBytes.java http11/src/java/org/apache/coyote/http11 Tag: TOMCAT_5_0 Http11Processor.java Log: Port fix from Mark Thomas for better Content-Length handling into the _5_0 branch PR: 32585 Revision Changes Path No revision No revision 1.7.2.1 +1 -1 jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java Index: IdentityOutputFilter.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -u -r1.7 -r1.7.2.1 --- IdentityOutputFilter.java 24 Feb 2004 08:50:55 -0000 1.7 +++ IdentityOutputFilter.java 10 Feb 2005 05:25:41 -0000 1.7.2.1 @@ -141,7 +141,7 @@ * after the response header processing is complete. */ public void setResponse(Response response) { - contentLength = response.getContentLength(); + contentLength = response.getContentLengthLong(); remaining = contentLength; } No revision No revision 1.32.2.1 +11 -2 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Response.java Index: Response.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Response.java,v retrieving revision 1.32 retrieving revision 1.32.2.1 diff -u -r1.32 -r1.32.2.1 --- Response.java 24 Feb 2004 08:54:29 -0000 1.32 +++ Response.java 10 Feb 2005 05:25:41 -0000 1.32.2.1 @@ -100,7 +100,7 @@ protected String contentType = null; protected String contentLanguage = null; protected String characterEncoding = Constants.DEFAULT_CHARACTER_ENCODING; - protected int contentLength = -1; + protected long contentLength = -1; private Locale locale = DEFAULT_LOCALE; // General informations @@ -529,7 +529,16 @@ } public int getContentLength() { - return contentLength; + long length = getContentLengthLong(); + + if (length < Integer.MAX_VALUE) { + return (int) length; + } + return -1; + } + + public long getContentLengthLong() { + return contentLength; } No revision No revision 1.14.2.2 +42 -0 jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/MessageBytes.java Index: MessageBytes.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/MessageBytes.java,v retrieving revision 1.14.2.1 retrieving revision 1.14.2.2 diff -u -r1.14.2.1 -r1.14.2.2 --- MessageBytes.java 25 Aug 2004 20:44:15 -0000 1.14.2.1 +++ MessageBytes.java 10 Feb 2005 05:25:41 -0000 1.14.2.2 @@ -579,6 +579,48 @@ type=T_BYTES; } + /** Set the buffer to the representation of an long + */ + public void setLong(long l) { + byteC.allocate(32, 64); + long current = l; + byte[] buf = byteC.getBuffer(); + int start = 0; + int end = 0; + if (l == 0) { + buf[end++] = (byte) '0'; + } + if (l < 0) { + current = -l; + buf[end++] = (byte) '-'; + } + while (current > 0) { + int digit = (int) (current % 10); + current = current / 10; + buf[end++] = HexUtils.HEX[digit]; + } + byteC.setOffset(0); + byteC.setEnd(end); + // Inverting buffer + end--; + if (l < 0) { + start++; + } + while (end > start) { + byte temp = buf[start]; + buf[start] = buf[end]; + buf[end] = temp; + start++; + end--; + } + longValue=l; + hasStrValue=false; + hasHashCode=false; + hasIntValue=false; + hasLongValue=true; + hasDateValue=false; + type=T_BYTES; + } /** * @deprecated The buffer are general purpose, caching for headers should No revision No revision 1.100.2.3 +2 -2 jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java Index: Http11Processor.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java,v retrieving revision 1.100.2.2 retrieving revision 1.100.2.3 diff -u -r1.100.2.2 -r1.100.2.3 --- Http11Processor.java 12 Sep 2004 20:39:12 -0000 1.100.2.2 +++ Http11Processor.java 10 Feb 2005 05:25:41 -0000 1.100.2.3 @@ -1461,10 +1461,10 @@ } } - int contentLength = response.getContentLength(); + long contentLength = response.getContentLengthLong(); if (contentLength != -1) { response.getMimeHeaders().setValue("Content-Length") - .setInt(contentLength); + .setLong(contentLength); outputBuffer.addActiveFilter (outputFilters[Constants.IDENTITY_FILTER]); contentDelimitation = true;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]