* fix negative filelength for files >2G

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7408 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
f1ori 14 years ago
parent cdfe8afe3f
commit e4aabaa1c3

@ -243,7 +243,7 @@ public class Response {
public long size() {
if (this.responseHeader != null) {
// take the size from the response header
return this.responseHeader.getContentLength();
return this.responseHeader.getContentLengthLong();
}
if (this.content != null) return this.content.length;
// the size is unknown

@ -442,6 +442,23 @@ public class HeaderFramework extends TreeMap<String, String> implements Map<Stri
return -1;
}
/*
* provide method, which can handle big filelengths (for example from ftp)
* because we can't change the interface in apache httpclient
*
* @see org.apache.commons.fileupload.RequestContext#getContentLength()
*/
public long getContentLengthLong() {
if (containsKey(CONTENT_LENGTH)) {
try {
return Long.parseLong(get(CONTENT_LENGTH));
} catch (final NumberFormatException e) {
return -1;
}
}
return -1;
}
/*
* (non-Javadoc)
*

Loading…
Cancel
Save