Commit 158b6143 authored by justcoding121's avatar justcoding121 Committed by justcoding121

Fix event handler

parent 487b8912
Titanium.ProxyTest/Capture.PNG

27.1 KB | W: | H:

Titanium.ProxyTest/Capture.PNG

23.8 KB | W: | H:

Titanium.ProxyTest/Capture.PNG
Titanium.ProxyTest/Capture.PNG
Titanium.ProxyTest/Capture.PNG
Titanium.ProxyTest/Capture.PNG
  • 2-up
  • Swipe
  • Onion skin
......@@ -19,17 +19,19 @@ namespace Titanium.HTTPProxyServer.Test
//Start proxy controller
var controller = new ProxyTestController();
controller.StartProxy();
controller.Visited += PageVisited;
Console.WriteLine("Do you want to monitor HTTPS? (Y/N)");
controller.StartProxy();
Console.Write("Do you want to monitor HTTPS? (Y/N):");
if(Console.ReadLine().Trim().ToLower()=="y" )
{
InstallCertificate(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location));
SystemProxyUtility.EnableProxyHTTPS("localhost", controller.ListeningPort);
}
Console.WriteLine("Hit any key to exit");
Console.WriteLine("Hit any key to exit..");
Console.WriteLine();
Console.Read();
//Reset System Proxy on exit
......@@ -54,7 +56,7 @@ namespace Titanium.HTTPProxyServer.Test
}
private static void PageVisited(VisitedEventArgs e)
{
Console.WriteLine(string.Concat("Visited:", e.URL));
Console.WriteLine(string.Concat("Visited: ", e.URL));
}
static bool ConsoleEventCallback(int eventType)
{
......
......@@ -17,34 +17,37 @@ namespace Titanium.HTTPProxyServer.Test
{
private List<string> _URLList = new List<string>();
private string _lastURL = string.Empty;
private ProxyServer _server;
public int ListeningPort { get; set; }
public void StartProxy()
{
_server = new ProxyServer();
_server.BeforeRequest += OnRequest;
_server.BeforeResponse += OnResponse;
_server.Start();
if(Visited!=null)
{
ProxyServer.BeforeRequest += OnRequest;
ProxyServer.BeforeResponse += OnResponse;
}
ProxyServer.Start();
SystemProxyUtility.EnableProxyHTTP("localhost", _server.ListeningPort);
SystemProxyUtility.EnableProxyHTTP("localhost", ProxyServer.ListeningPort);
FireFoxUtility.AddFirefox();
ListeningPort = _server.ListeningPort;
ListeningPort = ProxyServer.ListeningPort;
Console.WriteLine(String.Format("Proxy listening on local machine port: {0} ", _server.ListeningPort));
Console.WriteLine(String.Format("Proxy listening on local machine port: {0} ", ProxyServer.ListeningPort));
}
public void Stop()
{
_server.BeforeRequest -= OnRequest;
_server.BeforeResponse -= OnResponse;
_server.Stop();
if (Visited!=null)
{
ProxyServer.BeforeRequest -= OnRequest;
ProxyServer.BeforeResponse -= OnResponse;
}
ProxyServer.Stop();
}
......
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