aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common.Implementations
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Common.Implementations')
-rw-r--r--MediaBrowser.Common.Implementations/Configuration/BaseConfigurationManager.cs6
-rw-r--r--MediaBrowser.Common.Implementations/Logging/NlogManager.cs2
-rw-r--r--MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj6
-rw-r--r--MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs57
-rw-r--r--MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs17
-rw-r--r--MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs2
-rw-r--r--MediaBrowser.Common.Implementations/packages.config4
7 files changed, 63 insertions, 31 deletions
diff --git a/MediaBrowser.Common.Implementations/Configuration/BaseConfigurationManager.cs b/MediaBrowser.Common.Implementations/Configuration/BaseConfigurationManager.cs
index 7bbc1abd7..7f9299ff2 100644
--- a/MediaBrowser.Common.Implementations/Configuration/BaseConfigurationManager.cs
+++ b/MediaBrowser.Common.Implementations/Configuration/BaseConfigurationManager.cs
@@ -174,13 +174,9 @@ namespace MediaBrowser.Common.Implementations.Configuration
{
cachePath = null;
}
- else if (CommonConfiguration.EnableCustomPathSubFolders)
- {
- cachePath = Path.Combine(CommonConfiguration.CachePath, "cache");
- }
else
{
- cachePath = CommonConfiguration.CachePath;
+ cachePath = Path.Combine(CommonConfiguration.CachePath, "cache");
}
((BaseApplicationPaths)CommonApplicationPaths).CachePath = cachePath;
diff --git a/MediaBrowser.Common.Implementations/Logging/NlogManager.cs b/MediaBrowser.Common.Implementations/Logging/NlogManager.cs
index 391e7c212..1bbcccd88 100644
--- a/MediaBrowser.Common.Implementations/Logging/NlogManager.cs
+++ b/MediaBrowser.Common.Implementations/Logging/NlogManager.cs
@@ -110,7 +110,7 @@ namespace MediaBrowser.Common.Implementations.Logging
var logFile = new FileTarget
{
FileName = path,
- Layout = "${longdate} ${level} - ${logger}: ${message}"
+ Layout = "${longdate} ${level} ${logger}: ${message}"
};
logFile.Name = "ApplicationLogFile";
diff --git a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj
index d857e58b6..8615d4f8b 100644
--- a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj
+++ b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj
@@ -53,7 +53,7 @@
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\NLog.4.1.1\lib\net45\NLog.dll</HintPath>
+ <HintPath>..\packages\NLog.4.2.0\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="Patterns.Logging">
<HintPath>..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll</HintPath>
@@ -62,9 +62,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ThirdParty\SharpCompress\SharpCompress.dll</HintPath>
</Reference>
- <Reference Include="SimpleInjector, Version=2.8.0.0, Culture=neutral, PublicKeyToken=984cb50dea722e99, processorArchitecture=MSIL">
+ <Reference Include="SimpleInjector, Version=3.1.0.0, Culture=neutral, PublicKeyToken=984cb50dea722e99, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\SimpleInjector.3.0.5\lib\net45\SimpleInjector.dll</HintPath>
+ <HintPath>..\packages\SimpleInjector.3.1.0\lib\net45\SimpleInjector.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
diff --git a/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs b/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs
index c27dfd68d..703fec68d 100644
--- a/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs
+++ b/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs
@@ -86,6 +86,14 @@ namespace MediaBrowser.Common.Implementations.Networking
private bool IsInPrivateAddressSpace(string endpoint)
{
+ if (string.Equals(endpoint, "::1", StringComparison.OrdinalIgnoreCase))
+ {
+ return true;
+ }
+
+ // Handle ipv4 mapped to ipv6
+ endpoint = endpoint.Replace("::ffff:", string.Empty);
+
// Private address space:
// http://en.wikipedia.org/wiki/Private_network
@@ -96,9 +104,6 @@ namespace MediaBrowser.Common.Implementations.Networking
return
- // If url was requested with computer name, we may see this
- endpoint.IndexOf("::", StringComparison.OrdinalIgnoreCase) != -1 ||
-
endpoint.StartsWith("localhost", StringComparison.OrdinalIgnoreCase) ||
endpoint.StartsWith("127.", StringComparison.OrdinalIgnoreCase) ||
endpoint.StartsWith("10.", StringComparison.OrdinalIgnoreCase) ||
@@ -131,26 +136,42 @@ namespace MediaBrowser.Common.Implementations.Networking
throw new ArgumentNullException("endpoint");
}
- if (IsInPrivateAddressSpace(endpoint))
- {
- return true;
- }
-
- const int lengthMatch = 4;
-
- if (endpoint.Length >= lengthMatch)
+ IPAddress address;
+ if (IPAddress.TryParse(endpoint, out address))
{
- var prefix = endpoint.Substring(0, lengthMatch);
+ var addressString = address.ToString();
- if (GetLocalIpAddresses()
- .Any(i => i.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)))
+ int lengthMatch = 100;
+ if (address.AddressFamily == AddressFamily.InterNetwork)
{
- return true;
+ lengthMatch = 4;
+ if (IsInPrivateAddressSpace(addressString))
+ {
+ return true;
+ }
+ }
+ else if (address.AddressFamily == AddressFamily.InterNetworkV6)
+ {
+ lengthMatch = 10;
+ if (IsInPrivateAddressSpace(endpoint))
+ {
+ return true;
+ }
}
- }
- IPAddress address;
- if (resolveHost && !IPAddress.TryParse(endpoint, out address))
+ // Should be even be doing this with ipv6?
+ if (addressString.Length >= lengthMatch)
+ {
+ var prefix = addressString.Substring(0, lengthMatch);
+
+ if (GetLocalIpAddresses()
+ .Any(i => i.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)))
+ {
+ return true;
+ }
+ }
+ }
+ else if (resolveHost)
{
Uri uri;
if (Uri.TryCreate(endpoint, UriKind.RelativeOrAbsolute, out uri))
diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs
index 0e50f9315..c7423a775 100644
--- a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs
+++ b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs
@@ -128,7 +128,18 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
DeleteEmptyFolders(directory);
if (!_fileSystem.GetFileSystemEntryPaths(directory).Any())
{
- _fileSystem.DeleteDirectory(directory, false);
+ try
+ {
+ _fileSystem.DeleteDirectory(directory, false);
+ }
+ catch (UnauthorizedAccessException ex)
+ {
+ _logger.ErrorException("Error deleting directory {0}", ex, directory);
+ }
+ catch (IOException ex)
+ {
+ _logger.ErrorException("Error deleting directory {0}", ex, directory);
+ }
}
}
}
@@ -139,6 +150,10 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
{
_fileSystem.DeleteFile(path);
}
+ catch (UnauthorizedAccessException ex)
+ {
+ _logger.ErrorException("Error deleting file {0}", ex, path);
+ }
catch (IOException ex)
{
_logger.ErrorException("Error deleting file {0}", ex, path);
diff --git a/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs b/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs
index d4fa74a86..e796dba76 100644
--- a/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs
+++ b/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs
@@ -21,7 +21,7 @@ namespace MediaBrowser.Common.Implementations.Security
public class PluginSecurityManager : ISecurityManager
{
private const string MBValidateUrl = MbAdmin.HttpsUrl + "service/registration/validate";
- private const string AppstoreRegUrl = /*MbAdmin.HttpsUrl*/ "http://mb3admin.com/admin/" + "service/appstore/register";
+ private const string AppstoreRegUrl = /*MbAdmin.HttpsUrl*/ "http://mb3admin.com/admin/service/appstore/register";
/// <summary>
/// The _is MB supporter
diff --git a/MediaBrowser.Common.Implementations/packages.config b/MediaBrowser.Common.Implementations/packages.config
index a0711a9c7..769a7c4f6 100644
--- a/MediaBrowser.Common.Implementations/packages.config
+++ b/MediaBrowser.Common.Implementations/packages.config
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CommonIO" version="1.0.0.5" targetFramework="net45" />
- <package id="NLog" version="4.1.0" targetFramework="net45" />
+ <package id="NLog" version="4.2.0" targetFramework="net45" />
<package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" />
- <package id="SimpleInjector" version="3.0.5" targetFramework="net45" />
+ <package id="SimpleInjector" version="3.1.0" targetFramework="net45" />
</packages>