|
|
@ -107,7 +107,7 @@ public class StreamController { |
|
|
|
playQueue.addFiles(false, playlistService.getFilesInPlaylist(playlistId)); |
|
|
|
playQueue.addFiles(false, playlistService.getFilesInPlaylist(playlistId)); |
|
|
|
player.setPlayQueue(playQueue); |
|
|
|
player.setPlayQueue(playQueue); |
|
|
|
Util.setContentLength(response, playQueue.length()); |
|
|
|
Util.setContentLength(response, playQueue.length()); |
|
|
|
LOG.info("Incoming Podcast request for playlist " + playlistId); |
|
|
|
LOG.info("{}: Incoming Podcast request for playlist {}", request.getRemoteAddr(), playlistId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
response.setHeader("Access-Control-Allow-Origin", "*"); |
|
|
|
response.setHeader("Access-Control-Allow-Origin", "*"); |
|
|
@ -164,7 +164,7 @@ public class StreamController { |
|
|
|
|
|
|
|
|
|
|
|
range = getRange(request, file); |
|
|
|
range = getRange(request, file); |
|
|
|
if (settingsService.isEnableSeek() && range != null && !file.isVideo()) { |
|
|
|
if (settingsService.isEnableSeek() && range != null && !file.isVideo()) { |
|
|
|
LOG.info("Got HTTP range: " + range); |
|
|
|
LOG.info("{}: Got HTTP range: {}", request.getRemoteAddr(), range); |
|
|
|
response.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT); |
|
|
|
response.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT); |
|
|
|
Util.setContentLength(response, range.isClosed() ? range.size() : fileLength - range.getFirstBytePos()); |
|
|
|
Util.setContentLength(response, range.isClosed() ? range.size() : fileLength - range.getFirstBytePos()); |
|
|
|
long lastBytePos = range.getLastBytePos() != null ? range.getLastBytePos() : fileLength - 1; |
|
|
|
long lastBytePos = range.getLastBytePos() != null ? range.getLastBytePos() : fileLength - 1; |
|
|
@ -248,12 +248,22 @@ public class StreamController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception err) { |
|
|
|
} catch (IOException e) { |
|
|
|
if("org.apache.catalina.connector.ClientAbortException".equals(err.getClass().getName())) { |
|
|
|
|
|
|
|
LOG.info("org.apache.catalina.connector.ClientAbortException: Connection reset"); |
|
|
|
// This happens often and outside of the control of the server, so
|
|
|
|
|
|
|
|
// we catch Tomcat/Jetty "connection aborted by client" exceptions
|
|
|
|
|
|
|
|
// and display a short error message.
|
|
|
|
|
|
|
|
boolean shouldCatch = false; |
|
|
|
|
|
|
|
shouldCatch |= Util.isInstanceOfClassName(e, "org.apache.catalina.connector.ClientAbortException"); |
|
|
|
|
|
|
|
shouldCatch |= Util.isInstanceOfClassName(e, "org.eclipse.jetty.io.EofException"); |
|
|
|
|
|
|
|
if (shouldCatch) { |
|
|
|
|
|
|
|
LOG.info("{}: Client unexpectedly closed connection while loading {} ({})", request.getRemoteAddr(), Util.getURLForRequest(request), e.getCause().toString()); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
LOG.error("Error occurred in handleRequest.", err); |
|
|
|
|
|
|
|
|
|
|
|
// Rethrow the exception in all other cases
|
|
|
|
|
|
|
|
throw e; |
|
|
|
|
|
|
|
|
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
if (status != null) { |
|
|
|
if (status != null) { |
|
|
|
securityService.updateUserByteCounts(user, status.getBytesTransfered(), 0L, 0L); |
|
|
|
securityService.updateUserByteCounts(user, status.getBytesTransfered(), 0L, 0L); |
|
|
@ -428,5 +438,4 @@ public class StreamController { |
|
|
|
out.write(buf); |
|
|
|
out.write(buf); |
|
|
|
out.flush(); |
|
|
|
out.flush(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|