Merge pull request #2710 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2017-06-15 13:41:03 -04:00 committed by GitHub
commit 2a286d17a3
4 changed files with 26 additions and 19 deletions

View File

@ -27,9 +27,9 @@ namespace MediaBrowser.Server.Startup.Common
{ {
return new SkiaEncoder(logManager.GetLogger("Skia"), appPaths, httpClient, fileSystem); 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 try

View File

@ -40,7 +40,7 @@ namespace SocketHttpListener.Net
public Version ProtocolVersion public Version ProtocolVersion
{ {
get => _version; get { return _version; }
set set
{ {
CheckDisposed(); CheckDisposed();
@ -59,7 +59,7 @@ namespace SocketHttpListener.Net
public int StatusCode public int StatusCode
{ {
get => _statusCode; get { return _statusCode; }
set set
{ {
CheckDisposed(); CheckDisposed();
@ -71,7 +71,10 @@ namespace SocketHttpListener.Net
} }
} }
private void Dispose() => Close(true); private void Dispose()
{
Close(true);
}
public void Close() public void Close()
{ {

View File

@ -25,14 +25,14 @@ namespace SocketHttpListener.Net
public WebHeaderCollection Headers public WebHeaderCollection Headers
{ {
get => _webHeaders; get { return _webHeaders; }
} }
public Encoding ContentEncoding { get; set; } public Encoding ContentEncoding { get; set; }
public string ContentType public string ContentType
{ {
get => Headers["Content-Type"]; get { return Headers["Content-Type"]; }
set set
{ {
CheckDisposed(); 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 internal EntitySendFormat EntitySendFormat
{ {
get => (EntitySendFormat)_boundaryType; get { return (EntitySendFormat)_boundaryType; }
set set
{ {
CheckDisposed(); CheckDisposed();
@ -72,8 +72,8 @@ namespace SocketHttpListener.Net
public bool SendChunked public bool SendChunked
{ {
get => EntitySendFormat == EntitySendFormat.Chunked; get { return EntitySendFormat == EntitySendFormat.Chunked; ; }
set => EntitySendFormat = value ? EntitySendFormat.Chunked : EntitySendFormat.ContentLength; set { EntitySendFormat = value ? EntitySendFormat.Chunked : EntitySendFormat.ContentLength; }
} }
// We MUST NOT send message-body when we send responses with these Status codes // We MUST NOT send message-body when we send responses with these Status codes
@ -93,7 +93,7 @@ namespace SocketHttpListener.Net
public long ContentLength64 public long ContentLength64
{ {
get => _contentLength; get { return _contentLength; }
set set
{ {
CheckDisposed(); CheckDisposed();
@ -112,13 +112,13 @@ namespace SocketHttpListener.Net
public CookieCollection Cookies public CookieCollection Cookies
{ {
get => _cookies ?? (_cookies = new CookieCollection()); get { return _cookies ?? (_cookies = new CookieCollection()); }
set => _cookies = value; set { _cookies = value; }
} }
public bool KeepAlive public bool KeepAlive
{ {
get => _keepAlive; get { return _keepAlive; }
set set
{ {
CheckDisposed(); CheckDisposed();
@ -138,7 +138,7 @@ namespace SocketHttpListener.Net
public string RedirectLocation public string RedirectLocation
{ {
get => Headers["Location"]; get { return Headers["Location"]; }
set set
{ {
// note that this doesn't set the status code to a redirect one // 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() private void CheckDisposed()
{ {

View File

@ -165,7 +165,8 @@ namespace SocketHttpListener.Net
if (asyncResult == null) if (asyncResult == null)
throw new ArgumentNullException(nameof(asyncResult)); throw new ArgumentNullException(nameof(asyncResult));
if (asyncResult is HttpStreamAsyncResult r) var r = asyncResult as HttpStreamAsyncResult;
if (r != null)
{ {
if (!ReferenceEquals(this, r._parent)) if (!ReferenceEquals(this, r._parent))
{ {