aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/HttpServer
diff options
context:
space:
mode:
authorBond_009 <Bond.009@outlook.com>2020-08-07 17:38:01 +0200
committerBond-009 <bond.009@outlook.com>2020-08-09 14:08:55 +0200
commit371a09c60bddb49298e2cf7f1968514ab4d243e4 (patch)
tree6932ce68f3e27c0bfbf5556139dfadd05ba63cda /Emby.Server.Implementations/HttpServer
parent75bb127599c2507391c612332d1866d1fdc9da13 (diff)
MemoryStream optimizations
Diffstat (limited to 'Emby.Server.Implementations/HttpServer')
-rw-r--r--Emby.Server.Implementations/HttpServer/HttpResultFactory.cs5
-rw-r--r--Emby.Server.Implementations/HttpServer/StreamWriter.cs4
2 files changed, 5 insertions, 4 deletions
diff --git a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
index 970f5119c..688216373 100644
--- a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
+++ b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
@@ -105,7 +105,7 @@ namespace Emby.Server.Implementations.HttpServer
responseHeaders = new Dictionary<string, string>();
}
- if (addCachePrevention && !responseHeaders.TryGetValue(HeaderNames.Expires, out string expires))
+ if (addCachePrevention && !responseHeaders.TryGetValue(HeaderNames.Expires, out _))
{
responseHeaders[HeaderNames.Expires] = "0";
}
@@ -326,7 +326,8 @@ namespace Emby.Server.Implementations.HttpServer
return GetHttpResult(request, ms, contentType, true, responseHeaders);
}
- private IHasHeaders GetCompressedResult(byte[] content,
+ private IHasHeaders GetCompressedResult(
+ byte[] content,
string requestedCompressionType,
IDictionary<string, string> responseHeaders,
bool isHeadRequest,
diff --git a/Emby.Server.Implementations/HttpServer/StreamWriter.cs b/Emby.Server.Implementations/HttpServer/StreamWriter.cs
index 5afc51dbc..00e3ab8fe 100644
--- a/Emby.Server.Implementations/HttpServer/StreamWriter.cs
+++ b/Emby.Server.Implementations/HttpServer/StreamWriter.cs
@@ -95,13 +95,13 @@ namespace Emby.Server.Implementations.HttpServer
if (bytes != null)
{
- await responseStream.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false);
+ await responseStream.WriteAsync(bytes, 0, bytes.Length, cancellationToken).ConfigureAwait(false);
}
else
{
using (var src = SourceStream)
{
- await src.CopyToAsync(responseStream).ConfigureAwait(false);
+ await src.CopyToAsync(responseStream, cancellationToken).ConfigureAwait(false);
}
}
}