aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-11-27 14:36:56 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-11-27 14:36:56 -0500
commit26ef23d628c6f84baca5491203e1fe2a9a82d6b9 (patch)
treed8fa32cccb34ef1c6faf824a60bb3fe6d74e05c0 /Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
parentb485c4ca51c26dab56dbc45275bdff4ff165293c (diff)
update caching headers
Diffstat (limited to 'Emby.Server.Implementations/HttpServer/HttpResultFactory.cs')
-rw-r--r--Emby.Server.Implementations/HttpServer/HttpResultFactory.cs13
1 files changed, 9 insertions, 4 deletions
diff --git a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
index 313db6a75..995dc7b7b 100644
--- a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
+++ b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
@@ -735,7 +735,7 @@ namespace Emby.Server.Implementations.HttpServer
/// <returns><c>true</c> if [is not modified] [the specified cache key]; otherwise, <c>false</c>.</returns>
private bool IsNotModified(IRequest requestContext, Guid? cacheKey, DateTime? lastDateModified, TimeSpan? cacheDuration)
{
- var isNotModified = true;
+ //var isNotModified = true;
var ifModifiedSinceHeader = requestContext.Headers.Get("If-Modified-Since");
@@ -745,18 +745,23 @@ namespace Emby.Server.Implementations.HttpServer
if (DateTime.TryParse(ifModifiedSinceHeader, out ifModifiedSince))
{
- isNotModified = IsNotModified(ifModifiedSince.ToUniversalTime(), cacheDuration, lastDateModified);
+ if (IsNotModified(ifModifiedSince.ToUniversalTime(), cacheDuration, lastDateModified))
+ {
+ return true;
+ }
}
}
var ifNoneMatchHeader = requestContext.Headers.Get("If-None-Match");
// Validate If-None-Match
- if (isNotModified && (cacheKey.HasValue || !string.IsNullOrEmpty(ifNoneMatchHeader)))
+ if ((cacheKey.HasValue || !string.IsNullOrEmpty(ifNoneMatchHeader)))
{
Guid ifNoneMatch;
- if (Guid.TryParse(ifNoneMatchHeader ?? string.Empty, out ifNoneMatch))
+ ifNoneMatchHeader = (ifNoneMatchHeader ?? string.Empty).Trim('\"');
+
+ if (Guid.TryParse(ifNoneMatchHeader, out ifNoneMatch))
{
if (cacheKey.HasValue && cacheKey.Value == ifNoneMatch)
{