Commit 9152f131 authored by justcoding121's avatar justcoding121

update readme & comments on code

parent 05c2b1de
......@@ -152,7 +152,7 @@ public async Task OnRequest(object sender, SessionEventArgs e)
//Filter URL
if (e.WebSession.Request.RequestUri.AbsoluteUri.Contains("google.com"))
{
await e.Ok("<!DOCTYPE html>" +
e.Ok("<!DOCTYPE html>" +
"<html><body><h1>" +
"Website Blocked" +
"</h1>" +
......@@ -163,7 +163,7 @@ public async Task OnRequest(object sender, SessionEventArgs e)
//Redirect example
if (e.WebSession.Request.RequestUri.AbsoluteUri.Contains("wikipedia.org"))
{
await e.Redirect("https://www.paypal.com");
e.Redirect("https://www.paypal.com");
}
}
......
......@@ -509,7 +509,7 @@ namespace Titanium.Web.Proxy.Network
}
//handle burst requests with same certificate name
//by checking for existing creation task for same certificate name
//by checking for existing task for same certificate name
Task<X509Certificate2> task;
if (pendingCertificateCreationTasks.TryGetValue(certificateName, out task))
{
......@@ -518,7 +518,7 @@ namespace Titanium.Web.Proxy.Network
return await task;
}
//run certificate creation task
//run certificate creation task & add it to pending tasks
task = Task.Run(() =>
{
var result = CreateCertificate(certificateName, false);
......@@ -534,9 +534,9 @@ namespace Titanium.Web.Proxy.Network
}
return result;
});
pendingCertificateCreationTasks.TryAdd(certificateName, task);
//cleanup pending tasks & return result
pendingCertificateCreationTasks.TryAdd(certificateName, task);
var certificate = await task;
pendingCertificateCreationTasks.TryRemove(certificateName, out task);
......
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