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
0ea90e0c
Commit
0ea90e0c
authored
May 26, 2017
by
justcoding121
Committed by
justcoding121
May 26, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user lazy<bool> for runtime check
parent
12e910fe
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
18 deletions
+15
-18
RunTime.cs
Titanium.Web.Proxy/Helpers/RunTime.cs
+4
-6
CertificateManager.cs
Titanium.Web.Proxy/Network/CertificateManager.cs
+2
-2
ProxyServer.cs
Titanium.Web.Proxy/ProxyServer.cs
+6
-6
RequestHandler.cs
Titanium.Web.Proxy/RequestHandler.cs
+2
-3
ResponseHandler.cs
Titanium.Web.Proxy/ResponseHandler.cs
+1
-1
No files found.
Titanium.Web.Proxy/Helpers/RunTime.cs
View file @
0ea90e0c
...
@@ -7,15 +7,13 @@ namespace Titanium.Web.Proxy.Helpers
...
@@ -7,15 +7,13 @@ namespace Titanium.Web.Proxy.Helpers
/// </summary>
/// </summary>
internal
class
RunTime
internal
class
RunTime
{
{
private
static
Lazy
<
bool
>
isMonoRuntime
=
new
Lazy
<
bool
>(()=>
Type
.
GetType
(
"Mono.Runtime"
)
!=
null
);
/// <summary>
/// <summary>
/// Checks if current run time is Mono
/// Checks if current run time is Mono
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
internal
static
bool
IsRunningOnMono
()
internal
static
Lazy
<
bool
>
isRunningOnMono
{
=
new
Lazy
<
bool
>(()=>
Type
.
GetType
(
"Mono.Runtime"
)
!=
null
);
return
isMonoRuntime
.
Value
;
}
internal
static
bool
IsRunningOnMono
=>
isRunningOnMono
.
Value
;
}
}
}
}
Titanium.Web.Proxy/Network/CertificateManager.cs
View file @
0ea90e0c
...
@@ -39,7 +39,7 @@ namespace Titanium.Web.Proxy.Network
...
@@ -39,7 +39,7 @@ namespace Titanium.Web.Proxy.Network
set
set
{
{
//For Mono only Bouncy Castle is supported
//For Mono only Bouncy Castle is supported
if
(
RunTime
.
IsRunningOnMono
()
)
if
(
RunTime
.
IsRunningOnMono
)
{
{
value
=
CertificateEngine
.
BouncyCastle
;
value
=
CertificateEngine
.
BouncyCastle
;
}
}
...
@@ -226,7 +226,7 @@ namespace Titanium.Web.Proxy.Network
...
@@ -226,7 +226,7 @@ namespace Titanium.Web.Proxy.Network
/// <returns></returns>
/// <returns></returns>
public
bool
TrustRootCertificateAsAdministrator
()
public
bool
TrustRootCertificateAsAdministrator
()
{
{
if
(
RunTime
.
IsRunningOnMono
()
)
if
(
RunTime
.
IsRunningOnMono
)
{
{
return
false
;
return
false
;
}
}
...
...
Titanium.Web.Proxy/ProxyServer.cs
View file @
0ea90e0c
...
@@ -348,7 +348,7 @@ namespace Titanium.Web.Proxy
...
@@ -348,7 +348,7 @@ namespace Titanium.Web.Proxy
/// <param name="endPoint"></param>
/// <param name="endPoint"></param>
public
void
SetAsSystemHttpProxy
(
ExplicitProxyEndPoint
endPoint
)
public
void
SetAsSystemHttpProxy
(
ExplicitProxyEndPoint
endPoint
)
{
{
if
(
RunTime
.
IsRunningOnMono
()
)
if
(
RunTime
.
IsRunningOnMono
)
{
{
throw
new
Exception
(
"Mono Runtime do not support system proxy settings."
);
throw
new
Exception
(
"Mono Runtime do not support system proxy settings."
);
}
}
...
@@ -375,7 +375,7 @@ namespace Titanium.Web.Proxy
...
@@ -375,7 +375,7 @@ namespace Titanium.Web.Proxy
/// <param name="endPoint"></param>
/// <param name="endPoint"></param>
public
void
SetAsSystemHttpsProxy
(
ExplicitProxyEndPoint
endPoint
)
public
void
SetAsSystemHttpsProxy
(
ExplicitProxyEndPoint
endPoint
)
{
{
if
(
RunTime
.
IsRunningOnMono
()
)
if
(
RunTime
.
IsRunningOnMono
)
{
{
throw
new
Exception
(
"Mono Runtime do not support system proxy settings."
);
throw
new
Exception
(
"Mono Runtime do not support system proxy settings."
);
}
}
...
@@ -416,7 +416,7 @@ namespace Titanium.Web.Proxy
...
@@ -416,7 +416,7 @@ namespace Titanium.Web.Proxy
/// </summary>
/// </summary>
public
void
DisableSystemHttpProxy
()
public
void
DisableSystemHttpProxy
()
{
{
if
(
RunTime
.
IsRunningOnMono
()
)
if
(
RunTime
.
IsRunningOnMono
)
{
{
throw
new
Exception
(
"Mono Runtime do not support system proxy settings."
);
throw
new
Exception
(
"Mono Runtime do not support system proxy settings."
);
}
}
...
@@ -429,7 +429,7 @@ namespace Titanium.Web.Proxy
...
@@ -429,7 +429,7 @@ namespace Titanium.Web.Proxy
/// </summary>
/// </summary>
public
void
DisableSystemHttpsProxy
()
public
void
DisableSystemHttpsProxy
()
{
{
if
(
RunTime
.
IsRunningOnMono
()
)
if
(
RunTime
.
IsRunningOnMono
)
{
{
throw
new
Exception
(
"Mono Runtime do not support system proxy settings."
);
throw
new
Exception
(
"Mono Runtime do not support system proxy settings."
);
}
}
...
@@ -442,7 +442,7 @@ namespace Titanium.Web.Proxy
...
@@ -442,7 +442,7 @@ namespace Titanium.Web.Proxy
/// </summary>
/// </summary>
public
void
DisableAllSystemProxies
()
public
void
DisableAllSystemProxies
()
{
{
if
(
RunTime
.
IsRunningOnMono
()
)
if
(
RunTime
.
IsRunningOnMono
)
{
{
throw
new
Exception
(
"Mono Runtime do not support system proxy settings."
);
throw
new
Exception
(
"Mono Runtime do not support system proxy settings."
);
}
}
...
@@ -474,7 +474,7 @@ namespace Titanium.Web.Proxy
...
@@ -474,7 +474,7 @@ namespace Titanium.Web.Proxy
CertificateManager
.
ClearIdleCertificates
(
CertificateCacheTimeOutMinutes
);
CertificateManager
.
ClearIdleCertificates
(
CertificateCacheTimeOutMinutes
);
if
(!
RunTime
.
IsRunningOnMono
()
)
if
(!
RunTime
.
IsRunningOnMono
)
{
{
WinAuthEndPoint
.
ClearIdleStates
(
2
);
WinAuthEndPoint
.
ClearIdleStates
(
2
);
}
}
...
...
Titanium.Web.Proxy/RequestHandler.cs
View file @
0ea90e0c
...
@@ -326,7 +326,7 @@ namespace Titanium.Web.Proxy
...
@@ -326,7 +326,7 @@ namespace Titanium.Web.Proxy
//we need a cache of request body
//we need a cache of request body
//so that we can send it after authentication in WinAuthHandler.cs
//so that we can send it after authentication in WinAuthHandler.cs
if
(
EnableWinAuth
if
(
EnableWinAuth
&&
!
RunTime
.
IsRunningOnMono
()
&&
!
RunTime
.
IsRunningOnMono
&&
args
.
WebSession
.
Request
.
HasBody
)
&&
args
.
WebSession
.
Request
.
HasBody
)
{
{
await
args
.
GetRequestBody
();
await
args
.
GetRequestBody
();
...
@@ -471,8 +471,7 @@ namespace Titanium.Web.Proxy
...
@@ -471,8 +471,7 @@ namespace Titanium.Web.Proxy
if
(!
args
.
WebSession
.
Request
.
ExpectationFailed
)
if
(!
args
.
WebSession
.
Request
.
ExpectationFailed
)
{
{
//If its a post/put/patch request, then read the client html body and send it to server
//If its a post/put/patch request, then read the client html body and send it to server
var
method
=
args
.
WebSession
.
Request
.
Method
.
ToUpper
();
if
(
args
.
WebSession
.
Request
.
HasBody
)
if
(
method
==
"POST"
||
method
==
"PUT"
||
method
==
"PATCH"
)
{
{
await
SendClientRequestBody
(
args
);
await
SendClientRequestBody
(
args
);
}
}
...
...
Titanium.Web.Proxy/ResponseHandler.cs
View file @
0ea90e0c
...
@@ -38,7 +38,7 @@ namespace Titanium.Web.Proxy
...
@@ -38,7 +38,7 @@ namespace Titanium.Web.Proxy
//check for windows authentication
//check for windows authentication
if
(
EnableWinAuth
if
(
EnableWinAuth
&&
!
RunTime
.
IsRunningOnMono
()
&&
!
RunTime
.
IsRunningOnMono
&&
args
.
WebSession
.
Response
.
ResponseStatusCode
==
"401"
)
&&
args
.
WebSession
.
Response
.
ResponseStatusCode
==
"401"
)
{
{
var
disposed
=
await
Handle401UnAuthorized
(
args
);
var
disposed
=
await
Handle401UnAuthorized
(
args
);
...
...
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