From a4c25b4bb89d74d739f7317871b27716484ee229 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 15 Jun 2017 13:34:05 -0400 Subject: [PATCH 1/2] add message --- MediaBrowser.Server.Mono/ImageEncoderHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Server.Mono/ImageEncoderHelper.cs b/MediaBrowser.Server.Mono/ImageEncoderHelper.cs index 92eaf418b..02593fb67 100644 --- a/MediaBrowser.Server.Mono/ImageEncoderHelper.cs +++ b/MediaBrowser.Server.Mono/ImageEncoderHelper.cs @@ -27,9 +27,9 @@ namespace MediaBrowser.Server.Startup.Common { return new SkiaEncoder(logManager.GetLogger("Skia"), appPaths, httpClient, fileSystem); } - catch + catch (Exception ex) { - logger.Error("Error loading Skia. Will revert to ImageMagick."); + logger.Error("Error loading Skia: {0}. Will revert to ImageMagick.", ex.Message); } try From 7b6f07b2602e33fe68969d78ac2f4ac76dafbc9c Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 15 Jun 2017 13:40:38 -0400 Subject: [PATCH 2/2] update methods --- .../Net/HttpListenerResponse.Managed.cs | 9 ++++-- .../Net/HttpListenerResponse.cs | 29 ++++++++++--------- .../Net/HttpRequestStream.Managed.cs | 3 +- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/SocketHttpListener/Net/HttpListenerResponse.Managed.cs b/SocketHttpListener/Net/HttpListenerResponse.Managed.cs index 52576fdf2..9adf0d435 100644 --- a/SocketHttpListener/Net/HttpListenerResponse.Managed.cs +++ b/SocketHttpListener/Net/HttpListenerResponse.Managed.cs @@ -40,7 +40,7 @@ namespace SocketHttpListener.Net public Version ProtocolVersion { - get => _version; + get { return _version; } set { CheckDisposed(); @@ -59,7 +59,7 @@ namespace SocketHttpListener.Net public int StatusCode { - get => _statusCode; + get { return _statusCode; } set { CheckDisposed(); @@ -71,7 +71,10 @@ namespace SocketHttpListener.Net } } - private void Dispose() => Close(true); + private void Dispose() + { + Close(true); + } public void Close() { diff --git a/SocketHttpListener/Net/HttpListenerResponse.cs b/SocketHttpListener/Net/HttpListenerResponse.cs index 240c67930..fc57e8485 100644 --- a/SocketHttpListener/Net/HttpListenerResponse.cs +++ b/SocketHttpListener/Net/HttpListenerResponse.cs @@ -25,14 +25,14 @@ namespace SocketHttpListener.Net public WebHeaderCollection Headers { - get => _webHeaders; + get { return _webHeaders; } } public Encoding ContentEncoding { get; set; } public string ContentType { - get => Headers["Content-Type"]; + get { return Headers["Content-Type"]; } set { CheckDisposed(); @@ -47,13 +47,13 @@ namespace SocketHttpListener.Net } } - private HttpListenerContext HttpListenerContext => _httpContext; + private HttpListenerContext HttpListenerContext { get { return _httpContext; } } - private HttpListenerRequest HttpListenerRequest => HttpListenerContext.Request; + private HttpListenerRequest HttpListenerRequest { get { return HttpListenerContext.Request; } } internal EntitySendFormat EntitySendFormat { - get => (EntitySendFormat)_boundaryType; + get { return (EntitySendFormat)_boundaryType; } set { CheckDisposed(); @@ -72,8 +72,8 @@ namespace SocketHttpListener.Net public bool SendChunked { - get => EntitySendFormat == EntitySendFormat.Chunked; - set => EntitySendFormat = value ? EntitySendFormat.Chunked : EntitySendFormat.ContentLength; + get { return EntitySendFormat == EntitySendFormat.Chunked; ; } + set { EntitySendFormat = value ? EntitySendFormat.Chunked : EntitySendFormat.ContentLength; } } // We MUST NOT send message-body when we send responses with these Status codes @@ -93,7 +93,7 @@ namespace SocketHttpListener.Net public long ContentLength64 { - get => _contentLength; + get { return _contentLength; } set { CheckDisposed(); @@ -112,13 +112,13 @@ namespace SocketHttpListener.Net public CookieCollection Cookies { - get => _cookies ?? (_cookies = new CookieCollection()); - set => _cookies = value; + get { return _cookies ?? (_cookies = new CookieCollection()); } + set { _cookies = value; } } public bool KeepAlive { - get => _keepAlive; + get { return _keepAlive; } set { CheckDisposed(); @@ -138,7 +138,7 @@ namespace SocketHttpListener.Net public string RedirectLocation { - get => Headers["Location"]; + get { return Headers["Location"]; } set { // note that this doesn't set the status code to a redirect one @@ -281,7 +281,10 @@ namespace SocketHttpListener.Net //} } - void IDisposable.Dispose() => Dispose(); + void IDisposable.Dispose() + { + Dispose(); + } private void CheckDisposed() { diff --git a/SocketHttpListener/Net/HttpRequestStream.Managed.cs b/SocketHttpListener/Net/HttpRequestStream.Managed.cs index 2b5dfc838..92f4bbb02 100644 --- a/SocketHttpListener/Net/HttpRequestStream.Managed.cs +++ b/SocketHttpListener/Net/HttpRequestStream.Managed.cs @@ -165,7 +165,8 @@ namespace SocketHttpListener.Net if (asyncResult == null) throw new ArgumentNullException(nameof(asyncResult)); - if (asyncResult is HttpStreamAsyncResult r) + var r = asyncResult as HttpStreamAsyncResult; + if (r != null) { if (!ReferenceEquals(this, r._parent)) {