diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-11-12 02:49:33 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-11-12 02:49:33 -0500 |
| commit | d5197eabb0b2ac375cd7610aa7cc4a7e61a88245 (patch) | |
| tree | 0f05bf569a19c75b9654af69d8356c67ff0c2de0 /Emby.Server.Implementations/HttpServer/StreamWriter.cs | |
| parent | 67b69ceb9418ef530296238d1776894b675f4c5e (diff) | |
| parent | 6865bb53530abbf703b590dd39cfa27274b03107 (diff) | |
Merge pull request #2283 from MediaBrowser/dev
Dev
Diffstat (limited to 'Emby.Server.Implementations/HttpServer/StreamWriter.cs')
| -rw-r--r-- | Emby.Server.Implementations/HttpServer/StreamWriter.cs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Emby.Server.Implementations/HttpServer/StreamWriter.cs b/Emby.Server.Implementations/HttpServer/StreamWriter.cs index 15488abaa..33378949c 100644 --- a/Emby.Server.Implementations/HttpServer/StreamWriter.cs +++ b/Emby.Server.Implementations/HttpServer/StreamWriter.cs @@ -25,6 +25,8 @@ namespace Emby.Server.Implementations.HttpServer /// <value>The source stream.</value> private Stream SourceStream { get; set; } + private byte[] SourceBytes { get; set; } + /// <summary> /// The _options /// </summary> @@ -40,7 +42,6 @@ namespace Emby.Server.Implementations.HttpServer public Action OnComplete { get; set; } public Action OnError { get; set; } - private readonly byte[] _bytes; /// <summary> /// Initializes a new instance of the <see cref="StreamWriter" /> class. @@ -73,14 +74,13 @@ namespace Emby.Server.Implementations.HttpServer /// <param name="contentType">Type of the content.</param> /// <param name="logger">The logger.</param> public StreamWriter(byte[] source, string contentType, ILogger logger) - : this(new MemoryStream(source), contentType, logger) { if (string.IsNullOrEmpty(contentType)) { throw new ArgumentNullException("contentType"); } - _bytes = source; + SourceBytes = source; Logger = logger; Headers["Content-Type"] = contentType; @@ -92,9 +92,11 @@ namespace Emby.Server.Implementations.HttpServer { try { - if (_bytes != null) + var bytes = SourceBytes; + + if (bytes != null) { - await responseStream.WriteAsync(_bytes, 0, _bytes.Length); + await responseStream.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false); } else { |
