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

Commit e23390e

Browse files
justcoding121justcoding121
authored andcommitted
comment out test
1 parent cb263c6 commit e23390e

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

Titanium.Web.Proxy.Test/ProxyTestController.cs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -46,28 +46,28 @@ public void OnRequest(object sender, SessionEventArgs e)
4646
{
4747
Console.WriteLine(e.ProxySession.Request.RequestUrl);
4848

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

52-
if ((e.RequestMethod.ToUpper() == "POST" || e.RequestMethod.ToUpper() == "PUT"))
53-
{
54-
//Get/Set request body bytes
55-
byte[] bodyBytes = e.GetRequestBody();
56-
e.SetRequestBody(bodyBytes);
52+
//if ((e.RequestMethod.ToUpper() == "POST" || e.RequestMethod.ToUpper() == "PUT"))
53+
//{
54+
// //Get/Set request body bytes
55+
// byte[] bodyBytes = e.GetRequestBody();
56+
// e.SetRequestBody(bodyBytes);
5757

58-
//Get/Set request body as string
59-
string bodyString = e.GetRequestBodyAsString();
60-
e.SetRequestBodyString(bodyString);
58+
// //Get/Set request body as string
59+
// string bodyString = e.GetRequestBodyAsString();
60+
// e.SetRequestBodyString(bodyString);
6161

62-
}
62+
//}
6363

64-
//To cancel a request with a custom HTML content
65-
//Filter URL
64+
////To cancel a request with a custom HTML content
65+
////Filter URL
6666

67-
if (e.ProxySession.Request.RequestUrl.Contains("google.com"))
68-
{
69-
e.Ok("<!DOCTYPE html><html><body><h1>Website Blocked</h1><p>Blocked by titanium web proxy.</p></body></html>");
70-
}
67+
//if (e.ProxySession.Request.RequestUrl.Contains("google.com"))
68+
//{
69+
// e.Ok("<!DOCTYPE html><html><body><h1>Website Blocked</h1><p>Blocked by titanium web proxy.</p></body></html>");
70+
//}
7171
}
7272

7373
//Test script injection
@@ -78,25 +78,25 @@ public void OnResponse(object sender, SessionEventArgs e)
7878
var responseHeaders = e.ProxySession.Response.ResponseHeaders;
7979

8080

81-
if (e.ResponseStatusCode == "200")
82-
{
83-
if (e.ResponseContentType.Trim().ToLower().Contains("text/html"))
84-
{
85-
//Get/Set response body bytes
86-
byte[] responseBodyBytes = e.GetResponseBody();
87-
e.SetResponseBody(responseBodyBytes);
81+
//if (e.ResponseStatusCode == "200")
82+
//{
83+
// if (e.ResponseContentType.Trim().ToLower().Contains("text/html"))
84+
// {
85+
// //Get/Set response body bytes
86+
// byte[] responseBodyBytes = e.GetResponseBody();
87+
// e.SetResponseBody(responseBodyBytes);
8888

89-
//Get response body as string
90-
string responseBody = e.GetResponseBodyAsString();
89+
// //Get response body as string
90+
// string responseBody = e.GetResponseBodyAsString();
9191

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

96-
//Set modifed response Html Body
97-
e.SetResponseBodyString(modified);
98-
}
99-
}
96+
// //Set modifed response Html Body
97+
// e.SetResponseBodyString(modified);
98+
// }
99+
//}
100100
}
101101
}
102102
}

0 commit comments

Comments
 (0)