aboutsummaryrefslogtreecommitdiff
path: root/Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2017-02-09 19:01:44 -0500
committerGitHub <noreply@github.com>2017-02-09 19:01:44 -0500
commit9afc7ff900c3754eaa8214be65b1e16d6379192e (patch)
tree875d6cc74608ee3a67787b521553d9f4d48b3092 /Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs
parent38a32f7b90acd52f2091867415b1cb16dd989b6d (diff)
parent35415d6a504ae8e2f066b2e0e4b1a94745c95bf3 (diff)
Merge pull request #2454 from MediaBrowser/dev
Dev
Diffstat (limited to 'Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs')
-rw-r--r--Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs19
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)