From f1cfd3cffb6ba6af91badb717ee204dce682d793 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 8 Feb 2017 22:58:04 -0500 Subject: add schedules direct error handling --- .../HttpClientManager/HttpClientManager.cs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs') diff --git a/Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs b/Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs index 0abcaadb1..737cdcc7d 100644 --- a/Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs +++ b/Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs @@ -44,18 +44,12 @@ namespace Emby.Common.Implementations.HttpClientManager private readonly IFileSystem _fileSystem; private readonly IMemoryStreamFactory _memoryStreamProvider; - private readonly IApplicationHost _appHost; + private readonly Func _defaultUserAgentFn; /// /// Initializes a new instance of the class. /// - /// The app paths. - /// The logger. - /// The file system. - /// appPaths - /// or - /// logger - public HttpClientManager(IApplicationPaths appPaths, ILogger logger, IFileSystem fileSystem, IMemoryStreamFactory memoryStreamProvider) + public HttpClientManager(IApplicationPaths appPaths, ILogger logger, IFileSystem fileSystem, IMemoryStreamFactory memoryStreamProvider, Func defaultUserAgentFn) { if (appPaths == null) { @@ -70,6 +64,7 @@ namespace Emby.Common.Implementations.HttpClientManager _fileSystem = fileSystem; _memoryStreamProvider = memoryStreamProvider; _appPaths = appPaths; + _defaultUserAgentFn = defaultUserAgentFn; #if NET46 // http://stackoverflow.com/questions/566437/http-post-returns-the-error-417-expectation-failed-c @@ -284,7 +279,7 @@ namespace Emby.Common.Implementations.HttpClientManager if (!hasUserAgent && options.EnableDefaultUserAgent) { - SetUserAgent(request, _appHost.Name + "/" + _appHost.ApplicationVersion.ToString()); + SetUserAgent(request, _defaultUserAgentFn()); } } -- cgit v1.2.3