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

Breaking Change on Release #29

Merged
merged 25 commits into from
Jan 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4c3121e
Replace HttpWebRequest with Custom Request Class
justcoding121 Dec 23, 2015
27fc293
Merge remote-tracking branch 'refs/remotes/origin/master' into breaki…
justcoding121 Dec 27, 2015
8242536
Separate Request & Response
justcoding121 Dec 28, 2015
f69bed2
Fix connection cache
justcoding121 Jan 1, 2016
ffe306c
Separate request & response
justcoding121 Jan 4, 2016
dfc356c
remove extra newline
justcoding121 Jan 4, 2016
4633f88
close connection each request
justcoding121 Jan 4, 2016
ec0d99b
remove lock for now
justcoding121 Jan 4, 2016
c47e7d8
use connection wisely
justcoding121 Jan 4, 2016
44b4d4b
fix header parsing
justcoding121 Jan 5, 2016
929f862
cleanup
justcoding121 Jan 5, 2016
a413adc
comment out test
justcoding121 Jan 5, 2016
ee38be0
Add connection cache
justcoding121 Jan 5, 2016
c7b20f9
Cleanup connection manager
justcoding121 Jan 5, 2016
ecfc7ff
Remove code used for HttpWebRequest
justcoding121 Jan 5, 2016
a7545c9
Update readme; new api; fix gzip decompression
justcoding121 Jan 6, 2016
f40ad48
comment out test
justcoding121 Jan 6, 2016
2202d02
beta release branch
justcoding121 Jan 6, 2016
c53a150
Merge fix
justcoding121 Jan 6, 2016
cff7a93
fix build failure
justcoding121 Jan 6, 2016
e888c00
Merge pull request #28 from titanium007/breaking-change
justcoding121 Jan 6, 2016
370a9b8
Release pre
justcoding121 Jan 6, 2016
4ac7568
use regex for master or release
justcoding121 Jan 6, 2016
de33f72
Fix issues identified from review issue #27
justcoding121 Jan 6, 2016
75d6ba7
comment out test code
justcoding121 Jan 6, 2016
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
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>
35 changes: 14 additions & 21 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.Url);

////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 @@ -73,27 +74,19 @@ public void OnRequest(object sender, SessionEventArgs e)
//Insert script to read the Browser URL and send it back to proxy
public void OnResponse(object sender, SessionEventArgs e)
{

////read response headers
//var responseHeaders = e.ResponseHeaders;


//if (e.ResponseStatusCode == HttpStatusCode.OK)
// var responseHeaders = e.ProxySession.Response.ResponseHeaders;
//if (!e.ProxySession.Request.Hostname.Equals("medeczane.sgk.gov.tr")) return;
//if (e.RequestMethod == "GET" || e.RequestMethod == "POST")
//{
// if (e.ResponseContentType.Trim().ToLower().Contains("text/html"))
// if (e.ProxySession.Response.ResponseStatusCode == "200")
// {
// //Get/Set response body bytes
// byte[] responseBodyBytes = e.GetResponseBody();
// e.SetResponseBody(responseBodyBytes);

// //Get response body as string
// string responseBody = e.GetResponseBodyAsString();

// //Modify e.ServerResponse
// Regex rex = new Regex("</body>", RegexOptions.RightToLeft | RegexOptions.IgnoreCase | RegexOptions.Multiline);
// string modified = rex.Replace(responseBody, "<script type =\"text/javascript\">alert('Response was modified by this script!');</script></body>", 1);

// //Set modifed response Html Body
// e.SetResponseBodyString(modified);
// if (e.ProxySession.Response.ContentType.Trim().ToLower().Contains("text/html"))
// {
// string body = e.GetResponseBodyAsString();
// }
// }
//}
}
Expand Down
Loading