Skip to content
This repository was archived by the owner on Jul 9, 2023. It is now read-only.

Merge master to release #42

Merged
merged 5 commits into from
Feb 24, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 12 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Refer the HTTP Proxy Server library in your project, look up Test project to lea

Install by nuget:

Install-Package Titanium.Web.Proxy -Pre
Install-Package Titanium.Web.Proxy

After installing nuget package mark following files to be copied to app directory

Expand All @@ -37,43 +37,25 @@ Setup HTTP proxy:
ProxyServer.BeforeRequest += OnRequest;
ProxyServer.BeforeResponse += OnResponse;

//Exclude Https addresses you don't want to proxy
//Usefull for clients that use certificate pinning
//for example dropbox.com
var explicitEndPoint = new ExplicitProxyEndPoint(IPAddress.Any, 8000, true){
//Exclude Https addresses you don't want to proxy/cannot be proxied
//for example exclude dropbox client which use certificate pinning
ExcludedHttpsHostNameRegex = new List<string>() { "dropbox.com" }
};

//An explicit endpoint is where the client knows about the existance of a proxy
//So client sends request in a proxy friendly manner
//Add an explicit endpoint where the client is aware of the proxy
//So client would send request in a proxy friendly manner
ProxyServer.AddEndPoint(explicitEndPoint);
ProxyServer.Start();


//Transparent endpoint is usefull for reverse proxying (client is not aware of the existance of proxy)
//A transparent endpoint usually requires a network router port forwarding HTTP(S) packets to this endpoint
//Currently do not support Server Name Indication (It is not currently supported by SslStream class)
//That means that the transparent endpoint will always provide the same Generic Certificate to all HTTPS requests
//In this example only google.com will work for HTTPS requests
//Other sites will receive a certificate mismatch warning on browser
//Please read about it before asking questions!
var transparentEndPoint = new TransparentProxyEndPoint(IPAddress.Any, 8001, true) {
GenericCertificateName = "google.com"
};
ProxyServer.AddEndPoint(transparentEndPoint);



//Only explicit proxies can be set as a system proxy!
ProxyServer.SetAsSystemHttpProxy(explicitEndPoint);
ProxyServer.SetAsSystemHttpsProxy(explicitEndPoint);

foreach (var endPoint in ProxyServer.ProxyEndPoints)
Console.WriteLine("Listening on '{0}' endpoint at Ip {1} and port: {2} ",
endPoint.GetType().Name, endPoint.IpAddress, endPoint.Port);

//You can also add/remove end points after proxy has been started
ProxyServer.RemoveEndPoint(transparentEndPoint);

//Only explicit proxies can be set as system proxy!
ProxyServer.SetAsSystemHttpProxy(explicitEndPoint);
ProxyServer.SetAsSystemHttpsProxy(explicitEndPoint);

//wait here (You can use something else as a wait function, I am using this as a demo)
Console.Read();

Expand All @@ -82,7 +64,6 @@ Setup HTTP proxy:
ProxyServer.BeforeResponse -= OnResponse;
ProxyServer.Stop();


```
Sample request and response event handlers

Expand Down Expand Up @@ -144,10 +125,10 @@ Sample request and response event handlers
}
}
```
Future updates
Future roadmap
============
* Add callbacks for client/server certificate validation/selection
* Support mutual authentication
* Add Server Name Indication (SNI) for transparent endpoints
* Support Server Name Indication (SNI) for transparent endpoints
* Support HTTP 2.0