Permalink
Browse files

Omit unnecessary Content-Range header when full file is provided.

  • Loading branch information...
1 parent bba09d3 commit b149204db8ce98db24a649488dc4c71627f1f2ed @BalusC BalusC committed Apr 20, 2016
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/main/java/org/omnifaces/servlet/FileServlet.java
@@ -375,8 +375,11 @@ private String setContentHeaders(HttpServletRequest request, HttpServletResponse
if (ranges.size() == 1) {
Range range = ranges.get(0);
response.setContentType(contentType);
- response.setHeader("Content-Range", "bytes " + range.start + "-" + range.end + "/" + resource.length);
response.setHeader("Content-Length", String.valueOf(range.length));
+
+ if (range.length != resource.length) {
+ response.setHeader("Content-Range", "bytes " + range.start + "-" + range.end + "/" + resource.length);
+ }
}
else {
response.setContentType("multipart/byteranges; boundary=" + MULTIPART_BOUNDARY);

0 comments on commit b149204

Please sign in to comment.