aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-02-19 00:21:03 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-02-19 00:21:03 -0500
commit4e38c3537398b01776f6e1c5e1c08bce73eec82e (patch)
tree3fc399f51419d6aae3ae8d96769995cc28191d1f /MediaBrowser.Server.Implementations
parentcf4ae16f18376c38fed7a8fcaefdc883893473a2 (diff)
fixed remote control flyout
Diffstat (limited to 'MediaBrowser.Server.Implementations')
-rw-r--r--MediaBrowser.Server.Implementations/Dto/DtoService.cs2
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs38
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/ResponseFilter.cs2
-rw-r--r--MediaBrowser.Server.Implementations/ServerManager/ServerManager.cs3
4 files changed, 32 insertions, 13 deletions
diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs
index aba8c3353..65a496533 100644
--- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs
+++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs
@@ -664,7 +664,7 @@ namespace MediaBrowser.Server.Implementations.Dto
if (fields.Contains(ItemFields.Settings))
{
dto.LockedFields = item.LockedFields;
- dto.EnableInternetProviders = !item.DontFetchMeta;
+ dto.LockData = item.DontFetchMeta;
}
var hasBudget = item as IHasBudget;
diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs
index 3712a58f5..4c21d2eb7 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs
@@ -435,10 +435,10 @@ namespace MediaBrowser.Server.Implementations.HttpServer
if (!compress || string.IsNullOrEmpty(requestedCompressionType))
{
- var stream = await factoryFn().ConfigureAwait(false);
-
var rangeHeader = requestContext.GetHeader("Range");
+ var stream = await factoryFn().ConfigureAwait(false);
+
if (!string.IsNullOrEmpty(rangeHeader))
{
return new RangeRequestWriter(rangeHeader, stream, contentType, isHeadRequest);
@@ -448,34 +448,54 @@ namespace MediaBrowser.Server.Implementations.HttpServer
if (isHeadRequest)
{
+ stream.Dispose();
+
return GetHttpResult(new byte[] { }, contentType);
}
return new StreamWriter(stream, contentType, _logger);
}
- if (isHeadRequest)
- {
- return GetHttpResult(new byte[] { }, contentType);
- }
-
string content;
+ long originalContentLength = 0;
using (var stream = await factoryFn().ConfigureAwait(false))
{
- using (var reader = new StreamReader(stream))
+ using (var memoryStream = new MemoryStream())
{
- content = await reader.ReadToEndAsync().ConfigureAwait(false);
+ await stream.CopyToAsync(memoryStream).ConfigureAwait(false);
+ memoryStream.Position = 0;
+
+ originalContentLength = memoryStream.Length;
+
+ using (var reader = new StreamReader(memoryStream))
+ {
+ content = await reader.ReadToEndAsync().ConfigureAwait(false);
+ }
}
}
if (!SupportsCompression)
{
+ responseHeaders["Content-Length"] = originalContentLength.ToString(UsCulture);
+
+ if (isHeadRequest)
+ {
+ return GetHttpResult(new byte[] { }, contentType);
+ }
+
return new HttpResult(content, contentType);
}
var contents = content.Compress(requestedCompressionType);
+ responseHeaders["Content-Length"] = contents.Length.ToString(UsCulture);
+
+ if (isHeadRequest)
+ {
+ return GetHttpResult(new byte[] { }, contentType);
+ }
+
return new CompressedResult(contents, requestedCompressionType, contentType);
}
diff --git a/MediaBrowser.Server.Implementations/HttpServer/ResponseFilter.cs b/MediaBrowser.Server.Implementations/HttpServer/ResponseFilter.cs
index 520f03561..ac1621709 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/ResponseFilter.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/ResponseFilter.cs
@@ -69,7 +69,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
var response = (HttpListenerResponse)res.OriginalResponse;
response.ContentLength64 = length;
-
+
// Disable chunked encoding. Technically this is only needed when using Content-Range, but
// anytime we know the content length there's no need for it
response.SendChunked = false;
diff --git a/MediaBrowser.Server.Implementations/ServerManager/ServerManager.cs b/MediaBrowser.Server.Implementations/ServerManager/ServerManager.cs
index 4e8469326..fecd72a39 100644
--- a/MediaBrowser.Server.Implementations/ServerManager/ServerManager.cs
+++ b/MediaBrowser.Server.Implementations/ServerManager/ServerManager.cs
@@ -8,7 +8,6 @@ using MediaBrowser.Model.Serialization;
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;
@@ -171,7 +170,7 @@ namespace MediaBrowser.Server.Implementations.ServerManager
throw;
}
- catch (HttpListenerException ex)
+ catch (Exception ex)
{
_logger.ErrorException("Error starting Http Server", ex);