FastFileServer throws exception on any GET file due to wrong Content-… (#599)

* FastFileServer throws exception on any GET file due to wrong Content-Length value

Any GET file request, e.g. curl http://localhost:8080/pom.xml
results in FastFileServer returning a "HTTP/1.1 500 Server Error".
The root-cause for the error is the following line in handle()
response.setDateHeader("Content-Length", file.length());
which attempts to set the content-length header using a date-function.
Explicitly setting the response Content-Length in servlet-code.

Signed-off-by: Hauke Wulff <hauk3wu1ff@gmail.com>
Reviewed-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Hauke Wulff 2016-06-01 09:46:58 +01:00 committed by Simone Bordet
parent 7d6c05b5c0
commit 8d9c086fa4
1 changed files with 1 additions and 1 deletions

View File

@ -128,7 +128,7 @@ public class FastFileServer
// Jetty DefaultServlet will cache formatted date strings, but we
// will reformat for each request here
response.setDateHeader("Last-Modified", file.lastModified());
response.setDateHeader("Content-Length", file.length());
response.setContentLengthLong(file.length());
response.setContentType(mimeTypes.getMimeByExtension(file.getName()));
// send "small" files blocking directly from an input stream