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
ead81899
Commit
ead81899
authored
Nov 14, 2017
by
Honfika
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some property setter visibility changed, wpf demo project simplified
parent
b6829121
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
28 deletions
+28
-28
MainWindow.xaml.cs
Examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml.cs
+10
-9
SessionListItem.cs
Examples/Titanium.Web.Proxy.Examples.Wpf/SessionListItem.cs
+7
-7
SessionEventArgs.cs
Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs
+3
-3
TunnelConnectEventArgs.cs
Titanium.Web.Proxy/EventArguments/TunnelConnectEventArgs.cs
+3
-2
HttpWebClient.cs
Titanium.Web.Proxy/Http/HttpWebClient.cs
+4
-5
RequestHandler.cs
Titanium.Web.Proxy/RequestHandler.cs
+1
-2
No files found.
Examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml.cs
View file @
ead81899
...
...
@@ -56,7 +56,7 @@ namespace Titanium.Web.Proxy.Examples.Wpf
set
{
SetValue
(
ServerConnectionCountProperty
,
value
);
}
}
private
readonly
Dictionary
<
SessionEventArgs
,
SessionListItem
>
sessionDictionary
=
new
Dictionary
<
SessionEventArgs
,
SessionListItem
>();
private
readonly
Dictionary
<
HttpWebClient
,
SessionListItem
>
sessionDictionary
=
new
Dictionary
<
HttpWebClient
,
SessionListItem
>();
private
SessionListItem
selectedSession
;
public
MainWindow
()
...
...
@@ -105,7 +105,7 @@ namespace Titanium.Web.Proxy.Examples.Wpf
await
Dispatcher
.
InvokeAsync
(()
=>
{
SessionListItem
item
;
if
(
sessionDictionary
.
TryGetValue
(
e
,
out
item
))
if
(
sessionDictionary
.
TryGetValue
(
e
.
WebSession
,
out
item
))
{
item
.
Update
();
}
...
...
@@ -133,7 +133,7 @@ namespace Titanium.Web.Proxy.Examples.Wpf
await
Dispatcher
.
InvokeAsync
(()
=>
{
SessionListItem
item2
;
if
(
sessionDictionary
.
TryGetValue
(
e
,
out
item2
))
if
(
sessionDictionary
.
TryGetValue
(
e
.
WebSession
,
out
item2
))
{
item2
.
Update
();
item
=
item2
;
...
...
@@ -154,27 +154,28 @@ namespace Titanium.Web.Proxy.Examples.Wpf
{
var
item
=
CreateSessionListItem
(
e
);
Sessions
.
Add
(
item
);
sessionDictionary
.
Add
(
e
,
item
);
sessionDictionary
.
Add
(
e
.
WebSession
,
item
);
return
item
;
}
private
SessionListItem
CreateSessionListItem
(
SessionEventArgs
e
)
{
lastSessionNumber
++;
bool
isTunnelConnect
=
e
is
TunnelConnectSessionEventArgs
;
var
item
=
new
SessionListItem
{
Number
=
lastSessionNumber
,
SessionArgs
=
e
,
WebSession
=
e
.
WebSession
,
IsTunnelConnect
=
isTunnelConnect
,
};
if
(
e
is
TunnelConnectSessionEventArgs
||
e
.
WebSession
.
Request
.
UpgradeToWebSocket
)
if
(
isTunnelConnect
||
e
.
WebSession
.
Request
.
UpgradeToWebSocket
)
{
e
.
DataReceived
+=
(
sender
,
args
)
=>
{
var
session
=
(
SessionEventArgs
)
sender
;
SessionListItem
li
;
if
(
sessionDictionary
.
TryGetValue
(
session
,
out
li
))
if
(
sessionDictionary
.
TryGetValue
(
session
.
WebSession
,
out
li
))
{
li
.
ReceivedDataCount
+=
args
.
Count
;
}
...
...
@@ -184,7 +185,7 @@ namespace Titanium.Web.Proxy.Examples.Wpf
{
var
session
=
(
SessionEventArgs
)
sender
;
SessionListItem
li
;
if
(
sessionDictionary
.
TryGetValue
(
session
,
out
li
))
if
(
sessionDictionary
.
TryGetValue
(
session
.
WebSession
,
out
li
))
{
li
.
SentDataCount
+=
args
.
Count
;
}
...
...
@@ -203,7 +204,7 @@ namespace Titanium.Web.Proxy.Examples.Wpf
foreach
(
var
item
in
selectedItems
.
Cast
<
SessionListItem
>().
ToArray
())
{
Sessions
.
Remove
(
item
);
sessionDictionary
.
Remove
(
item
.
SessionArgs
);
sessionDictionary
.
Remove
(
item
.
WebSession
);
}
}
}
...
...
Examples/Titanium.Web.Proxy.Examples.Wpf/SessionListItem.cs
View file @
ead81899
...
...
@@ -20,7 +20,9 @@ namespace Titanium.Web.Proxy.Examples.Wpf
public
int
Number
{
get
;
set
;
}
public
SessionEventArgs
SessionArgs
{
get
;
set
;
}
public
HttpWebClient
WebSession
{
get
;
set
;
}
public
bool
IsTunnelConnect
{
get
;
set
;
}
public
string
StatusCode
{
...
...
@@ -70,8 +72,6 @@ namespace Titanium.Web.Proxy.Examples.Wpf
set
{
SetField
(
ref
sentDataCount
,
value
);
}
}
public
HttpWebClient
WebSession
{
get
;
set
;
}
public
event
PropertyChangedEventHandler
PropertyChanged
;
protected
void
SetField
<
T
>(
ref
T
field
,
T
value
,[
CallerMemberName
]
string
propertyName
=
null
)
...
...
@@ -88,13 +88,13 @@ namespace Titanium.Web.Proxy.Examples.Wpf
public
void
Update
()
{
var
request
=
SessionArgs
.
WebSession
.
Request
;
var
response
=
SessionArgs
.
WebSession
.
Response
;
var
request
=
WebSession
.
Request
;
var
response
=
WebSession
.
Response
;
int
statusCode
=
response
?.
ResponseStatusCode
??
0
;
StatusCode
=
statusCode
==
0
?
"-"
:
statusCode
.
ToString
();
Protocol
=
request
.
RequestUri
.
Scheme
;
if
(
SessionArgs
is
TunnelConnectSessionEventArgs
)
if
(
IsTunnelConnect
)
{
Host
=
"Tunnel to"
;
Url
=
request
.
RequestUri
.
Host
+
":"
+
request
.
RequestUri
.
Port
;
...
...
@@ -106,7 +106,7 @@ namespace Titanium.Web.Proxy.Examples.Wpf
}
BodySize
=
response
?.
ContentLength
??
-
1
;
Process
=
GetProcessDescription
(
SessionArgs
.
WebSession
.
ProcessId
.
Value
);
Process
=
GetProcessDescription
(
WebSession
.
ProcessId
.
Value
);
}
private
string
GetProcessDescription
(
int
processId
)
...
...
Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs
View file @
ead81899
...
...
@@ -79,17 +79,17 @@ namespace Titanium.Web.Proxy.EventArguments
/// A web session corresponding to a single request/response sequence
/// within a proxy connection
/// </summary>
public
HttpWebClient
WebSession
{
get
;
set
;
}
public
HttpWebClient
WebSession
{
get
;
}
/// <summary>
/// Are we using a custom upstream HTTP proxy?
/// </summary>
public
ExternalProxy
CustomUpStreamHttpProxyUsed
{
get
;
set
;
}
public
ExternalProxy
CustomUpStreamHttpProxyUsed
{
get
;
internal
set
;
}
/// <summary>
/// Are we using a custom upstream HTTPS proxy?
/// </summary>
public
ExternalProxy
CustomUpStreamHttpsProxyUsed
{
get
;
set
;
}
public
ExternalProxy
CustomUpStreamHttpsProxyUsed
{
get
;
internal
set
;
}
public
event
EventHandler
<
DataEventArgs
>
DataSent
;
...
...
Titanium.Web.Proxy/EventArguments/TunnelConnectEventArgs.cs
View file @
ead81899
using
System.Net
;
using
Titanium.Web.Proxy.Http
;
using
Titanium.Web.Proxy.Models
;
namespace
Titanium.Web.Proxy.EventArguments
...
...
@@ -7,10 +8,10 @@ namespace Titanium.Web.Proxy.EventArguments
{
public
bool
IsHttpsConnect
{
get
;
set
;
}
public
TunnelConnectSessionEventArgs
(
int
bufferSize
,
ProxyEndPoint
endPoin
t
)
internal
TunnelConnectSessionEventArgs
(
int
bufferSize
,
ProxyEndPoint
endPoint
,
ConnectRequest
connectReques
t
)
:
base
(
bufferSize
,
endPoint
,
null
)
{
WebSession
.
Request
=
connectRequest
;
}
}
}
Titanium.Web.Proxy/Http/HttpWebClient.cs
View file @
ead81899
...
...
@@ -33,17 +33,17 @@ namespace Titanium.Web.Proxy.Http
/// <summary>
/// Headers passed with Connect.
/// </summary>
public
ConnectRequest
ConnectRequest
{
get
;
set
;
}
public
ConnectRequest
ConnectRequest
{
get
;
internal
set
;
}
/// <summary>
/// Web Request.
/// </summary>
public
Request
Request
{
get
;
set
;
}
public
Request
Request
{
get
;
internal
set
;
}
/// <summary>
/// Web Response.
/// </summary>
public
Response
Response
{
get
;
set
;
}
public
Response
Response
{
get
;
internal
set
;
}
/// <summary>
/// PID of the process that is created the current session when client is running in this machine
...
...
@@ -74,8 +74,7 @@ namespace Titanium.Web.Proxy.Http
connection
.
LastAccess
=
DateTime
.
Now
;
ServerConnection
=
connection
;
}
/// <summary>
/// Prepare and send the http(s) request
/// </summary>
...
...
Titanium.Web.Proxy/RequestHandler.cs
View file @
ead81899
...
...
@@ -88,8 +88,7 @@ namespace Titanium.Web.Proxy
await
HeaderParser
.
ReadHeaders
(
clientStreamReader
,
connectRequest
.
RequestHeaders
);
var
connectArgs
=
new
TunnelConnectSessionEventArgs
(
BufferSize
,
endPoint
);
connectArgs
.
WebSession
.
Request
=
connectRequest
;
var
connectArgs
=
new
TunnelConnectSessionEventArgs
(
BufferSize
,
endPoint
,
connectRequest
);
connectArgs
.
ProxyClient
.
TcpClient
=
tcpClient
;
connectArgs
.
ProxyClient
.
ClientStream
=
clientStream
;
...
...
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