aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2018-12-30 13:01:52 +0100
committerBond_009 <bond.009@outlook.com>2019-01-03 18:24:26 +0100
commit0bbc4f8219f3df020e505fc861f42f4f52e20766 (patch)
tree3558f841cccb9d138e8acbedb61648263c733118 /Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
parenta1b96a3135bdae274db58ef35ab35708f2257896 (diff)
Figure out why it's failing
Diffstat (limited to 'Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs')
-rw-r--r--Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs28
1 files changed, 11 insertions, 17 deletions
diff --git a/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs b/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
index a2f508b80..60482780f 100644
--- a/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
+++ b/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
@@ -5,6 +5,7 @@ using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
+using System.Net.Cache;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -122,17 +123,17 @@ namespace Emby.Server.Implementations.HttpClientManager
private WebRequest GetRequest(HttpRequestOptions options, string method)
{
- var url = options.Url;
+ string url = options.Url;
- var uriAddress = new Uri(url);
- var userInfo = uriAddress.UserInfo;
+ Uri uriAddress = new Uri(url);
+ string userInfo = uriAddress.UserInfo;
if (!string.IsNullOrWhiteSpace(userInfo))
{
_logger.LogInformation("Found userInfo in url: {0} ... url: {1}", userInfo, url);
url = url.Replace(userInfo + "@", string.Empty);
}
- var request = CreateWebRequest(url);
+ WebRequest request = CreateWebRequest(url);
if (request is HttpWebRequest httpWebRequest)
{
@@ -140,15 +141,11 @@ namespace Emby.Server.Implementations.HttpClientManager
if (options.EnableHttpCompression)
{
- if (options.DecompressionMethod.HasValue)
- {
- httpWebRequest.AutomaticDecompression = options.DecompressionMethod.Value == CompressionMethod.Gzip
- ? DecompressionMethods.GZip
- : DecompressionMethods.Deflate;
- }
- else
+ httpWebRequest.AutomaticDecompression = DecompressionMethods.Deflate;
+ if (options.DecompressionMethod.HasValue
+ && options.DecompressionMethod.Value == CompressionMethod.Gzip)
{
- httpWebRequest.AutomaticDecompression = DecompressionMethods.Deflate;
+ httpWebRequest.AutomaticDecompression = DecompressionMethods.GZip;
}
}
else
@@ -156,10 +153,7 @@ namespace Emby.Server.Implementations.HttpClientManager
httpWebRequest.AutomaticDecompression = DecompressionMethods.None;
}
- if (options.EnableKeepAlive)
- {
- httpWebRequest.KeepAlive = true;
- }
+ httpWebRequest.KeepAlive = options.EnableKeepAlive;
if (!string.IsNullOrEmpty(options.Host))
{
@@ -172,7 +166,7 @@ namespace Emby.Server.Implementations.HttpClientManager
}
}
- request.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.BypassCache);
+ request.CachePolicy = new RequestCachePolicy(RequestCacheLevel.BypassCache);
request.Method = method;
request.Timeout = options.TimeoutMs;