Commit 062fd95d authored by titanium007's avatar titanium007

update readme

parent 63072d01
...@@ -30,16 +30,14 @@ DO_NOT_TRUST_FiddlerRoot.cer ...@@ -30,16 +30,14 @@ DO_NOT_TRUST_FiddlerRoot.cer
Setup HTTP proxy: Setup HTTP proxy:
```csharp ```csharp
// listen to client request & server response events
ProxyServer.BeforeRequest += OnRequest; ProxyServer.BeforeRequest += OnRequest;
ProxyServer.BeforeResponse += OnResponse; ProxyServer.BeforeResponse += OnResponse;
ProxyServer.EnableSSL = true; ProxyServer.EnableSSL = true;
ProxyServer.SetAsSystemProxy = true; ProxyServer.SetAsSystemProxy = true;
ProxyServer.Start(); ProxyServer.Start();
// listen to client request & server response events
ProxyServer.BeforeRequest += OnRequest;
ProxyServer.BeforeResponse += OnResponse;
//wait here (You can use something else as a wait function, I am using this as a demo) //wait here (You can use something else as a wait function, I am using this as a demo)
Console.Read(); Console.Read();
...@@ -54,24 +52,24 @@ Sample request and response event handlers ...@@ -54,24 +52,24 @@ Sample request and response event handlers
```csharp ```csharp
public void OnRequest(object sender, SessionEventArgs e) public void OnRequest(object sender, SessionEventArgs e)
{ {
//Modify e.ProxyRequest //Modify e.ProxyRequest
} }
public void OnResponse(object sender, SessionEventArgs e) public void OnResponse(object sender, SessionEventArgs e)
{ {
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
e.GetResponseBody(); e.GetResponseBody();
//Modify e.ServerResponse //Modify e.ServerResponse
e.ResponseString = "<html><head></head><body>Response is modified!</body></html>"; e.ResponseString = "<html><head></head><body>Response is modified!</body></html>";
}
} }
} }
}
``` ```
Future updates Future updates
============ ============
......
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