Commit 48e9de81 authored by justcoding121's avatar justcoding121

dictionary is thread safe (no lock needed); update BC

parent 5d778739
......@@ -317,7 +317,7 @@ namespace Titanium.Web.Proxy.Network
var info = new ProcessStartInfo
{
FileName = "certutil.exe",
Arguments = "-importPFX -p \""+ PfxPassword + "\" -f \"" + fileName + "\"",
Arguments = "-importPFX -p \"" + PfxPassword + "\" -f \"" + fileName + "\"",
CreateNoWindow = true,
UseShellExecute = true,
Verb = "runas",
......@@ -458,10 +458,6 @@ namespace Titanium.Web.Proxy.Network
}
X509Certificate2 certificate = null;
lock (string.Intern(certificateName))
{
if (certificateCache.ContainsKey(certificateName) == false)
{
try
{
if (!isRootCertificate && SaveFakeCertificates)
......@@ -498,24 +494,16 @@ namespace Titanium.Web.Proxy.Network
exceptionFunc(e);
}
if (certificate != null && !certificateCache.ContainsKey(certificateName))
if (certificate != null)
{
//this is ConcurrentDictionary
//if key exists it will silently handle; no need for locking
certificateCache.Add(certificateName, new CachedCertificate
{
Certificate = certificate
});
}
}
else
{
if (certificateCache.ContainsKey(certificateName))
{
var cached = certificateCache[certificateName];
cached.LastAccess = DateTime.Now;
return cached.Certificate;
}
}
}
return certificate;
}
......
......@@ -12,7 +12,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Portable.BouncyCastle" Version="1.8.1.3" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.1.4" />
<PackageReference Include="StreamExtended" Version="1.0.135-beta" />
</ItemGroup>
......
......@@ -15,7 +15,7 @@
<tags></tags>
<dependencies>
<dependency id="StreamExtended" version="1.0.110-beta" />
<dependency id="Portable.BouncyCastle" version="1.8.1.3" />
<dependency id="Portable.BouncyCastle" version="1.8.1.4" />
</dependencies>
</metadata>
<files>
......
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Portable.BouncyCastle" version="1.8.1.3" targetFramework="net45" />
<package id="Portable.BouncyCastle" version="1.8.1.4" targetFramework="net45" />
<package id="StreamExtended" version="1.0.110-beta" targetFramework="net45" />
</packages>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment