mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-16 02:18:54 -07:00
update requirecss
This commit is contained in:
parent
843c9886aa
commit
e9686a56a6
@ -114,6 +114,12 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||||||
/// <exception cref="System.ArgumentNullException">result</exception>
|
/// <exception cref="System.ArgumentNullException">result</exception>
|
||||||
public object GetOptimizedResult<T>(IRequest requestContext, T result, IDictionary<string, string> responseHeaders = null)
|
public object GetOptimizedResult<T>(IRequest requestContext, T result, IDictionary<string, string> responseHeaders = null)
|
||||||
where T : class
|
where T : class
|
||||||
|
{
|
||||||
|
return GetOptimizedResultInternal<T>(requestContext, result, true, responseHeaders);
|
||||||
|
}
|
||||||
|
|
||||||
|
private object GetOptimizedResultInternal<T>(IRequest requestContext, T result, bool addCachePrevention, IDictionary<string, string> responseHeaders = null)
|
||||||
|
where T : class
|
||||||
{
|
{
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
@ -122,20 +128,27 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||||||
|
|
||||||
var optimizedResult = requestContext.ToOptimizedResult(result);
|
var optimizedResult = requestContext.ToOptimizedResult(result);
|
||||||
|
|
||||||
if (responseHeaders != null)
|
if (responseHeaders == null)
|
||||||
{
|
{
|
||||||
// Apply headers
|
responseHeaders = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||||
var hasOptions = optimizedResult as IHasOptions;
|
}
|
||||||
|
|
||||||
if (hasOptions != null)
|
if (addCachePrevention)
|
||||||
{
|
{
|
||||||
AddResponseHeaders(hasOptions, responseHeaders);
|
responseHeaders["Expires"] = "-1";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Apply headers
|
||||||
|
var hasOptions = optimizedResult as IHasOptions;
|
||||||
|
|
||||||
|
if (hasOptions != null)
|
||||||
|
{
|
||||||
|
AddResponseHeaders(hasOptions, responseHeaders);
|
||||||
}
|
}
|
||||||
|
|
||||||
return optimizedResult;
|
return optimizedResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the optimized result using cache.
|
/// Gets the optimized result using cache.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -166,7 +179,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||||||
|
|
||||||
if (responseHeaders == null)
|
if (responseHeaders == null)
|
||||||
{
|
{
|
||||||
responseHeaders = new Dictionary<string, string>();
|
responseHeaders = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
// See if the result is already cached in the browser
|
// See if the result is already cached in the browser
|
||||||
@ -177,7 +190,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetOptimizedResult(requestContext, factoryFn(), responseHeaders);
|
return GetOptimizedResultInternal(requestContext, factoryFn(), false, responseHeaders);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -209,7 +222,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||||||
|
|
||||||
if (responseHeaders == null)
|
if (responseHeaders == null)
|
||||||
{
|
{
|
||||||
responseHeaders = new Dictionary<string, string>();
|
responseHeaders = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
// See if the result is already cached in the browser
|
// See if the result is already cached in the browser
|
||||||
@ -363,7 +376,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||||||
public object GetStaticResult(IRequest requestContext, StaticResultOptions options)
|
public object GetStaticResult(IRequest requestContext, StaticResultOptions options)
|
||||||
{
|
{
|
||||||
var cacheKey = options.CacheKey;
|
var cacheKey = options.CacheKey;
|
||||||
options.ResponseHeaders = options.ResponseHeaders ?? new Dictionary<string, string>();
|
options.ResponseHeaders = options.ResponseHeaders ?? new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||||
var contentType = options.ContentType;
|
var contentType = options.ContentType;
|
||||||
|
|
||||||
if (cacheKey == Guid.Empty)
|
if (cacheKey == Guid.Empty)
|
||||||
|
Loading…
Reference in New Issue
Block a user