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

Commit

Permalink
Merge pull request #28 from titanium007/breaking-change
Browse files Browse the repository at this point in the history
Breaking change
  • Loading branch information
justcoding121 committed Jan 6, 2016
2 parents 0cc53a6 + cff7a93 commit e888c00
Show file tree
Hide file tree
Showing 19 changed files with 803 additions and 453 deletions.
4 changes: 4 additions & 0 deletions .build/default.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ if(!$Configuration) { $Configuration = "Release" }
if(!$Version) { $Version = $env:APPVEYOR_BUILD_VERSION }
if(!$Version) { $Version = "1.0.$BuildNumber" }

if(!$Branch) { $Branch = $env:APPVEYOR_REPO_BRANCH }
if(!$Branch) { $Branch = "local" }
if($Branch -eq "release" ) { $Version = "$Version-beta" }

Import-Module "$Here\Common" -DisableNameChecking

$NuGet = Join-Path $SolutionRoot ".nuget\nuget.exe"
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ Sample request and response event handlers
//Test On Request, intercept requests
public void OnRequest(object sender, SessionEventArgs e)
{
Console.WriteLine(e.RequestURL);
Console.WriteLine(e.ProxySession.Request.RequestUrl);

//read request headers
var requestHeaders = e.RequestHeaders;
var requestHeaders = e.ProxySession.Request.RequestHeaders;

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

public void OnResponse(object sender, SessionEventArgs e)
{
//read response headers
var responseHeaders = e.ResponseHeaders;
////read response headers
var responseHeaders = e.ProxySession.Response.ResponseHeaders;


if (e.ResponseStatusCode == HttpStatusCode.OK)
if (e.ResponseStatusCode == "200")
{
if (e.ResponseContentType.Trim().ToLower().Contains("text/html"))
{
Expand Down
13 changes: 13 additions & 0 deletions Titanium.Web.Proxy.Test/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,17 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

</configuration>
11 changes: 6 additions & 5 deletions Titanium.Web.Proxy.Test/ProxyTestController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Text.RegularExpressions;
using Titanium.Web.Proxy.EventArguments;

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

////read request headers
//var requestHeaders = e.RequestHeaders;
//var requestHeaders = e.ProxySession.Request.RequestHeaders;

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

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


//if (e.ResponseStatusCode == HttpStatusCode.OK)
//if (e.ResponseStatusCode == "200")
//{
// if (e.ResponseContentType.Trim().ToLower().Contains("text/html"))
// {
Expand Down
Loading

0 comments on commit e888c00

Please sign in to comment.