mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 22:07:13 -04:00
Merge pull request #4028 from crobibero/cache-duration
Properly verify cache duration
This commit is contained in:
commit
1b1de4026d
@ -1281,9 +1281,9 @@ namespace Jellyfin.Api.Controllers
|
|||||||
Response.Headers.Add(HeaderNames.LastModified, dateImageModified.ToUniversalTime().ToString("ddd, dd MMM yyyy HH:mm:ss \"GMT\"", new CultureInfo("en-US", false)));
|
Response.Headers.Add(HeaderNames.LastModified, dateImageModified.ToUniversalTime().ToString("ddd, dd MMM yyyy HH:mm:ss \"GMT\"", new CultureInfo("en-US", false)));
|
||||||
|
|
||||||
// if the image was not modified since "ifModifiedSinceHeader"-header, return a HTTP status code 304 not modified
|
// if the image was not modified since "ifModifiedSinceHeader"-header, return a HTTP status code 304 not modified
|
||||||
if (!(dateImageModified > ifModifiedSinceHeader))
|
if (!(dateImageModified > ifModifiedSinceHeader) && cacheDuration.HasValue)
|
||||||
{
|
{
|
||||||
if (ifModifiedSinceHeader.Add(cacheDuration!.Value) < DateTime.UtcNow)
|
if (ifModifiedSinceHeader.Add(cacheDuration.Value) < DateTime.UtcNow)
|
||||||
{
|
{
|
||||||
Response.StatusCode = StatusCodes.Status304NotModified;
|
Response.StatusCode = StatusCodes.Status304NotModified;
|
||||||
return new ContentResult();
|
return new ContentResult();
|
||||||
|
Loading…
Reference in New Issue
Block a user