Low Priority, aesthetic enhancement only.
Found when attempting to allow other programs access to the resources provided by ResourceAccessModule.
I expose valid resource URL's to devices for DLNA/UPNP access. However the "Range" http header isn't always provided by the client.
System/MediaPortal.Core/Services/MediaManagement/ResourceAccessModule.cs in method Process().
The following code is always executed on every access, however if the "Range" header isn't provided, ParseRange will write a benign exception to the log.
Although this doesn't affect execution it's annoying to see the exception in the log.
My code change does the following...
Only ParseRanges when a range exists and also since ranges is initialised to null, extra check in if for null.
Found when attempting to allow other programs access to the resources provided by ResourceAccessModule.
I expose valid resource URL's to devices for DLNA/UPNP access. However the "Range" http header isn't always provided by the client.
System/MediaPortal.Core/Services/MediaManagement/ResourceAccessModule.cs in method Process().
The following code is always executed on every access, however if the "Range" header isn't provided, ParseRange will write a benign exception to the log.
Code:
string byteRangesSpecifier = request.Headers["Range"];
IList<Range> ranges = ParseRanges(byteRangesSpecifier, resourceStream.Length);
Although this doesn't affect execution it's annoying to see the exception in the log.
My code change does the following...
Code:
string byteRangesSpecifier = request.Headers["Range"];
IList<Range> ranges = null;
if (byteRangesSpecifier != null)
{
ranges = ParseRanges(byteRangesSpecifier, resourceStream.Length);
}
bool onlyHeaders = request.Method == "Headers" || response.Status == HttpStatusCode.NotModified;
if (ranges != null && ranges.Count == 1)
// We only support one range
SendRange(response, resourceStream, ranges[0], onlyHeaders);
else
SendWholeFile(response, resourceStream, onlyHeaders);
Only ParseRanges when a range exists and also since ranges is initialised to null, extra check in if for null.
United Kingdom