Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Titanium-Web-Proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Titanium-Web-Proxy
Commits
6be0c005
Commit
6be0c005
authored
Mar 09, 2018
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove async not needed in Respond call
parent
1af39dc1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
ProxyTestController.cs
.../Titanium.Web.Proxy.Examples.Basic/ProxyTestController.cs
+1
-1
SessionEventArgs.cs
Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs
+11
-11
No files found.
Examples/Titanium.Web.Proxy.Examples.Basic/ProxyTestController.cs
View file @
6be0c005
...
@@ -183,7 +183,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
...
@@ -183,7 +183,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
//Filter URL
//Filter URL
if
(
e
.
WebSession
.
Request
.
RequestUri
.
AbsoluteUri
.
Contains
(
"yahoo.com"
))
if
(
e
.
WebSession
.
Request
.
RequestUri
.
AbsoluteUri
.
Contains
(
"yahoo.com"
))
{
{
await
e
.
Ok
(
"<!DOCTYPE html>"
+
e
.
Ok
(
"<!DOCTYPE html>"
+
"<html><body><h1>"
+
"<html><body><h1>"
+
"Website Blocked"
+
"Website Blocked"
+
"</h1>"
+
"</h1>"
+
...
...
Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs
View file @
6be0c005
...
@@ -531,7 +531,7 @@ namespace Titanium.Web.Proxy.EventArguments
...
@@ -531,7 +531,7 @@ namespace Titanium.Web.Proxy.EventArguments
/// </summary>
/// </summary>
/// <param name="html"></param>
/// <param name="html"></param>
/// <param name="headers"></param>
/// <param name="headers"></param>
public
async
Task
Ok
(
string
html
,
Dictionary
<
string
,
HttpHeader
>
headers
=
null
)
public
void
Ok
(
string
html
,
Dictionary
<
string
,
HttpHeader
>
headers
=
null
)
{
{
var
response
=
new
OkResponse
();
var
response
=
new
OkResponse
();
if
(
headers
!=
null
)
if
(
headers
!=
null
)
...
@@ -542,7 +542,7 @@ namespace Titanium.Web.Proxy.EventArguments
...
@@ -542,7 +542,7 @@ namespace Titanium.Web.Proxy.EventArguments
response
.
HttpVersion
=
WebSession
.
Request
.
HttpVersion
;
response
.
HttpVersion
=
WebSession
.
Request
.
HttpVersion
;
response
.
Body
=
response
.
Encoding
.
GetBytes
(
html
??
string
.
Empty
);
response
.
Body
=
response
.
Encoding
.
GetBytes
(
html
??
string
.
Empty
);
await
Respond
(
response
);
Respond
(
response
);
}
}
/// <summary>
/// <summary>
...
@@ -552,14 +552,14 @@ namespace Titanium.Web.Proxy.EventArguments
...
@@ -552,14 +552,14 @@ namespace Titanium.Web.Proxy.EventArguments
/// </summary>
/// </summary>
/// <param name="result"></param>
/// <param name="result"></param>
/// <param name="headers"></param>
/// <param name="headers"></param>
public
async
Task
Ok
(
byte
[]
result
,
Dictionary
<
string
,
HttpHeader
>
headers
=
null
)
public
void
Ok
(
byte
[]
result
,
Dictionary
<
string
,
HttpHeader
>
headers
=
null
)
{
{
var
response
=
new
OkResponse
();
var
response
=
new
OkResponse
();
response
.
Headers
.
AddHeaders
(
headers
);
response
.
Headers
.
AddHeaders
(
headers
);
response
.
HttpVersion
=
WebSession
.
Request
.
HttpVersion
;
response
.
HttpVersion
=
WebSession
.
Request
.
HttpVersion
;
response
.
Body
=
result
;
response
.
Body
=
result
;
await
Respond
(
response
);
Respond
(
response
);
}
}
/// <summary>
/// <summary>
...
@@ -572,14 +572,14 @@ namespace Titanium.Web.Proxy.EventArguments
...
@@ -572,14 +572,14 @@ namespace Titanium.Web.Proxy.EventArguments
/// <param name="status"></param>
/// <param name="status"></param>
/// <param name="headers"></param>
/// <param name="headers"></param>
/// <returns></returns>
/// <returns></returns>
public
async
Task
GenericResponse
(
string
html
,
HttpStatusCode
status
,
Dictionary
<
string
,
HttpHeader
>
headers
=
null
)
public
void
GenericResponse
(
string
html
,
HttpStatusCode
status
,
Dictionary
<
string
,
HttpHeader
>
headers
=
null
)
{
{
var
response
=
new
GenericResponse
(
status
);
var
response
=
new
GenericResponse
(
status
);
response
.
HttpVersion
=
WebSession
.
Request
.
HttpVersion
;
response
.
HttpVersion
=
WebSession
.
Request
.
HttpVersion
;
response
.
Headers
.
AddHeaders
(
headers
);
response
.
Headers
.
AddHeaders
(
headers
);
response
.
Body
=
response
.
Encoding
.
GetBytes
(
html
??
string
.
Empty
);
response
.
Body
=
response
.
Encoding
.
GetBytes
(
html
??
string
.
Empty
);
await
Respond
(
response
);
Respond
(
response
);
}
}
/// <summary>
/// <summary>
...
@@ -592,14 +592,14 @@ namespace Titanium.Web.Proxy.EventArguments
...
@@ -592,14 +592,14 @@ namespace Titanium.Web.Proxy.EventArguments
/// <param name="status"></param>
/// <param name="status"></param>
/// <param name="headers"></param>
/// <param name="headers"></param>
/// <returns></returns>
/// <returns></returns>
public
async
Task
GenericResponse
(
byte
[]
result
,
HttpStatusCode
status
,
Dictionary
<
string
,
HttpHeader
>
headers
)
public
void
GenericResponse
(
byte
[]
result
,
HttpStatusCode
status
,
Dictionary
<
string
,
HttpHeader
>
headers
)
{
{
var
response
=
new
GenericResponse
(
status
);
var
response
=
new
GenericResponse
(
status
);
response
.
HttpVersion
=
WebSession
.
Request
.
HttpVersion
;
response
.
HttpVersion
=
WebSession
.
Request
.
HttpVersion
;
response
.
Headers
.
AddHeaders
(
headers
);
response
.
Headers
.
AddHeaders
(
headers
);
response
.
Body
=
result
;
response
.
Body
=
result
;
await
Respond
(
response
);
Respond
(
response
);
}
}
/// <summary>
/// <summary>
...
@@ -607,18 +607,18 @@ namespace Titanium.Web.Proxy.EventArguments
...
@@ -607,18 +607,18 @@ namespace Titanium.Web.Proxy.EventArguments
/// </summary>
/// </summary>
/// <param name="url"></param>
/// <param name="url"></param>
/// <returns></returns>
/// <returns></returns>
public
async
Task
Redirect
(
string
url
)
public
void
Redirect
(
string
url
)
{
{
var
response
=
new
RedirectResponse
();
var
response
=
new
RedirectResponse
();
response
.
HttpVersion
=
WebSession
.
Request
.
HttpVersion
;
response
.
HttpVersion
=
WebSession
.
Request
.
HttpVersion
;
response
.
Headers
.
AddHeader
(
KnownHeaders
.
Location
,
url
);
response
.
Headers
.
AddHeader
(
KnownHeaders
.
Location
,
url
);
response
.
Body
=
emptyData
;
response
.
Body
=
emptyData
;
await
Respond
(
response
);
Respond
(
response
);
}
}
/// a generic responder method
/// a generic responder method
public
async
Task
Respond
(
Response
response
)
public
void
Respond
(
Response
response
)
{
{
if
(
WebSession
.
Request
.
RequestLocked
)
if
(
WebSession
.
Request
.
RequestLocked
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment