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
d85a2213
Commit
d85a2213
authored
Jun 29, 2017
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#280 demo how headers can be kept for later use
parent
6178e0c9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
ProxyTestController.cs
.../Titanium.Web.Proxy.Examples.Basic/ProxyTestController.cs
+11
-2
No files found.
Examples/Titanium.Web.Proxy.Examples.Basic/ProxyTestController.cs
View file @
d85a2213
using
System
;
using
System
;
using
System.Collections.Concurrent
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Net
;
using
System.Net
;
using
System.Net.Security
;
using
System.Net.Security
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
Titanium.Web.Proxy.EventArguments
;
using
Titanium.Web.Proxy.EventArguments
;
using
Titanium.Web.Proxy.Helpers
;
using
Titanium.Web.Proxy.Helpers
;
using
Titanium.Web.Proxy.Http
;
using
Titanium.Web.Proxy.Models
;
using
Titanium.Web.Proxy.Models
;
namespace
Titanium.Web.Proxy.Examples.Basic
namespace
Titanium.Web.Proxy.Examples.Basic
...
@@ -13,6 +15,13 @@ namespace Titanium.Web.Proxy.Examples.Basic
...
@@ -13,6 +15,13 @@ namespace Titanium.Web.Proxy.Examples.Basic
{
{
private
readonly
ProxyServer
proxyServer
;
private
readonly
ProxyServer
proxyServer
;
//keep track of request headers
private
readonly
IDictionary
<
Guid
,
HeaderCollection
>
requestHeaderHistory
=
new
ConcurrentDictionary
<
Guid
,
HeaderCollection
>();
//keep track of response headers
private
readonly
IDictionary
<
Guid
,
HeaderCollection
>
responseHeaderHistory
=
new
ConcurrentDictionary
<
Guid
,
HeaderCollection
>();
//share requestBody outside handlers
//share requestBody outside handlers
//Using a dictionary is not a good idea since it can cause memory overflow
//Using a dictionary is not a good idea since it can cause memory overflow
//ideally the data should be moved out of memory
//ideally the data should be moved out of memory
...
@@ -136,7 +145,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
...
@@ -136,7 +145,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
Console
.
WriteLine
(
e
.
WebSession
.
Request
.
Url
);
Console
.
WriteLine
(
e
.
WebSession
.
Request
.
Url
);
//read request headers
//read request headers
var
requestHeaders
=
e
.
WebSession
.
Request
.
RequestHeaders
;
requestHeaderHistory
[
e
.
Id
]
=
e
.
WebSession
.
Request
.
RequestHeaders
;
if
(
e
.
WebSession
.
Request
.
HasBody
)
if
(
e
.
WebSession
.
Request
.
HasBody
)
{
{
...
@@ -183,7 +192,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
...
@@ -183,7 +192,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
//}
//}
//read response headers
//read response headers
var
responseHeaders
=
e
.
WebSession
.
Response
.
ResponseHeaders
;
responseHeaderHistory
[
e
.
Id
]
=
e
.
WebSession
.
Response
.
ResponseHeaders
;
// print out process id of current session
// print out process id of current session
//Console.WriteLine($"PID: {e.WebSession.ProcessId.Value}");
//Console.WriteLine($"PID: {e.WebSession.ProcessId.Value}");
...
...
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