diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-02-09 18:25:10 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-02-09 18:25:10 -0500 |
| commit | 6405f6c0c74ac689c7817d74aaa58f548d29b84d (patch) | |
| tree | cb1e1aeb0bd39c31cacba7203e397086c66455fa /Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs | |
| parent | 1879999fd3f42861e8dfd4bf190ed3c0d0d510b7 (diff) | |
update xmltv parsing
Diffstat (limited to 'Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs')
| -rw-r--r-- | Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs b/Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs index 737cdcc7d..23f33f06c 100644 --- a/Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs +++ b/Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs @@ -458,15 +458,22 @@ namespace Emby.Common.Implementations.HttpClientManager !string.IsNullOrEmpty(options.RequestContent) || string.Equals(httpMethod, "post", StringComparison.OrdinalIgnoreCase)) { - var bytes = options.RequestContentBytes ?? - Encoding.UTF8.GetBytes(options.RequestContent ?? string.Empty); + try + { + var bytes = options.RequestContentBytes ?? + Encoding.UTF8.GetBytes(options.RequestContent ?? string.Empty); - httpWebRequest.ContentType = options.RequestContentType ?? "application/x-www-form-urlencoded"; + httpWebRequest.ContentType = options.RequestContentType ?? "application/x-www-form-urlencoded"; #if NET46 - httpWebRequest.ContentLength = bytes.Length; -#endif - (await httpWebRequest.GetRequestStreamAsync().ConfigureAwait(false)).Write(bytes, 0, bytes.Length); + httpWebRequest.ContentLength = bytes.Length; +#endif + (await httpWebRequest.GetRequestStreamAsync().ConfigureAwait(false)).Write(bytes, 0, bytes.Length); + } + catch (Exception ex) + { + throw new HttpException(ex.Message) { IsTimedOut = true }; + } } if (options.ResourcePool != null) |
