-
Bug
-
Resolution: Done
-
Major
-
3.0.8.Final
I'm trying to use the Content-Range feature implemented by the https://issues.jboss.org/browse/RESTEASY-886 and patched by https://issues.jboss.org/browse/RESTEASY-897 to to serve videos to iOS devices via a JAX-RS ReST call.
While testing, I noticed that the videos did not play. After some low level tracing I realized that this behaviour is due to the fact that a request with a range like this:
Range: bytes=0-nnnnn
where nnnnn is the file size - 1 does not properly return the Content-Range and Content-Length header.
Looking at the source code in org.jboss.resteasy.plugins.providers.FileProvider, it seems to me that the if block at line 178 should not be there.
if (begin == 0 && end + 1 >= fileSize)
{ writeIt(uploadFile, entityStream); return; }This block falls back to sending the file content chunked and without the appropriate headers.
To test my theory, I removed the block, patched the jar and the videos are now playing properly in mobile Safari.
To summarize, I think that any Range requests with a valid range should be answered as required, with the data and Content-Range and Content-Length headers. The final fix may of course be more involved.