Commit 74ed1c2e authored by titanium007's avatar titanium007

Comment out sample code

parent 11563d36
...@@ -26,18 +26,6 @@ After installing nuget package mark following files to be copied to app director ...@@ -26,18 +26,6 @@ After installing nuget package mark following files to be copied to app director
* makecert.exe * makecert.exe
* Titanium_Proxy_Test_Root.cer * Titanium_Proxy_Test_Root.cer
Or install manually:
Add reference to
* Titanium.Web.Proxy.dll
These files also should be in your application directory
* Ionic.Zip.dll
* makecert.exe
* Titanium_Proxy_Test_Root.cer
Setup HTTP proxy: Setup HTTP proxy:
......
...@@ -60,22 +60,22 @@ namespace Titanium.Web.Proxy.Test ...@@ -60,22 +60,22 @@ namespace Titanium.Web.Proxy.Test
Console.WriteLine(e.RequestURL); Console.WriteLine(e.RequestURL);
if (e.RequestURL.Contains("somewebsite.com")) //if (e.RequestURL.Contains("somewebsite.com"))
if ((e.ProxyRequest.Method.ToUpper() == "POST" || e.ProxyRequest.Method.ToUpper() == "PUT") && e.ProxyRequest.ContentLength > 0) // if ((e.ProxyRequest.Method.ToUpper() == "POST" || e.ProxyRequest.Method.ToUpper() == "PUT") && e.ProxyRequest.ContentLength > 0)
{ // {
var m = e.GetRequestBody().Replace("a", "b"); // var m = e.GetRequestBody().Replace("a", "b");
e.SetRequestBody(m); // e.SetRequestBody(m);
} // }
//To cancel a request with a custom HTML content ////To cancel a request with a custom HTML content
//Filter URL ////Filter URL
if (e.RequestURL.Contains("somewebsite.com")) //if (e.RequestURL.Contains("somewebsite.com"))
{ //{
e.Ok("<!DOCTYPE html><html><body><h1>Blocked</h1><p>Website blocked.</p></body></html>"); // e.Ok("<!DOCTYPE html><html><body><h1>Blocked</h1><p>Website blocked.</p></body></html>");
} //}
} }
...@@ -85,21 +85,21 @@ namespace Titanium.Web.Proxy.Test ...@@ -85,21 +85,21 @@ namespace Titanium.Web.Proxy.Test
{ {
//To modify a response //To modify a response
if (e.ServerResponse.StatusCode == HttpStatusCode.OK) //if (e.ServerResponse.StatusCode == HttpStatusCode.OK)
{ //{
if (e.ServerResponse.ContentType.Trim().ToLower().Contains("text/html")) // if (e.ServerResponse.ContentType.Trim().ToLower().Contains("text/html"))
{ // {
//Get response body // //Get response body
string responseBody = e.GetResponseBody(); // string responseBody = e.GetResponseBody();
//Modify e.ServerResponse // //Modify e.ServerResponse
Regex rex = new Regex("</body>", RegexOptions.RightToLeft | RegexOptions.IgnoreCase | RegexOptions.Multiline); // Regex rex = new Regex("</body>", RegexOptions.RightToLeft | RegexOptions.IgnoreCase | RegexOptions.Multiline);
string modified = rex.Replace(responseBody, "<script type =\"text/javascript\">alert('Response was modified by this script!');</script></body>", 1); // string modified = rex.Replace(responseBody, "<script type =\"text/javascript\">alert('Response was modified by this script!');</script></body>", 1);
//Set modifed response Html Body // //Set modifed response Html Body
e.SetResponseBody(modified); // e.SetResponseBody(modified);
} // }
} //}
} }
......
...@@ -110,7 +110,7 @@ namespace Titanium.Web.Proxy ...@@ -110,7 +110,7 @@ namespace Titanium.Web.Proxy
//Pinned certificate clients cannot be proxied //Pinned certificate clients cannot be proxied
//For example dropbox clients use certificate pinning //For example dropbox clients use certificate pinning
//So just relay the request //So just relay the request
if (!ExcludedHttpsHostNameRegex.Any(x=> Regex.IsMatch(HttpsHostName,x))) if (!ExcludedHttpsHostNameRegex.Any(x => Regex.IsMatch(HttpsHostName, x)))
{ {
try try
{ {
......
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