diff --git a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs index 8fccb7c2a..214ed106d 100644 --- a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs +++ b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs @@ -101,10 +101,35 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager return client; } - private PropertyInfo _httpBehaviorPropertyInfo; - - private HttpWebRequest GetRequest(HttpRequestOptions options, string method, bool enableHttpCompression) + private WebRequest GetMonoRequest(HttpRequestOptions options, string method, bool enableHttpCompression) { + var request = WebRequest.Create(options.Url); + + if (!string.IsNullOrEmpty(options.AcceptHeader)) + { + request.Headers.Add("Accept", options.AcceptHeader); + } + + request.CachePolicy = new RequestCachePolicy(RequestCacheLevel.Revalidate); + request.ConnectionGroupName = GetHostFromUrl(options.Url); + request.Method = method; + request.Timeout = 20000; + + if (!string.IsNullOrEmpty(options.UserAgent)) + { + request.Headers.Add("User-Agent", options.UserAgent); + } + + return request; + } + + private PropertyInfo _httpBehaviorPropertyInfo; + private WebRequest GetRequest(HttpRequestOptions options, string method, bool enableHttpCompression) + { +#if __MonoCS__ + return GetMonoRequest(options, method, enableHttpCompression); +#endif + var request = HttpWebRequest.CreateHttp(options.Url); if (!string.IsNullOrEmpty(options.AcceptHeader)) diff --git a/MediaBrowser.Mono.userprefs b/MediaBrowser.Mono.userprefs index 4a91e2e60..b3c4d6d23 100644 --- a/MediaBrowser.Mono.userprefs +++ b/MediaBrowser.Mono.userprefs @@ -4,7 +4,7 @@ - + diff --git a/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloader.cs b/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloader.cs index e8af0a13e..1f329446e 100644 --- a/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloader.cs +++ b/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloader.cs @@ -90,11 +90,7 @@ namespace MediaBrowser.ServerApplication.FFMpeg { Url = url, CancellationToken = CancellationToken.None, - Progress = new Progress(), - - // Make it look like a browser - // Try to hide that we're direct linking - UserAgent = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.47 Safari/537.36" + Progress = new Progress() }); }