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
36a721b4
Commit
36a721b4
authored
Jun 17, 2016
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#81
Fix quit
parent
a426879b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
21 deletions
+19
-21
ProxyServer.cs
Titanium.Web.Proxy/ProxyServer.cs
+19
-21
No files found.
Titanium.Web.Proxy/ProxyServer.cs
View file @
36a721b4
...
@@ -137,22 +137,15 @@ namespace Titanium.Web.Proxy
...
@@ -137,22 +137,15 @@ namespace Titanium.Web.Proxy
RootCertificateName
);
RootCertificateName
);
}
}
/// <summary>
/// Initialize the proxy
/// </summary>
public
void
Initialize
()
{
tcpConnectionCacheManager
.
ClearIdleConnections
(
ConnectionCacheTimeOutMinutes
);
certificateCacheManager
.
ClearIdleCertificates
(
CertificateCacheTimeOutMinutes
);
}
/// <summary>
/// <summary>
/// Add a proxy end point
/// Add a proxy end point
/// </summary>
/// </summary>
/// <param name="endPoint"></param>
/// <param name="endPoint"></param>
public
void
AddEndPoint
(
ProxyEndPoint
endPoint
)
public
void
AddEndPoint
(
ProxyEndPoint
endPoint
)
{
{
if
(
ProxyEndPoints
.
Any
(
x
=>
x
.
IpAddress
==
endPoint
.
IpAddress
&&
x
.
Port
==
endPoint
.
Port
))
throw
new
Exception
(
"Cannot add another endpoint to same port & ip address"
);
ProxyEndPoints
.
Add
(
endPoint
);
ProxyEndPoints
.
Add
(
endPoint
);
if
(
proxyRunning
)
if
(
proxyRunning
)
...
@@ -166,7 +159,6 @@ namespace Titanium.Web.Proxy
...
@@ -166,7 +159,6 @@ namespace Titanium.Web.Proxy
/// <param name="endPoint"></param>
/// <param name="endPoint"></param>
public
void
RemoveEndPoint
(
ProxyEndPoint
endPoint
)
public
void
RemoveEndPoint
(
ProxyEndPoint
endPoint
)
{
{
if
(
ProxyEndPoints
.
Contains
(
endPoint
)
==
false
)
if
(
ProxyEndPoints
.
Contains
(
endPoint
)
==
false
)
throw
new
Exception
(
"Cannot remove endPoints not added to proxy"
);
throw
new
Exception
(
"Cannot remove endPoints not added to proxy"
);
...
@@ -197,14 +189,7 @@ namespace Titanium.Web.Proxy
...
@@ -197,14 +189,7 @@ namespace Titanium.Web.Proxy
Console
.
WriteLine
(
"Set endpoint at Ip {1} and port: {2} as System HTTPS Proxy"
,
endPoint
.
GetType
().
Name
,
endPoint
.
IpAddress
,
endPoint
.
Port
);
Console
.
WriteLine
(
"Set endpoint at Ip {1} and port: {2} as System HTTPS Proxy"
,
endPoint
.
GetType
().
Name
,
endPoint
.
IpAddress
,
endPoint
.
Port
);
}
}
/// <summary>
/// Remove any HTTP proxy setting of current machien
/// </summary>
public
void
DisableSystemHttpProxy
()
{
systemProxySettingsManager
.
RemoveHttpProxy
();
}
/// <summary>
/// <summary>
/// Set the given explicit end point as the default proxy server for current machine
/// Set the given explicit end point as the default proxy server for current machine
...
@@ -239,6 +224,14 @@ namespace Titanium.Web.Proxy
...
@@ -239,6 +224,14 @@ namespace Titanium.Web.Proxy
Console
.
WriteLine
(
"Set endpoint at Ip {1} and port: {2} as System HTTPS Proxy"
,
endPoint
.
GetType
().
Name
,
endPoint
.
IpAddress
,
endPoint
.
Port
);
Console
.
WriteLine
(
"Set endpoint at Ip {1} and port: {2} as System HTTPS Proxy"
,
endPoint
.
GetType
().
Name
,
endPoint
.
IpAddress
,
endPoint
.
Port
);
}
}
/// <summary>
/// Remove any HTTP proxy setting of current machien
/// </summary>
public
void
DisableSystemHttpProxy
()
{
systemProxySettingsManager
.
RemoveHttpProxy
();
}
/// <summary>
/// <summary>
/// Remove any HTTPS proxy setting for current machine
/// Remove any HTTPS proxy setting for current machine
/// </summary>
/// </summary>
...
@@ -270,7 +263,8 @@ namespace Titanium.Web.Proxy
...
@@ -270,7 +263,8 @@ namespace Titanium.Web.Proxy
Listen
(
endPoint
);
Listen
(
endPoint
);
}
}
Initialize
();
tcpConnectionCacheManager
.
ClearIdleConnections
(
ConnectionCacheTimeOutMinutes
);
certificateCacheManager
.
ClearIdleCertificates
(
CertificateCacheTimeOutMinutes
);
proxyRunning
=
true
;
proxyRunning
=
true
;
}
}
...
@@ -295,9 +289,11 @@ namespace Titanium.Web.Proxy
...
@@ -295,9 +289,11 @@ namespace Titanium.Web.Proxy
foreach
(
var
endPoint
in
ProxyEndPoints
)
foreach
(
var
endPoint
in
ProxyEndPoints
)
{
{
endPoint
.
listener
.
Stop
(
);
QuitListen
(
endPoint
);
}
}
ProxyEndPoints
.
Clear
();
tcpConnectionCacheManager
.
StopClearIdleConnections
();
tcpConnectionCacheManager
.
StopClearIdleConnections
();
certificateCacheManager
.
StopClearIdleCertificates
();
certificateCacheManager
.
StopClearIdleCertificates
();
...
@@ -325,6 +321,8 @@ namespace Titanium.Web.Proxy
...
@@ -325,6 +321,8 @@ namespace Titanium.Web.Proxy
private
void
QuitListen
(
ProxyEndPoint
endPoint
)
private
void
QuitListen
(
ProxyEndPoint
endPoint
)
{
{
endPoint
.
listener
.
Stop
();
endPoint
.
listener
.
Stop
();
endPoint
.
listener
.
Server
.
Close
();
endPoint
.
listener
.
Server
.
Dispose
();
}
}
/// <summary>
/// <summary>
...
...
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