Fix inputstream reading for HTTP range requests
Prior to this commit, range requests would be served by ResourceHttpRequestHandler by partially reading the inputstream of static resources. In case of resources contained in ZIP/JAR containers, InputStreams may not fill the entire read buffer when calling `inputStream.read(byte[])`. This was the case when using Spring Boot's ZipInflaterInputStream - this would then not read the entire file content and would close the response without writing the expected body length indicated in the "Content-Length" header. This commit makes sure that the whole resource is read. Issue: SPR-13661
This commit is contained in:
parent
20a286b4d6
commit
b35d44bd4c
|
|
@ -574,7 +574,7 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
|
|||
out.write(buffer, 0, (int) bytesToCopy);
|
||||
bytesToCopy = 0;
|
||||
}
|
||||
if (bytesRead < buffer.length) {
|
||||
if (bytesRead == -1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue