aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/HttpServer/BaseRestService.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-03-23 00:04:36 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-03-23 00:04:36 -0400
commitb20151fff373100da7946df93afb7dd4dccea3e4 (patch)
treea16d7085c0eab807c309c94461ed60821029f1ff /MediaBrowser.Server.Implementations/HttpServer/BaseRestService.cs
parent4bc27f3a65ddbffcc7b74683df72503f20df275c (diff)
copy dashboard to the output folder and load from the file system, instead of using embedded resources
Diffstat (limited to 'MediaBrowser.Server.Implementations/HttpServer/BaseRestService.cs')
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/BaseRestService.cs32
1 files changed, 14 insertions, 18 deletions
diff --git a/MediaBrowser.Server.Implementations/HttpServer/BaseRestService.cs b/MediaBrowser.Server.Implementations/HttpServer/BaseRestService.cs
index 4799bf0b8..ff2273750 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/BaseRestService.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/BaseRestService.cs
@@ -1,5 +1,4 @@
-using System.Net;
-using MediaBrowser.Common.Extensions;
+using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.IO;
using MediaBrowser.Common.Net;
using MediaBrowser.Model.Logging;
@@ -11,7 +10,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
-using System.Linq;
+using System.Net;
using System.Threading.Tasks;
using MimeTypes = MediaBrowser.Common.Net.MimeTypes;
@@ -27,7 +26,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
/// </summary>
/// <value>The logger.</value>
public ILogger Logger { get; set; }
-
+
/// <summary>
/// Gets a value indicating whether this instance is range request.
/// </summary>
@@ -36,7 +35,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
{
get
{
- return Request.Headers.AllKeys.Contains("Range");
+ return !string.IsNullOrEmpty(RequestContext.GetHeader("Range"));
}
}
@@ -55,8 +54,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer
throw new ArgumentNullException("result");
}
- Response.AddHeader("Vary", "Accept-Encoding");
-
return RequestContext.ToOptimizedResult(result);
}
@@ -200,11 +197,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer
var compress = ShouldCompressResponse(contentType);
- if (compress)
- {
- Response.AddHeader("Vary", "Accept-Encoding");
- }
-
return ToStaticResult(contentType, factoryFn, compress, headersOnly).Result;
}
@@ -266,9 +258,9 @@ namespace MediaBrowser.Server.Implementations.HttpServer
if (IsRangeRequest)
{
- return new RangeRequestWriter(Request.Headers, httpListenerResponse, stream, headersOnly);
+ return new RangeRequestWriter(RequestContext.GetHeader("Range"), httpListenerResponse, stream, headersOnly);
}
-
+
httpListenerResponse.ContentLength64 = stream.Length;
return headersOnly ? null : new StreamWriter(stream, Logger);
}
@@ -332,22 +324,26 @@ namespace MediaBrowser.Server.Implementations.HttpServer
{
var isNotModified = true;
- if (Request.Headers.AllKeys.Contains("If-Modified-Since"))
+ var ifModifiedSinceHeader = RequestContext.GetHeader("If-Modified-Since");
+
+ if (!string.IsNullOrEmpty(ifModifiedSinceHeader))
{
DateTime ifModifiedSince;
- if (DateTime.TryParse(Request.Headers["If-Modified-Since"], out ifModifiedSince))
+ if (DateTime.TryParse(ifModifiedSinceHeader, out ifModifiedSince))
{
isNotModified = IsNotModified(ifModifiedSince.ToUniversalTime(), cacheDuration, lastDateModified);
}
}
+ var ifNoneMatchHeader = RequestContext.GetHeader("If-None-Match");
+
// Validate If-None-Match
- if (isNotModified && (cacheKey.HasValue || !string.IsNullOrEmpty(Request.Headers["If-None-Match"])))
+ if (isNotModified && (cacheKey.HasValue || !string.IsNullOrEmpty(ifNoneMatchHeader)))
{
Guid ifNoneMatch;
- if (Guid.TryParse(Request.Headers["If-None-Match"] ?? string.Empty, out ifNoneMatch))
+ if (Guid.TryParse(ifNoneMatchHeader ?? string.Empty, out ifNoneMatch))
{
if (cacheKey.HasValue && cacheKey.Value == ifNoneMatch)
{