OK, checked this in.

Thanks for the patch :)

Oliver

Chris Sharp wrote:

Hmm. Patch seems to have been stripped off. Here it is:

--- GetMethod.java    Thu Sep 18 04:01:07 2003
+++ GetMethod-Apple.java    Tue Feb  3 12:52:22 2004
@@ -309,7 +309,7 @@
                             resp.addHeader("Content-Range", "bytes "
                                                + range.start
                                                + "-" + range.end + "/"
-                                               + range.length);
+                                               + range.fileLength);
                             resp.setContentLength((int) range.length);
                             resp.setContentType
                                 (revisionDescriptor.getContentType());
@@ -687,7 +687,7 @@
                 ostream.println("Content-Type: " + contentType);
             ostream.println("Content-Range: bytes " + currentRange.start
                                 + "-" + currentRange.end + "/"
-                                + currentRange.length);
+                                + currentRange.fileLength);
             ostream.println();

             // Printing content
@@ -887,7 +887,7 @@
             String rangeDefinition = commaTokenizer.nextToken();

             Range currentRange = new Range();
-            currentRange.length = fileLength;
+            currentRange.fileLength = fileLength;

int dashPos = rangeDefinition.indexOf('-');

@@ -929,7 +929,8 @@
                 }

}
-
+
+ currentRange.length = (currentRange.end - currentRange.start);
if (!currentRange.validate()) {
response.sendError
(HttpServletResponse.SC_REQUESTED_RANGE_NOT_SATISFIABLE);
@@ -951,13 +952,14 @@
public long start;
public long end;
public long length;
+ public long fileLength;


/**
* Validate range.
*/
public boolean validate() {
return ( (start >= 0) && (end >= 0) && (length > 0)
- && (start <= end) && (end < length) );
+ && (start <= end) && (end < fileLength) && (fileLength >= length));
}


     }
On Feb 3, 2004, at 1:24 PM, Chris Sharp wrote:

Please find included a patch for a bug I discovered in the GetMethod class. The bug only affects byte range GET operations. The "Content-Length" header is incorrectly set to the size of total file length and not the length of the range requested. Here is a trace to clarify the bug:

127.000.000.001.64609-127.000.000.001.02150: GET /csharp/Documents/._TestProperties.java%20alias HTTP/1.1
User-Agent: WebDAVFS/1.2.6 (01268000) Darwin/7.2.0 (Power Macintosh)
Accept: */*
Host: localhost:2150
Authorization: Digest username="csharp", realm="idisk.mac.com", nonce="8cf13209e6eec9292ad4a4a603ddef44", uri="/csharp/Documents/._TestProperties.java%20alias", response="082af136af364c091bed22730a835508", opaque="9fdfc78d91a94bc84aa1528bf1f02e1f", qop="auth", nc=0000001a, cnonce="NDAxODJjYmQ6MDAwMDQxY2M="
If-Range: Wed, 28 Jan 2004 18:58:44 GMT
Range: bytes=32768-



127.000.000.001.02150-127.000.000.001.64609: HTTP/1.1 206 Partial Content Content-Type: application/octet-stream Content-Length: 50719 Connection: close Expires: Thu, 01 Jan 1970 00:00:00 GMT ETag: 4924983ab4487f3b7cfb7b8313981419 Content-Language: en x-responding-server: csharp6 Date: Wed, 28 Jan 2004 21:42:27 GMT Pragma: No-cache Content-Range: bytes 32768-50718/50719 Server: AppleInternetServices Last-Modified: Wed, 28 Jan 2004 18:58:44 GMT Cache-Control: no-cache Set-Cookie: JSESSIONID=EB4F2661ACA77E941C2213AF7AC8E469; Path=/


127.000.000.001.02150-127.000.000.001.64609: .......


The Content-Length of the entity body is 17951 bytes long, not 50719. The fix is very straightforward and is included with this e-mail.

Regards,

Chris
.---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to