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

Commit dd20e92

Browse files
committed
Merge pull request #28 from titanium007/breaking-change
Breaking change
2 parents 40e13c4 + 26b995d commit dd20e92

19 files changed

+803
-453
lines changed

.build/default.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ if(!$Configuration) { $Configuration = "Release" }
2323
if(!$Version) { $Version = $env:APPVEYOR_BUILD_VERSION }
2424
if(!$Version) { $Version = "1.0.$BuildNumber" }
2525

26+
if(!$Branch) { $Branch = $env:APPVEYOR_REPO_BRANCH }
27+
if(!$Branch) { $Branch = "local" }
28+
if($Branch -eq "release" ) { $Version = "$Version-beta" }
29+
2630
Import-Module "$Here\Common" -DisableNameChecking
2731

2832
$NuGet = Join-Path $SolutionRoot ".nuget\nuget.exe"

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ Sample request and response event handlers
5858
//Test On Request, intercept requests
5959
public void OnRequest(object sender, SessionEventArgs e)
6060
{
61-
Console.WriteLine(e.RequestURL);
62-
61+
Console.WriteLine(e.ProxySession.Request.RequestUrl);
62+
6363
//read request headers
64-
var requestHeaders = e.RequestHeaders;
64+
var requestHeaders = e.ProxySession.Request.RequestHeaders;
6565

66-
if ((e.RequestMethod.ToUpper() == "POST" || e.RequestMethod.ToUpper() == "PUT") && e.RequestContentLength > 0)
66+
if ((e.RequestMethod.ToUpper() == "POST" || e.RequestMethod.ToUpper() == "PUT"))
6767
{
6868
//Get/Set request body bytes
6969
byte[] bodyBytes = e.GetRequestBody();
@@ -78,18 +78,19 @@ Sample request and response event handlers
7878
//To cancel a request with a custom HTML content
7979
//Filter URL
8080
81-
if (e.RequestURL.Contains("google.com"))
81+
if (e.ProxySession.Request.RequestUrl.Contains("google.com"))
8282
{
8383
e.Ok("<!DOCTYPE html><html><body><h1>Website Blocked</h1><p>Blocked by titanium web proxy.</p></body></html>");
8484
}
8585
}
8686

8787
public void OnResponse(object sender, SessionEventArgs e)
8888
{
89-
//read response headers
90-
var responseHeaders = e.ResponseHeaders;
89+
////read response headers
90+
var responseHeaders = e.ProxySession.Response.ResponseHeaders;
91+
9192

92-
if (e.ResponseStatusCode == HttpStatusCode.OK)
93+
if (e.ResponseStatusCode == "200")
9394
{
9495
if (e.ResponseContentType.Trim().ToLower().Contains("text/html"))
9596
{

Titanium.Web.Proxy.Test/App.config

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,17 @@
44
<startup>
55
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client" />
66
</startup>
7+
<runtime>
8+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
9+
<dependentAssembly>
10+
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
11+
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
12+
</dependentAssembly>
13+
<dependentAssembly>
14+
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
15+
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
16+
</dependentAssembly>
17+
</assemblyBinding>
18+
</runtime>
19+
720
</configuration>

Titanium.Web.Proxy.Test/ProxyTestController.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Text.RegularExpressions;
23
using Titanium.Web.Proxy.EventArguments;
34

45
namespace Titanium.Web.Proxy.Test
@@ -43,10 +44,10 @@ public void Stop()
4344
//Read browser URL send back to proxy by the injection script in OnResponse event
4445
public void OnRequest(object sender, SessionEventArgs e)
4546
{
46-
Console.WriteLine(e.RequestUrl);
47+
Console.WriteLine(e.ProxySession.Request.RequestUrl);
4748

4849
////read request headers
49-
//var requestHeaders = e.RequestHeaders;
50+
//var requestHeaders = e.ProxySession.Request.RequestHeaders;
5051

5152
//if ((e.RequestMethod.ToUpper() == "POST" || e.RequestMethod.ToUpper() == "PUT"))
5253
//{
@@ -63,7 +64,7 @@ public void OnRequest(object sender, SessionEventArgs e)
6364
////To cancel a request with a custom HTML content
6465
////Filter URL
6566

66-
//if (e.RequestURL.Contains("google.com"))
67+
//if (e.ProxySession.Request.RequestUrl.Contains("google.com"))
6768
//{
6869
// e.Ok("<!DOCTYPE html><html><body><h1>Website Blocked</h1><p>Blocked by titanium web proxy.</p></body></html>");
6970
//}
@@ -74,10 +75,10 @@ public void OnRequest(object sender, SessionEventArgs e)
7475
public void OnResponse(object sender, SessionEventArgs e)
7576
{
7677
////read response headers
77-
//var responseHeaders = e.ResponseHeaders;
78+
var responseHeaders = e.ProxySession.Response.ResponseHeaders;
7879

7980

80-
//if (e.ResponseStatusCode == HttpStatusCode.OK)
81+
//if (e.ResponseStatusCode == "200")
8182
//{
8283
// if (e.ResponseContentType.Trim().ToLower().Contains("text/html"))
8384
// {

0 commit comments

Comments
 (0)