Skip to content

Commit 5a1c67f

Browse files
committed
Fixed issue restlet#607: Content-length too large when range request size is greater than full length of content
1 parent c693d4b commit 5a1c67f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

modules/org.restlet/src/org/restlet/engine/io/BioUtils.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,10 @@ public static long getAvailableSize(Representation representation) {
269269
if (representation.getRange() == null) {
270270
return representation.getSize();
271271
} else if (representation.getRange().getSize() != Range.SIZE_MAX) {
272-
return representation.getRange().getSize();
272+
if(representation.hasKnownSize() && representation.getRange().getSize() > representation.getSize())
273+
return representation.getSize();
274+
else
275+
return representation.getRange().getSize();
273276
} else if (representation.hasKnownSize()) {
274277
if (representation.getRange().getIndex() != Range.INDEX_LAST) {
275278
return representation.getSize()

0 commit comments

Comments
 (0)