diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-09-15 23:33:30 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-09-15 23:33:30 -0400 |
| commit | a35f62a4a4fb8281c9eb660b16d836a15248a0bf (patch) | |
| tree | 1ddf09a9e81be2b3ca78d0a2303bc998540f980c /MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs | |
| parent | cbbc7269fa8b62af60f199cb0c69a6b10d0b5b54 (diff) | |
fixes #295 - Add play to vlc option
Diffstat (limited to 'MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs')
| -rw-r--r-- | MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs index f1f1858cb..5702af6d1 100644 --- a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs +++ b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs @@ -13,7 +13,6 @@ using System.Linq; using System.Net; using System.Net.Cache; using System.Net.Http; -using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -225,7 +224,10 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager if ((DateTime.UtcNow - client.LastTimeout).TotalSeconds < TimeoutSeconds) { - throw new HttpException(string.Format("Cancelling connection to {0} due to a previous timeout.", options.Url)) { IsTimedOut = true }; + throw new HttpException(string.Format("Cancelling connection to {0} due to a previous timeout.", options.Url)) + { + IsTimedOut = true + }; } var httpWebRequest = GetRequest(options, httpMethod, options.EnableHttpCompression); @@ -348,7 +350,15 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager { _logger.ErrorException("Error getting response from " + options.Url, ex); - return new HttpException(ex.Message, ex); + var exception = new HttpException(ex.Message, ex); + + var response = ex.Response as HttpWebResponse; + if (response != null) + { + exception.StatusCode = response.StatusCode; + } + + return exception; } private HttpResponseInfo GetResponseInfo(HttpWebResponse httpResponse, Stream content, long? contentLength) @@ -658,7 +668,10 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager _logger.Error(msg); // Throw an HttpException so that the caller doesn't think it was cancelled by user code - return new HttpException(msg, exception) { IsTimedOut = true }; + return new HttpException(msg, exception) + { + IsTimedOut = true + }; } return exception; @@ -693,7 +706,10 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager } } - throw new HttpException(response.StatusDescription) { StatusCode = response.StatusCode }; + throw new HttpException(response.StatusDescription) + { + StatusCode = response.StatusCode + }; } } |
