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
12d17b77
Commit
12d17b77
authored
Jun 25, 2017
by
Honfika
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make easier to switch to netstandard
parent
46140093
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
49 additions
and
9 deletions
+49
-9
DotNetStandardExtensions.cs
Titanium.Web.Proxy/Extensions/DotNetStandardExtensions.cs
+39
-0
TcpExtensions.cs
Titanium.Web.Proxy/Extensions/TcpExtensions.cs
+1
-1
CertificateManager.cs
Titanium.Web.Proxy/Network/CertificateManager.cs
+2
-1
TcpConnection.cs
Titanium.Web.Proxy/Network/Tcp/TcpConnection.cs
+3
-2
TcpConnectionFactory.cs
Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
+1
-2
ProxyServer.cs
Titanium.Web.Proxy/ProxyServer.cs
+2
-2
ResponseHandler.cs
Titanium.Web.Proxy/ResponseHandler.cs
+0
-1
Titanium.Web.Proxy.csproj
Titanium.Web.Proxy/Titanium.Web.Proxy.csproj
+1
-0
No files found.
Titanium.Web.Proxy/Extensions/DotNetStandardExtensions.cs
0 → 100644
View file @
12d17b77
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Net.Sockets
;
using
System.Security.Cryptography.X509Certificates
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
Titanium.Web.Proxy.Extensions
{
internal
static
class
DotNetStandardExtensions
{
/// <summary>
/// Disposes the specified client.
/// Int .NET framework 4.5 the TcpClient class has no Dispose method,
/// it is available from .NET 4.6, see
/// https://msdn.microsoft.com/en-us/library/dn823304(v=vs.110).aspx
/// </summary>
/// <param name="client">The client.</param>
internal
static
void
Dispose
(
this
TcpClient
client
)
{
client
.
Close
();
}
/// <summary>
/// Disposes the specified client.
/// Int .NET framework 4.5 the X509Store class has no Dispose method,
/// it is available from .NET 4.6, see
/// https://msdn.microsoft.com/en-us/library/system.security.cryptography.x509certificates.x509store.dispose(v=vs.110).aspx
/// </summary>
/// <param name="client">The client.</param>
internal
static
void
Dispose
(
this
X509Store
client
)
{
client
.
Close
();
}
}
}
Titanium.Web.Proxy/Extensions/TcpExtensions.cs
View file @
12d17b77
...
@@ -26,7 +26,7 @@ namespace Titanium.Web.Proxy.Extensions
...
@@ -26,7 +26,7 @@ namespace Titanium.Web.Proxy.Extensions
catch
(
SocketException
e
)
catch
(
SocketException
e
)
{
{
// 10035 == WSAEWOULDBLOCK
// 10035 == WSAEWOULDBLOCK
return
e
.
NativeErrorCode
.
Equals
(
10035
)
;
return
e
.
SocketErrorCode
==
SocketError
.
WouldBlock
;
}
}
finally
finally
{
{
...
...
Titanium.Web.Proxy/Network/CertificateManager.cs
View file @
12d17b77
...
@@ -7,6 +7,7 @@ using System.Linq;
...
@@ -7,6 +7,7 @@ using System.Linq;
using
System.Reflection
;
using
System.Reflection
;
using
System.Security.Cryptography.X509Certificates
;
using
System.Security.Cryptography.X509Certificates
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
Titanium.Web.Proxy.Extensions
;
using
Titanium.Web.Proxy.Helpers
;
using
Titanium.Web.Proxy.Helpers
;
using
Titanium.Web.Proxy.Network.Certificate
;
using
Titanium.Web.Proxy.Network.Certificate
;
...
@@ -348,7 +349,7 @@ namespace Titanium.Web.Proxy.Network
...
@@ -348,7 +349,7 @@ namespace Titanium.Web.Proxy.Network
}
}
finally
finally
{
{
x509Store
.
Cl
ose
();
x509Store
.
Disp
ose
();
}
}
}
}
...
...
Titanium.Web.Proxy/Network/Tcp/TcpConnection.cs
View file @
12d17b77
using
System
;
using
System
;
using
System.IO
;
using
System.IO
;
using
System.Net.Sockets
;
using
System.Net.Sockets
;
using
Titanium.Web.Proxy.Extensions
;
using
Titanium.Web.Proxy.Helpers
;
using
Titanium.Web.Proxy.Helpers
;
using
Titanium.Web.Proxy.Models
;
using
Titanium.Web.Proxy.Models
;
...
@@ -57,7 +58,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
...
@@ -57,7 +58,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
/// </summary>
/// </summary>
public
void
Dispose
()
public
void
Dispose
()
{
{
Stream
?.
Cl
ose
();
Stream
?.
Disp
ose
();
StreamReader
?.
Dispose
();
StreamReader
?.
Dispose
();
...
@@ -70,7 +71,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
...
@@ -70,7 +71,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
//It helps to avoid eventual deterioration of performance due to TCP port exhaustion
//It helps to avoid eventual deterioration of performance due to TCP port exhaustion
//due to default TCP CLOSE_WAIT timeout for 4 minutes
//due to default TCP CLOSE_WAIT timeout for 4 minutes
TcpClient
.
LingerState
=
new
LingerOption
(
true
,
0
);
TcpClient
.
LingerState
=
new
LingerOption
(
true
,
0
);
TcpClient
.
Cl
ose
();
TcpClient
.
Disp
ose
();
}
}
}
}
catch
catch
...
...
Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
View file @
12d17b77
...
@@ -77,7 +77,6 @@ namespace Titanium.Web.Proxy.Network.Tcp
...
@@ -77,7 +77,6 @@ namespace Titanium.Web.Proxy.Network.Tcp
}
}
await
writer
.
WriteLineAsync
();
await
writer
.
WriteLineAsync
();
await
writer
.
FlushAsync
();
await
writer
.
FlushAsync
();
writer
.
Close
();
}
}
using
(
var
reader
=
new
CustomBinaryReader
(
stream
,
server
.
BufferSize
))
using
(
var
reader
=
new
CustomBinaryReader
(
stream
,
server
.
BufferSize
))
...
@@ -113,7 +112,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
...
@@ -113,7 +112,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
catch
(
Exception
)
catch
(
Exception
)
{
{
stream
?.
Dispose
();
stream
?.
Dispose
();
client
?.
Cl
ose
();
client
?.
Disp
ose
();
throw
;
throw
;
}
}
...
...
Titanium.Web.Proxy/ProxyServer.cs
View file @
12d17b77
...
@@ -8,6 +8,7 @@ using System.Security.Cryptography.X509Certificates;
...
@@ -8,6 +8,7 @@ using System.Security.Cryptography.X509Certificates;
using
System.Threading
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
Titanium.Web.Proxy.EventArguments
;
using
Titanium.Web.Proxy.EventArguments
;
using
Titanium.Web.Proxy.Extensions
;
using
Titanium.Web.Proxy.Helpers
;
using
Titanium.Web.Proxy.Helpers
;
using
Titanium.Web.Proxy.Helpers.WinHttp
;
using
Titanium.Web.Proxy.Helpers.WinHttp
;
using
Titanium.Web.Proxy.Models
;
using
Titanium.Web.Proxy.Models
;
...
@@ -723,7 +724,7 @@ namespace Titanium.Web.Proxy
...
@@ -723,7 +724,7 @@ namespace Titanium.Web.Proxy
//It helps to avoid eventual deterioration of performance due to TCP port exhaustion
//It helps to avoid eventual deterioration of performance due to TCP port exhaustion
//due to default TCP CLOSE_WAIT timeout for 4 minutes
//due to default TCP CLOSE_WAIT timeout for 4 minutes
tcpClient
.
LingerState
=
new
LingerOption
(
true
,
0
);
tcpClient
.
LingerState
=
new
LingerOption
(
true
,
0
);
tcpClient
.
Cl
ose
();
tcpClient
.
Disp
ose
();
}
}
}
}
catch
catch
...
@@ -744,7 +745,6 @@ namespace Titanium.Web.Proxy
...
@@ -744,7 +745,6 @@ 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
();
endPoint
.
Listener
.
Server
.
Dispose
();
}
}
}
}
...
...
Titanium.Web.Proxy/ResponseHandler.cs
View file @
12d17b77
...
@@ -217,7 +217,6 @@ namespace Titanium.Web.Proxy
...
@@ -217,7 +217,6 @@ namespace Titanium.Web.Proxy
/// <param name="serverConnection"></param>
/// <param name="serverConnection"></param>
private
void
Dispose
(
Stream
clientStream
,
CustomBinaryReader
clientStreamReader
,
StreamWriter
clientStreamWriter
,
TcpConnection
serverConnection
)
private
void
Dispose
(
Stream
clientStream
,
CustomBinaryReader
clientStreamReader
,
StreamWriter
clientStreamWriter
,
TcpConnection
serverConnection
)
{
{
clientStream
?.
Close
();
clientStream
?.
Dispose
();
clientStream
?.
Dispose
();
clientStreamReader
?.
Dispose
();
clientStreamReader
?.
Dispose
();
...
...
Titanium.Web.Proxy/Titanium.Web.Proxy.csproj
View file @
12d17b77
...
@@ -76,6 +76,7 @@
...
@@ -76,6 +76,7 @@
<Compile
Include=
"EventArguments\DataEventArgs.cs"
/>
<Compile
Include=
"EventArguments\DataEventArgs.cs"
/>
<Compile
Include=
"EventArguments\TunnelConnectEventArgs.cs"
/>
<Compile
Include=
"EventArguments\TunnelConnectEventArgs.cs"
/>
<Compile
Include=
"Extensions\ByteArrayExtensions.cs"
/>
<Compile
Include=
"Extensions\ByteArrayExtensions.cs"
/>
<Compile
Include=
"Extensions\DotNetStandardExtensions.cs"
/>
<Compile
Include=
"Extensions\FuncExtensions.cs"
/>
<Compile
Include=
"Extensions\FuncExtensions.cs"
/>
<Compile
Include=
"Helpers\HttpHelper.cs"
/>
<Compile
Include=
"Helpers\HttpHelper.cs"
/>
<Compile
Include=
"Extensions\StringExtensions.cs"
/>
<Compile
Include=
"Extensions\StringExtensions.cs"
/>
...
...
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