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
61da8091
Commit
61da8091
authored
Apr 12, 2019
by
justcoding121
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into beta
parents
a285a45b
f225e38d
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
133 additions
and
154 deletions
+133
-154
Titanium.Web.Proxy.ProxyServer.html
docs/api/Titanium.Web.Proxy.ProxyServer.html
+82
-83
index.json
docs/index.json
+1
-1
xrefmap.yml
docs/xrefmap.yml
+13
-13
Titanium.Web.Proxy.Examples.Wpf.csproj
...Proxy.Examples.Wpf/Titanium.Web.Proxy.Examples.Wpf.csproj
+2
-2
packages.config
examples/Titanium.Web.Proxy.Examples.Wpf/packages.config
+1
-1
ExplicitClientHandler.cs
src/Titanium.Web.Proxy/ExplicitClientHandler.cs
+7
-2
ProxyServer.cs
src/Titanium.Web.Proxy/ProxyServer.cs
+18
-43
Titanium.Web.Proxy.csproj
src/Titanium.Web.Proxy/Titanium.Web.Proxy.csproj
+3
-3
Titanium.Web.Proxy.nuspec
src/Titanium.Web.Proxy/Titanium.Web.Proxy.nuspec
+6
-6
No files found.
docs/api/Titanium.Web.Proxy.ProxyServer.html
View file @
61da8091
This diff is collapsed.
Click to expand it.
docs/index.json
View file @
61da8091
This diff is collapsed.
Click to expand it.
docs/xrefmap.yml
View file @
61da8091
...
@@ -3505,19 +3505,6 @@ references:
...
@@ -3505,19 +3505,6 @@ references:
isSpec
:
"
True"
isSpec
:
"
True"
fullName
:
Titanium.Web.Proxy.ProxyServer.EnableTcpServerConnectionPrefetch
fullName
:
Titanium.Web.Proxy.ProxyServer.EnableTcpServerConnectionPrefetch
nameWithType
:
ProxyServer.EnableTcpServerConnectionPrefetch
nameWithType
:
ProxyServer.EnableTcpServerConnectionPrefetch
-
uid
:
Titanium.Web.Proxy.ProxyServer.EnableThreadPoolOptimizing
name
:
EnableThreadPoolOptimizing
href
:
api/Titanium.Web.Proxy.ProxyServer.html#Titanium_Web_Proxy_ProxyServer_EnableThreadPoolOptimizing
commentId
:
P:Titanium.Web.Proxy.ProxyServer.EnableThreadPoolOptimizing
fullName
:
Titanium.Web.Proxy.ProxyServer.EnableThreadPoolOptimizing
nameWithType
:
ProxyServer.EnableThreadPoolOptimizing
-
uid
:
Titanium.Web.Proxy.ProxyServer.EnableThreadPoolOptimizing*
name
:
EnableThreadPoolOptimizing
href
:
api/Titanium.Web.Proxy.ProxyServer.html#Titanium_Web_Proxy_ProxyServer_EnableThreadPoolOptimizing_
commentId
:
Overload:Titanium.Web.Proxy.ProxyServer.EnableThreadPoolOptimizing
isSpec
:
"
True"
fullName
:
Titanium.Web.Proxy.ProxyServer.EnableThreadPoolOptimizing
nameWithType
:
ProxyServer.EnableThreadPoolOptimizing
-
uid
:
Titanium.Web.Proxy.ProxyServer.EnableWinAuth
-
uid
:
Titanium.Web.Proxy.ProxyServer.EnableWinAuth
name
:
EnableWinAuth
name
:
EnableWinAuth
href
:
api/Titanium.Web.Proxy.ProxyServer.html#Titanium_Web_Proxy_ProxyServer_EnableWinAuth
href
:
api/Titanium.Web.Proxy.ProxyServer.html#Titanium_Web_Proxy_ProxyServer_EnableWinAuth
...
@@ -3828,6 +3815,19 @@ references:
...
@@ -3828,6 +3815,19 @@ references:
isSpec
:
"
True"
isSpec
:
"
True"
fullName
:
Titanium.Web.Proxy.ProxyServer.TcpTimeWaitSeconds
fullName
:
Titanium.Web.Proxy.ProxyServer.TcpTimeWaitSeconds
nameWithType
:
ProxyServer.TcpTimeWaitSeconds
nameWithType
:
ProxyServer.TcpTimeWaitSeconds
-
uid
:
Titanium.Web.Proxy.ProxyServer.ThreadPoolWorkerThread
name
:
ThreadPoolWorkerThread
href
:
api/Titanium.Web.Proxy.ProxyServer.html#Titanium_Web_Proxy_ProxyServer_ThreadPoolWorkerThread
commentId
:
P:Titanium.Web.Proxy.ProxyServer.ThreadPoolWorkerThread
fullName
:
Titanium.Web.Proxy.ProxyServer.ThreadPoolWorkerThread
nameWithType
:
ProxyServer.ThreadPoolWorkerThread
-
uid
:
Titanium.Web.Proxy.ProxyServer.ThreadPoolWorkerThread*
name
:
ThreadPoolWorkerThread
href
:
api/Titanium.Web.Proxy.ProxyServer.html#Titanium_Web_Proxy_ProxyServer_ThreadPoolWorkerThread_
commentId
:
Overload:Titanium.Web.Proxy.ProxyServer.ThreadPoolWorkerThread
isSpec
:
"
True"
fullName
:
Titanium.Web.Proxy.ProxyServer.ThreadPoolWorkerThread
nameWithType
:
ProxyServer.ThreadPoolWorkerThread
-
uid
:
Titanium.Web.Proxy.ProxyServer.UpStreamEndPoint
-
uid
:
Titanium.Web.Proxy.ProxyServer.UpStreamEndPoint
name
:
UpStreamEndPoint
name
:
UpStreamEndPoint
href
:
api/Titanium.Web.Proxy.ProxyServer.html#Titanium_Web_Proxy_ProxyServer_UpStreamEndPoint
href
:
api/Titanium.Web.Proxy.ProxyServer.html#Titanium_Web_Proxy_ProxyServer_UpStreamEndPoint
...
...
examples/Titanium.Web.Proxy.Examples.Wpf/Titanium.Web.Proxy.Examples.Wpf.csproj
View file @
61da8091
...
@@ -72,8 +72,8 @@
...
@@ -72,8 +72,8 @@
<Prefer32Bit>
true
</Prefer32Bit>
<Prefer32Bit>
true
</Prefer32Bit>
</PropertyGroup>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<Reference
Include=
"StreamExtended, Version=1.0.
190
.0, Culture=neutral, PublicKeyToken=bbfa0f1d54f50043, processorArchitecture=MSIL"
>
<Reference
Include=
"StreamExtended, Version=1.0.
201
.0, Culture=neutral, PublicKeyToken=bbfa0f1d54f50043, processorArchitecture=MSIL"
>
<HintPath>
..\..\src\packages\StreamExtended.1.0.
190
\lib\net45\StreamExtended.dll
</HintPath>
<HintPath>
..\..\src\packages\StreamExtended.1.0.
201
\lib\net45\StreamExtended.dll
</HintPath>
</Reference>
</Reference>
<Reference
Include=
"System"
/>
<Reference
Include=
"System"
/>
<Reference
Include=
"System.Data"
/>
<Reference
Include=
"System.Data"
/>
...
...
examples/Titanium.Web.Proxy.Examples.Wpf/packages.config
View file @
61da8091
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
packages
>
<
packages
>
<
package
id
=
"StreamExtended"
version
=
"1.0.
190
"
targetFramework
=
"net45"
/>
<
package
id
=
"StreamExtended"
version
=
"1.0.
201
"
targetFramework
=
"net45"
/>
</
packages
>
</
packages
>
\ No newline at end of file
src/Titanium.Web.Proxy/ExplicitClientHandler.cs
View file @
61da8091
...
@@ -153,9 +153,14 @@ namespace Titanium.Web.Proxy
...
@@ -153,9 +153,14 @@ namespace Titanium.Web.Proxy
}
}
if
(
EnableTcpServerConnectionPrefetch
)
if
(
EnableTcpServerConnectionPrefetch
)
{
IPAddress
[]
ipAddresses
=
null
;
try
{
{
//make sure the host can be resolved before creating the prefetch task
//make sure the host can be resolved before creating the prefetch task
var
ipAddresses
=
await
Dns
.
GetHostAddressesAsync
(
connectArgs
.
HttpClient
.
Request
.
RequestUri
.
Host
);
ipAddresses
=
await
Dns
.
GetHostAddressesAsync
(
connectArgs
.
HttpClient
.
Request
.
RequestUri
.
Host
);
}
catch
(
SocketException
)
{
}
if
(
ipAddresses
!=
null
&&
ipAddresses
.
Length
>
0
)
if
(
ipAddresses
!=
null
&&
ipAddresses
.
Length
>
0
)
{
{
...
...
src/Titanium.Web.Proxy/ProxyServer.cs
View file @
61da8091
...
@@ -57,10 +57,6 @@ namespace Titanium.Web.Proxy
...
@@ -57,10 +57,6 @@ namespace Titanium.Web.Proxy
/// </summary>
/// </summary>
private
WinHttpWebProxyFinder
systemProxyResolver
;
private
WinHttpWebProxyFinder
systemProxyResolver
;
/// <summary>
/// lock for Thread Pool tuning
/// </summary>
private
object
lockThreadPoolTuning
=
new
object
();
/// <inheritdoc />
/// <inheritdoc />
/// <summary>
/// <summary>
...
@@ -178,12 +174,6 @@ namespace Titanium.Web.Proxy
...
@@ -178,12 +174,6 @@ namespace Titanium.Web.Proxy
/// </summary>
/// </summary>
public
bool
EnableTcpServerConnectionPrefetch
{
get
;
set
;
}
=
true
;
public
bool
EnableTcpServerConnectionPrefetch
{
get
;
set
;
}
=
true
;
/// <summary>
/// Gets or sets a Boolean value that specifies whether ThreadPool grows new connections and decrease when connections close
/// Defaults to true.
/// </summary>
public
bool
EnableThreadPoolOptimizing
{
get
;
set
;
}
=
true
;
/// <summary>
/// <summary>
/// Gets or sets a Boolean value that specifies whether server and client stream Sockets are using the Nagle algorithm.
/// Gets or sets a Boolean value that specifies whether server and client stream Sockets are using the Nagle algorithm.
/// Defaults to true, no nagle algorithm is used.
/// Defaults to true, no nagle algorithm is used.
...
@@ -363,6 +353,11 @@ namespace Titanium.Web.Proxy
...
@@ -363,6 +353,11 @@ namespace Titanium.Web.Proxy
/// </summary>
/// </summary>
public
event
AsyncEventHandler
<
TcpClient
>
OnServerConnectionCreate
;
public
event
AsyncEventHandler
<
TcpClient
>
OnServerConnectionCreate
;
/// <summary>
/// Customize the minimum ThreadPool size (increase it on a server)
/// </summary>
public
int
ThreadPoolWorkerThread
{
get
;
set
;
}
=
Environment
.
ProcessorCount
;
/// <summary>
/// <summary>
/// Add a proxy end point.
/// Add a proxy end point.
/// </summary>
/// </summary>
...
@@ -555,6 +550,8 @@ namespace Titanium.Web.Proxy
...
@@ -555,6 +550,8 @@ namespace Titanium.Web.Proxy
throw
new
Exception
(
"Proxy is already running."
);
throw
new
Exception
(
"Proxy is already running."
);
}
}
setThreadPoolMinThread
(
ThreadPoolWorkerThread
);
if
(
ProxyEndPoints
.
OfType
<
ExplicitProxyEndPoint
>().
Any
(
x
=>
x
.
GenericCertificate
==
null
))
if
(
ProxyEndPoints
.
OfType
<
ExplicitProxyEndPoint
>().
Any
(
x
=>
x
.
GenericCertificate
==
null
))
{
{
CertificateManager
.
EnsureRootCertificate
();
CertificateManager
.
EnsureRootCertificate
();
...
@@ -732,19 +729,9 @@ namespace Titanium.Web.Proxy
...
@@ -732,19 +729,9 @@ namespace Titanium.Web.Proxy
if
(
tcpClient
!=
null
)
if
(
tcpClient
!=
null
)
{
{
setThreadPoolMinThread
(
1
);
// increase the ThreadPool
Task
.
Run
(
async
()
=>
Task
.
Run
(
async
()
=>
{
try
{
{
await
handleClient
(
tcpClient
,
endPoint
);
await
handleClient
(
tcpClient
,
endPoint
);
}
finally
{
setThreadPoolMinThread
(-
1
);
//decrease the Threadpool
}
});
});
}
}
...
@@ -752,35 +739,23 @@ namespace Titanium.Web.Proxy
...
@@ -752,35 +739,23 @@ namespace Titanium.Web.Proxy
endPoint
.
Listener
.
BeginAcceptTcpClient
(
onAcceptConnection
,
endPoint
);
endPoint
.
Listener
.
BeginAcceptTcpClient
(
onAcceptConnection
,
endPoint
);
}
}
private
Lazy
<
int
>
maxWorkerThreads
=
new
Lazy
<
int
>(()
=>
{
int
maxWorkerThreads
;
ThreadPool
.
GetMaxThreads
(
out
maxWorkerThreads
,
out
var
_
);
return
maxWorkerThreads
;
});
/// <summary>
/// <summary>
/// Change the ThreadPool.WorkerThread minThread
/// Change the ThreadPool.WorkerThread minThread
/// </summary>
/// </summary>
/// <param name="workerThreadsToAdd">Number of threads to add</param>
/// <param name="workerThreadsToAdd">minimum Threads allocated in the ThreadPool</param>
private
void
setThreadPoolMinThread
(
int
workerThreadsToAdd
)
private
void
setThreadPoolMinThread
(
int
workerThreads
)
{
if
(
EnableThreadPoolOptimizing
)
{
lock
(
lockThreadPoolTuning
)
{
{
int
minWorkerThreads
,
minCompletionPort
Threads
;
int
minWorkerThreads
,
minCompletionPortThreads
,
maxWorker
Threads
;
ThreadPool
.
GetMinThreads
(
out
minWorkerThreads
,
out
minCompletionPortThreads
);
ThreadPool
.
GetMinThreads
(
out
minWorkerThreads
,
out
minCompletionPortThreads
);
minWorkerThreads
=
Math
.
Max
(
minWorkerThreads
+
workerThreadsToAdd
,
Environment
.
ProcessorCount
);
ThreadPool
.
GetMaxThreads
(
out
maxWorkerThreads
,
out
_
);
minWorkerThreads
=
Math
.
Min
(
maxWorkerThreads
,
Math
.
Max
(
workerThreads
,
Environment
.
ProcessorCount
));
if
(
minWorkerThreads
<=
maxWorkerThreads
.
Value
)
{
ThreadPool
.
SetMinThreads
(
minWorkerThreads
,
minCompletionPortThreads
);
ThreadPool
.
SetMinThreads
(
minWorkerThreads
,
minCompletionPortThreads
);
}
}
}
}
}
/// <summary>
/// <summary>
/// Handle the client.
/// Handle the client.
...
...
src/Titanium.Web.Proxy/Titanium.Web.Proxy.csproj
View file @
61da8091
...
@@ -13,9 +13,9 @@
...
@@ -13,9 +13,9 @@
</PropertyGroup>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<PackageReference Include="BrotliSharpLib" Version="0.3.
1
" />
<PackageReference Include="BrotliSharpLib" Version="0.3.
3
" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.
3.37
" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.
5
" />
<PackageReference Include="StreamExtended" Version="1.0.
190
" />
<PackageReference Include="StreamExtended" Version="1.0.
201
" />
</ItemGroup>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
...
...
src/Titanium.Web.Proxy/Titanium.Web.Proxy.nuspec
View file @
61da8091
...
@@ -15,14 +15,14 @@
...
@@ -15,14 +15,14 @@
<tags></tags>
<tags></tags>
<dependencies>
<dependencies>
<group
targetFramework=
"net45"
>
<group
targetFramework=
"net45"
>
<dependency
id=
"StreamExtended"
version=
"1.0.
190
"
/>
<dependency
id=
"StreamExtended"
version=
"1.0.
201
"
/>
<dependency
id=
"Portable.BouncyCastle"
version=
"1.8.
3.37
"
/>
<dependency
id=
"Portable.BouncyCastle"
version=
"1.8.
5
"
/>
<dependency
id=
"BrotliSharpLib"
version=
"0.3.
1
"
/>
<dependency
id=
"BrotliSharpLib"
version=
"0.3.
3
"
/>
</group>
</group>
<group
targetFramework=
"netstandard2.0"
>
<group
targetFramework=
"netstandard2.0"
>
<dependency
id=
"StreamExtended"
version=
"1.0.
190
"
/>
<dependency
id=
"StreamExtended"
version=
"1.0.
201
"
/>
<dependency
id=
"Portable.BouncyCastle"
version=
"1.8.
3.37
"
/>
<dependency
id=
"Portable.BouncyCastle"
version=
"1.8.
5
"
/>
<dependency
id=
"BrotliSharpLib"
version=
"0.3.
1
"
/>
<dependency
id=
"BrotliSharpLib"
version=
"0.3.
3
"
/>
<dependency
id=
"Microsoft.Win32.Registry"
version=
"4.4.0"
/>
<dependency
id=
"Microsoft.Win32.Registry"
version=
"4.4.0"
/>
<dependency
id=
"System.Security.Principal.Windows"
version=
"4.4.1"
/>
<dependency
id=
"System.Security.Principal.Windows"
version=
"4.4.1"
/>
</group>
</group>
...
...
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