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

Commit dd18df3

Browse files
Merge pull request #539 from justcoding121/beta
Stable
2 parents 09ae3f1 + 7703da2 commit dd18df3

File tree

116 files changed

+7987
-1444
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+7987
-1444
lines changed

.build/build.ps1

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,27 @@ $MSBuild -replace ' ', '` '
3535
FormatTaskName (("-"*25) + "[{0}]" + ("-"*25))
3636

3737
#default task
38-
Task default -depends Clean, Build, Document, Package
38+
Task default -depends Package
3939

4040
#cleans obj, b
4141
Task Clean {
4242
Get-ChildItem .\ -include bin,obj -Recurse | foreach ($_) { Remove-Item $_.fullname -Force -Recurse }
4343
exec { . $MSBuild $SolutionFile /t:Clean /v:quiet }
4444
}
4545

46+
#install root cetificate needed for integration tests
47+
Task Setup-Integration-Test-Tools -depends Clean {
48+
49+
$startInfo = new-object System.Diagnostics.ProcessStartInfo "PowerShell";
50+
$startInfo.Arguments = "$Here\install-certificate.ps1";
51+
$startInfo.Verb = "runas";
52+
$process = [System.Diagnostics.Process]::Start($startInfo);
53+
$process.WaitForExit()
54+
55+
}
56+
4657
#install build tools
47-
Task Install-BuildTools -depends Clean {
58+
Task Install-BuildTools -depends Setup-Integration-Test-Tools {
4859
if(!(Test-Path $MSBuild))
4960
{
5061
cinst microsoft-build-tools -y

.build/cleanup-cache.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Modify this text to trigger appveyor build cache

.build/install-certificate.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
$Here = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
2+
3+
$pfx = new-object System.Security.Cryptography.X509Certificates.X509Certificate2
4+
$certPath = "$Here\lib\rootCert.pfx"
5+
$pfxPass = ""
6+
$pfx.import($certPath,$pfxPass,"Exportable,PersistKeySet")
7+
$store = new-object System.Security.Cryptography.X509Certificates.X509Store([System.Security.Cryptography.X509Certificates.StoreName]::Root, "localmachine")
8+
$store.open("MaxAllowed")
9+
$store.add($pfx)
10+
$store.close()

.build/lib/rootCert.pfx

2.63 KB
Binary file not shown.

.build/setup.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function Install-DocFx()
3636
{
3737
if(!(Test-Path $env:ChocolateyInstall\lib\docfx\tools*))
3838
{
39-
choco install docfx
39+
choco install docfx --version 2.40.1
4040
}
4141
$env:Path += ";$env:ChocolateyInstall\lib\docfx\tools"
4242
}

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"**/*.Basic.csproj/": true,
1616
"**/*.Docs.csproj/": true,
1717
"**/*.Proxy.csproj/": true,
18-
"**/*.Proxy.csproj" : true
18+
"**/*.Mono.csproj" : true
1919
},
2020
"search.exclude": {
2121
"**/.build": true,
@@ -32,6 +32,6 @@
3232
"**/*.Basic.csproj/": true,
3333
"**/*.Docs.csproj/": true,
3434
"**/*.Proxy.csproj/": true,
35-
"**/*.Proxy.csproj" : true
35+
"**/*.Mono.csproj" : true
3636
}
3737
}

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
## Titanium Web Proxy
22

3-
A light weight HTTP(S) proxy server written in C#
3+
A lightweight HTTP(S) proxy server written in C#.
44

5-
<a href="https://ci.appveyor.com/project/justcoding121/titanium-web-proxy">![Build Status](https://ci.appveyor.com/api/projects/status/rvlxv8xgj0m7lkr4?svg=true)</a> [![Join the chat at https://gitter.im/Titanium-Web-Proxy/Lobby](https://badges.gitter.im/Titanium-Web-Proxy/Lobby.svg)](https://gitter.im/Titanium-Web-Proxy/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5+
<a href="https://ci.appveyor.com/project/justcoding121/titanium-web-proxy">![Build Status](https://ci.appveyor.com/api/projects/status/p5vvtbpx9yp250ol?svg=true)</a> [![Join the chat at https://gitter.im/Titanium-Web-Proxy/Lobby](https://badges.gitter.im/Titanium-Web-Proxy/Lobby.svg)](https://gitter.im/Titanium-Web-Proxy/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
66

7-
Kindly report only issues/bugs here . For programming help or questions use [StackOverflow](http://stackoverflow.com/questions/tagged/titanium-web-proxy) with the tag Titanium-Web-Proxy.
7+
Kindly report only issues/bugs here. For programming help or questions use [StackOverflow](http://stackoverflow.com/questions/tagged/titanium-web-proxy) with the tag Titanium-Web-Proxy.
88

99
* [API Documentation](https://justcoding121.github.io/Titanium-Web-Proxy/docs/api/Titanium.Web.Proxy.ProxyServer.html)
1010
* [Wiki & Contribution guidelines](https://github.com/justcoding121/Titanium-Web-Proxy/wiki)
1111

1212
### Features
1313

14-
* Multithreaded & fully asynchronous proxy employing server connection pooling, certificate cache & buffer pooling
15-
* View/modify/redirect/block requests & responses
14+
* Multi-threaded fully asynchronous proxy employing server connection pooling, certificate cache, and buffer pooling
15+
* View/modify/redirect/block requests and responses
1616
* Supports mutual SSL authentication, proxy authentication & automatic upstream proxy detection
1717
* Kerberos/NTLM authentication over HTTP protocols for windows domain
1818

@@ -48,7 +48,7 @@ Supports
4848

4949
### Usage
5050

51-
Refer the HTTP Proxy Server library in your project, look up Test project to learn usage.
51+
Refer the HTTP Proxy Server library in your project and look up the test project to learn usage.
5252

5353
Setup HTTP proxy:
5454

@@ -126,7 +126,7 @@ Sample request and response event handlers
126126

127127
private async Task OnBeforeTunnelConnectRequest(object sender, TunnelConnectSessionEventArgs e)
128128
{
129-
string hostname = e.WebSession.Request.RequestUri.Host;
129+
string hostname = e.HttpClient.Request.RequestUri.Host;
130130

131131
if (hostname.Contains("dropbox.com"))
132132
{
@@ -139,12 +139,12 @@ private async Task OnBeforeTunnelConnectRequest(object sender, TunnelConnectSess
139139

140140
public async Task OnRequest(object sender, SessionEventArgs e)
141141
{
142-
Console.WriteLine(e.WebSession.Request.Url);
142+
Console.WriteLine(e.HttpClient.Request.Url);
143143

144144
////read request headers
145-
var requestHeaders = e.WebSession.Request.RequestHeaders;
145+
var requestHeaders = e.HttpClient.Request.RequestHeaders;
146146

147-
var method = e.WebSession.Request.Method.ToUpper();
147+
var method = e.HttpClient.Request.Method.ToUpper();
148148
if ((method == "POST" || method == "PUT" || method == "PATCH"))
149149
{
150150
//Get/Set request body bytes
@@ -157,12 +157,12 @@ public async Task OnRequest(object sender, SessionEventArgs e)
157157

158158
//store request
159159
//so that you can find it from response handler
160-
e.UserData = e.WebSession.Request;
160+
e.UserData = e.HttpClient.Request;
161161
}
162162

163163
//To cancel a request with a custom HTML content
164164
//Filter URL
165-
if (e.WebSession.Request.RequestUri.AbsoluteUri.Contains("google.com"))
165+
if (e.HttpClient.Request.RequestUri.AbsoluteUri.Contains("google.com"))
166166
{
167167
e.Ok("<!DOCTYPE html>" +
168168
"<html><body><h1>" +
@@ -173,7 +173,7 @@ public async Task OnRequest(object sender, SessionEventArgs e)
173173
"</html>");
174174
}
175175
//Redirect example
176-
if (e.WebSession.Request.RequestUri.AbsoluteUri.Contains("wikipedia.org"))
176+
if (e.HttpClient.Request.RequestUri.AbsoluteUri.Contains("wikipedia.org"))
177177
{
178178
e.Redirect("https://www.paypal.com");
179179
}
@@ -183,14 +183,14 @@ public async Task OnRequest(object sender, SessionEventArgs e)
183183
public async Task OnResponse(object sender, SessionEventArgs e)
184184
{
185185
//read response headers
186-
var responseHeaders = e.WebSession.Response.ResponseHeaders;
186+
var responseHeaders = e.HttpClient.Response.ResponseHeaders;
187187

188188
//if (!e.ProxySession.Request.Host.Equals("medeczane.sgk.gov.tr")) return;
189-
if (e.WebSession.Request.Method == "GET" || e.WebSession.Request.Method == "POST")
189+
if (e.HttpClient.Request.Method == "GET" || e.HttpClient.Request.Method == "POST")
190190
{
191-
if (e.WebSession.Response.ResponseStatusCode == "200")
191+
if (e.HttpClient.Response.ResponseStatusCode == "200")
192192
{
193-
if (e.WebSession.Response.ContentType!=null && e.WebSession.Response.ContentType.Trim().ToLower().Contains("text/html"))
193+
if (e.HttpClient.Response.ContentType!=null && e.HttpClient.Response.ContentType.Trim().ToLower().Contains("text/html"))
194194
{
195195
byte[] bodyBytes = await e.GetResponseBody();
196196
await e.SetResponseBody(bodyBytes);
@@ -228,7 +228,7 @@ public Task OnCertificateSelection(object sender, CertificateSelectionEventArgs
228228
```
229229
### Note to contributors
230230

231-
#### Roadmap
231+
#### Road map
232232

233233
* Support HTTP 2.0
234234

appveyor.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
version: 3.0.{build}
1111
image: Visual Studio 2017
1212

13-
shallow_clone: true
13+
shallow_clone: false
1414

1515
#---------------------------------#
1616
# build configuration #
@@ -22,10 +22,13 @@ platform: Any CPU
2222
# build Configuration, i.e. Debug, Release, etc.
2323
configuration: Release
2424

25+
#set file change to watch so that cache can be invalidated on demand.
26+
cache: .build\cleanup-cache.txt
27+
2528
# to run your custom scripts instead of automatic MSBuild
2629
build_script:
2730
- cmd: build.bat Package
28-
31+
2932
assembly_info:
3033
patch: true
3134
file: AssemblyInfo.*

docs/api/Titanium.Web.Proxy.EventArguments.AsyncEventHandler-1.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<meta name="viewport" content="width=device-width">
1111
<meta name="title" content="Delegate AsyncEventHandler&lt;TEventArgs&gt;
1212
| Titanium Web Proxy ">
13-
<meta name="generator" content="docfx 2.39.2.0">
13+
<meta name="generator" content="docfx 2.40.1.0">
1414

1515
<link rel="shortcut icon" href="../favicon.ico">
1616
<link rel="stylesheet" href="../styles/docfx.vendor.css">
@@ -154,6 +154,12 @@ <h5 class="typeParameters">Type Parameters</h5>
154154
<div class="sideaffix">
155155
<div class="contribution">
156156
<ul class="nav">
157+
<li>
158+
<a href="https://github.com/justcoding121/Titanium-Web-Proxy/new/master/apiSpec/new?filename=Titanium_Web_Proxy_EventArguments_AsyncEventHandler_1.md&amp;value=---%0Auid%3A%20Titanium.Web.Proxy.EventArguments.AsyncEventHandler%601%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A" class="contribution-link">Improve this Doc</a>
159+
</li>
160+
<li>
161+
<a href="https://github.com/justcoding121/Titanium-Web-Proxy/blob/master/src/Titanium.Web.Proxy/EventArguments/AsyncEventHandler.cs/#L12" class="contribution-link">View Source</a>
162+
</li>
157163
</ul>
158164
</div>
159165
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">

docs/api/Titanium.Web.Proxy.EventArguments.BeforeSslAuthenticateEventArgs.html

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<meta name="viewport" content="width=device-width">
1111
<meta name="title" content="Class BeforeSslAuthenticateEventArgs
1212
| Titanium Web Proxy ">
13-
<meta name="generator" content="docfx 2.39.2.0">
13+
<meta name="generator" content="docfx 2.40.1.0">
1414

1515
<link rel="shortcut icon" href="../favicon.ico">
1616
<link rel="stylesheet" href="../styles/docfx.vendor.css">
@@ -127,8 +127,13 @@ <h5 id="Titanium_Web_Proxy_EventArguments_BeforeSslAuthenticateEventArgs_syntax"
127127
</div>
128128
<h3 id="properties">Properties
129129
</h3>
130-
131-
130+
<span class="small pull-right mobile-hide">
131+
<span class="divider">|</span>
132+
<a href="https://github.com/justcoding121/Titanium-Web-Proxy/new/master/apiSpec/new?filename=Titanium_Web_Proxy_EventArguments_BeforeSslAuthenticateEventArgs_DecryptSsl.md&amp;value=---%0Auid%3A%20Titanium.Web.Proxy.EventArguments.BeforeSslAuthenticateEventArgs.DecryptSsl%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
133+
</span>
134+
<span class="small pull-right mobile-hide">
135+
<a href="https://github.com/justcoding121/Titanium-Web-Proxy/blob/master/src/Titanium.Web.Proxy/EventArguments/BeforeSslAuthenticateEventArgs.cs/#L29">View Source</a>
136+
</span>
132137
<a id="Titanium_Web_Proxy_EventArguments_BeforeSslAuthenticateEventArgs_DecryptSsl_" data-uid="Titanium.Web.Proxy.EventArguments.BeforeSslAuthenticateEventArgs.DecryptSsl*"></a>
133138
<h4 id="Titanium_Web_Proxy_EventArguments_BeforeSslAuthenticateEventArgs_DecryptSsl" data-uid="Titanium.Web.Proxy.EventArguments.BeforeSslAuthenticateEventArgs.DecryptSsl">DecryptSsl</h4>
134139
<div class="markdown level1 summary"><p>Should we decrypt the SSL request?
@@ -155,8 +160,13 @@ <h5 class="propertyValue">Property Value</h5>
155160
</tr>
156161
</tbody>
157162
</table>
158-
159-
163+
<span class="small pull-right mobile-hide">
164+
<span class="divider">|</span>
165+
<a href="https://github.com/justcoding121/Titanium-Web-Proxy/new/master/apiSpec/new?filename=Titanium_Web_Proxy_EventArguments_BeforeSslAuthenticateEventArgs_SniHostName.md&amp;value=---%0Auid%3A%20Titanium.Web.Proxy.EventArguments.BeforeSslAuthenticateEventArgs.SniHostName%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
166+
</span>
167+
<span class="small pull-right mobile-hide">
168+
<a href="https://github.com/justcoding121/Titanium-Web-Proxy/blob/master/src/Titanium.Web.Proxy/EventArguments/BeforeSslAuthenticateEventArgs.cs/#L22">View Source</a>
169+
</span>
160170
<a id="Titanium_Web_Proxy_EventArguments_BeforeSslAuthenticateEventArgs_SniHostName_" data-uid="Titanium.Web.Proxy.EventArguments.BeforeSslAuthenticateEventArgs.SniHostName*"></a>
161171
<h4 id="Titanium_Web_Proxy_EventArguments_BeforeSslAuthenticateEventArgs_SniHostName" data-uid="Titanium.Web.Proxy.EventArguments.BeforeSslAuthenticateEventArgs.SniHostName">SniHostName</h4>
162172
<div class="markdown level1 summary"><p>The server name indication hostname if available. Otherwise the generic certificate hostname of
@@ -184,8 +194,13 @@ <h5 class="propertyValue">Property Value</h5>
184194
</table>
185195
<h3 id="methods">Methods
186196
</h3>
187-
188-
197+
<span class="small pull-right mobile-hide">
198+
<span class="divider">|</span>
199+
<a href="https://github.com/justcoding121/Titanium-Web-Proxy/new/master/apiSpec/new?filename=Titanium_Web_Proxy_EventArguments_BeforeSslAuthenticateEventArgs_TerminateSession.md&amp;value=---%0Auid%3A%20Titanium.Web.Proxy.EventArguments.BeforeSslAuthenticateEventArgs.TerminateSession%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
200+
</span>
201+
<span class="small pull-right mobile-hide">
202+
<a href="https://github.com/justcoding121/Titanium-Web-Proxy/blob/master/src/Titanium.Web.Proxy/EventArguments/BeforeSslAuthenticateEventArgs.cs/#L34">View Source</a>
203+
</span>
189204
<a id="Titanium_Web_Proxy_EventArguments_BeforeSslAuthenticateEventArgs_TerminateSession_" data-uid="Titanium.Web.Proxy.EventArguments.BeforeSslAuthenticateEventArgs.TerminateSession*"></a>
190205
<h4 id="Titanium_Web_Proxy_EventArguments_BeforeSslAuthenticateEventArgs_TerminateSession" data-uid="Titanium.Web.Proxy.EventArguments.BeforeSslAuthenticateEventArgs.TerminateSession">TerminateSession()</h4>
191206
<div class="markdown level1 summary"><p>Terminate the request abruptly by closing client/server connections.</p>
@@ -202,6 +217,12 @@ <h5 class="decalaration">Declaration</h5>
202217
<div class="sideaffix">
203218
<div class="contribution">
204219
<ul class="nav">
220+
<li>
221+
<a href="https://github.com/justcoding121/Titanium-Web-Proxy/new/master/apiSpec/new?filename=Titanium_Web_Proxy_EventArguments_BeforeSslAuthenticateEventArgs.md&amp;value=---%0Auid%3A%20Titanium.Web.Proxy.EventArguments.BeforeSslAuthenticateEventArgs%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A" class="contribution-link">Improve this Doc</a>
222+
</li>
223+
<li>
224+
<a href="https://github.com/justcoding121/Titanium-Web-Proxy/blob/master/src/Titanium.Web.Proxy/EventArguments/BeforeSslAuthenticateEventArgs.cs/#L9" class="contribution-link">View Source</a>
225+
</li>
205226
</ul>
206227
</div>
207228
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">

0 commit comments

Comments
 (0)