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
c2994bc7
Commit
c2994bc7
authored
Mar 05, 2019
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
system proxy do not support non-windows env
parent
fc153521
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
13 deletions
+15
-13
CertificateManager.cs
src/Titanium.Web.Proxy/Network/CertificateManager.cs
+4
-4
TcpConnectionFactory.cs
src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
+1
-1
ProxyServer.cs
src/Titanium.Web.Proxy/ProxyServer.cs
+9
-7
RequestHandler.cs
src/Titanium.Web.Proxy/RequestHandler.cs
+1
-1
No files found.
src/Titanium.Web.Proxy/Network/CertificateManager.cs
View file @
c2994bc7
using
System
;
using
System
;
using
System.Collections.Concurrent
;
using
System.Collections.Concurrent
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Diagnostics
;
...
@@ -149,7 +149,7 @@ namespace Titanium.Web.Proxy.Network
...
@@ -149,7 +149,7 @@ namespace Titanium.Web.Proxy.Network
set
set
{
{
// For Mono (or Non-Windows) only Bouncy Castle is supported
// For Mono (or Non-Windows) only Bouncy Castle is supported
if
(!
RunTime
.
IsWindows
||
RunTime
.
IsRunningOnMono
)
if
(!
RunTime
.
IsWindows
)
{
{
value
=
CertificateEngine
.
BouncyCastle
;
value
=
CertificateEngine
.
BouncyCastle
;
}
}
...
@@ -662,7 +662,7 @@ namespace Titanium.Web.Proxy.Network
...
@@ -662,7 +662,7 @@ namespace Titanium.Web.Proxy.Network
/// <returns>True if success.</returns>
/// <returns>True if success.</returns>
public
bool
TrustRootCertificateAsAdmin
(
bool
machineTrusted
=
false
)
public
bool
TrustRootCertificateAsAdmin
(
bool
machineTrusted
=
false
)
{
{
if
(!
RunTime
.
IsWindows
||
RunTime
.
IsRunningOnMono
)
if
(!
RunTime
.
IsWindows
)
{
{
return
false
;
return
false
;
}
}
...
@@ -805,7 +805,7 @@ namespace Titanium.Web.Proxy.Network
...
@@ -805,7 +805,7 @@ namespace Titanium.Web.Proxy.Network
/// <returns>Should also remove from machine store?</returns>
/// <returns>Should also remove from machine store?</returns>
public
bool
RemoveTrustedRootCertificateAsAdmin
(
bool
machineTrusted
=
false
)
public
bool
RemoveTrustedRootCertificateAsAdmin
(
bool
machineTrusted
=
false
)
{
{
if
(!
RunTime
.
IsWindows
||
RunTime
.
IsRunningOnMono
)
if
(!
RunTime
.
IsWindows
)
{
{
return
false
;
return
false
;
}
}
...
...
src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
View file @
c2994bc7
...
@@ -280,7 +280,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
...
@@ -280,7 +280,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
};
};
//linux has a bug with socket reuse in .net core.
//linux has a bug with socket reuse in .net core.
if
(
proxyServer
.
ReuseSocket
&&
(
RunTime
.
IsWindows
||
RunTime
.
IsRunningOnMono
)
)
if
(
proxyServer
.
ReuseSocket
&&
RunTime
.
IsWindows
)
{
{
tcpClient
.
Client
.
SetSocketOption
(
SocketOptionLevel
.
Socket
,
SocketOptionName
.
ReuseAddress
,
true
);
tcpClient
.
Client
.
SetSocketOption
(
SocketOptionLevel
.
Socket
,
SocketOptionName
.
ReuseAddress
,
true
);
}
}
...
...
src/Titanium.Web.Proxy/ProxyServer.cs
View file @
c2994bc7
...
@@ -102,7 +102,7 @@ namespace Titanium.Web.Proxy
...
@@ -102,7 +102,7 @@ namespace Titanium.Web.Proxy
ProxyEndPoints
=
new
List
<
ProxyEndPoint
>();
ProxyEndPoints
=
new
List
<
ProxyEndPoint
>();
tcpConnectionFactory
=
new
TcpConnectionFactory
(
this
);
tcpConnectionFactory
=
new
TcpConnectionFactory
(
this
);
if
(
!
RunTime
.
IsRunningOnMono
&&
RunTime
.
IsWindows
&&
!
RunTime
.
IsUwpOnWindows
)
if
(
RunTime
.
IsWindows
&&
!
RunTime
.
IsUwpOnWindows
)
{
{
systemProxySettingsManager
=
new
SystemProxyManager
();
systemProxySettingsManager
=
new
SystemProxyManager
();
}
}
...
@@ -511,9 +511,10 @@ namespace Titanium.Web.Proxy
...
@@ -511,9 +511,10 @@ namespace Titanium.Web.Proxy
/// </summary>
/// </summary>
public
void
DisableSystemProxy
(
ProxyProtocolType
protocolType
)
public
void
DisableSystemProxy
(
ProxyProtocolType
protocolType
)
{
{
if
(
RunTime
.
IsRunningOnMono
)
if
(
!
RunTime
.
IsWindows
)
{
{
throw
new
Exception
(
"Mono Runtime do not support system proxy settings."
);
throw
new
NotSupportedException
(
@"Setting system proxy settings are only supported in Windows.
Please manually confugure you operating system to use this proxy's port and address."
);
}
}
systemProxySettingsManager
.
RemoveProxy
(
protocolType
);
systemProxySettingsManager
.
RemoveProxy
(
protocolType
);
...
@@ -524,9 +525,10 @@ namespace Titanium.Web.Proxy
...
@@ -524,9 +525,10 @@ namespace Titanium.Web.Proxy
/// </summary>
/// </summary>
public
void
DisableAllSystemProxies
()
public
void
DisableAllSystemProxies
()
{
{
if
(
RunTime
.
IsRunningOnMono
)
if
(
!
RunTime
.
IsWindows
)
{
{
throw
new
Exception
(
"Mono Runtime do not support system proxy settings."
);
throw
new
NotSupportedException
(
@"Setting system proxy settings are only supported in Windows.
Please manually confugure you operating system to use this proxy's port and address."
);
}
}
systemProxySettingsManager
.
DisableAllProxy
();
systemProxySettingsManager
.
DisableAllProxy
();
...
@@ -600,7 +602,7 @@ namespace Titanium.Web.Proxy
...
@@ -600,7 +602,7 @@ namespace Titanium.Web.Proxy
throw
new
Exception
(
"Proxy is not running."
);
throw
new
Exception
(
"Proxy is not running."
);
}
}
if
(
!
RunTime
.
IsRunningOnMono
&&
RunTime
.
IsWindows
&&
!
RunTime
.
IsUwpOnWindows
)
if
(
RunTime
.
IsWindows
&&
!
RunTime
.
IsUwpOnWindows
)
{
{
bool
setAsSystemProxy
=
ProxyEndPoints
.
OfType
<
ExplicitProxyEndPoint
>()
bool
setAsSystemProxy
=
ProxyEndPoints
.
OfType
<
ExplicitProxyEndPoint
>()
.
Any
(
x
=>
x
.
IsSystemHttpProxy
||
x
.
IsSystemHttpsProxy
);
.
Any
(
x
=>
x
.
IsSystemHttpProxy
||
x
.
IsSystemHttpsProxy
);
...
@@ -633,7 +635,7 @@ namespace Titanium.Web.Proxy
...
@@ -633,7 +635,7 @@ namespace Titanium.Web.Proxy
endPoint
.
Listener
=
new
TcpListener
(
endPoint
.
IpAddress
,
endPoint
.
Port
);
endPoint
.
Listener
=
new
TcpListener
(
endPoint
.
IpAddress
,
endPoint
.
Port
);
//linux/macOS has a bug with socket reuse in .net core.
//linux/macOS has a bug with socket reuse in .net core.
if
(
ReuseSocket
&&
(
RunTime
.
IsWindows
||
RunTime
.
IsRunningOnMono
)
)
if
(
ReuseSocket
&&
RunTime
.
IsWindows
)
{
{
endPoint
.
Listener
.
Server
.
SetSocketOption
(
SocketOptionLevel
.
Socket
,
SocketOptionName
.
ReuseAddress
,
true
);
endPoint
.
Listener
.
Server
.
SetSocketOption
(
SocketOptionLevel
.
Socket
,
SocketOptionName
.
ReuseAddress
,
true
);
}
}
...
...
src/Titanium.Web.Proxy/RequestHandler.cs
View file @
c2994bc7
...
@@ -27,7 +27,7 @@ namespace Titanium.Web.Proxy
...
@@ -27,7 +27,7 @@ namespace Titanium.Web.Proxy
public
partial
class
ProxyServer
public
partial
class
ProxyServer
{
{
private
bool
isWindowsAuthenticationEnabledAndSupported
=>
private
bool
isWindowsAuthenticationEnabledAndSupported
=>
EnableWinAuth
&&
RunTime
.
IsWindows
&&
!
RunTime
.
IsRunningOnMono
;
EnableWinAuth
&&
RunTime
.
IsWindows
;
/// <summary>
/// <summary>
/// This is the core request handler method for a particular connection from client.
/// This is the core request handler method for a particular connection from client.
...
...
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