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
da855a53
Commit
da855a53
authored
Jun 25, 2017
by
Honfika
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make easier to switch to netstandard
parent
87091a8f
Hide 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 @
da855a53
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 @
da855a53
...
...
@@ -26,7 +26,7 @@ namespace Titanium.Web.Proxy.Extensions
catch
(
SocketException
e
)
{
// 10035 == WSAEWOULDBLOCK
return
e
.
NativeErrorCode
.
Equals
(
10035
)
;
return
e
.
SocketErrorCode
==
SocketError
.
WouldBlock
;
}
finally
{
...
...
Titanium.Web.Proxy/Network/CertificateManager.cs
View file @
da855a53
...
...
@@ -7,6 +7,7 @@ using System.Linq;
using
System.Reflection
;
using
System.Security.Cryptography.X509Certificates
;
using
System.Threading.Tasks
;
using
Titanium.Web.Proxy.Extensions
;
using
Titanium.Web.Proxy.Helpers
;
using
Titanium.Web.Proxy.Network.Certificate
;
...
...
@@ -348,7 +349,7 @@ namespace Titanium.Web.Proxy.Network
}
finally
{
x509Store
.
Cl
ose
();
x509Store
.
Disp
ose
();
}
}
...
...
Titanium.Web.Proxy/Network/Tcp/TcpConnection.cs
View file @
da855a53
using
System
;
using
System.IO
;
using
System.Net.Sockets
;
using
Titanium.Web.Proxy.Extensions
;
using
Titanium.Web.Proxy.Helpers
;
using
Titanium.Web.Proxy.Models
;
...
...
@@ -57,7 +58,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
/// </summary>
public
void
Dispose
()
{
Stream
?.
Cl
ose
();
Stream
?.
Disp
ose
();
StreamReader
?.
Dispose
();
...
...
@@ -70,7 +71,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
//It helps to avoid eventual deterioration of performance due to TCP port exhaustion
//due to default TCP CLOSE_WAIT timeout for 4 minutes
TcpClient
.
LingerState
=
new
LingerOption
(
true
,
0
);
TcpClient
.
Cl
ose
();
TcpClient
.
Disp
ose
();
}
}
catch
...
...
Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
View file @
da855a53
...
...
@@ -77,7 +77,6 @@ namespace Titanium.Web.Proxy.Network.Tcp
}
await
writer
.
WriteLineAsync
();
await
writer
.
FlushAsync
();
writer
.
Close
();
}
using
(
var
reader
=
new
CustomBinaryReader
(
stream
,
server
.
BufferSize
))
...
...
@@ -113,7 +112,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
catch
(
Exception
)
{
stream
?.
Dispose
();
client
?.
Cl
ose
();
client
?.
Disp
ose
();
throw
;
}
...
...
Titanium.Web.Proxy/ProxyServer.cs
View file @
da855a53
...
...
@@ -8,6 +8,7 @@ using System.Security.Cryptography.X509Certificates;
using
System.Threading
;
using
System.Threading.Tasks
;
using
Titanium.Web.Proxy.EventArguments
;
using
Titanium.Web.Proxy.Extensions
;
using
Titanium.Web.Proxy.Helpers
;
using
Titanium.Web.Proxy.Helpers.WinHttp
;
using
Titanium.Web.Proxy.Models
;
...
...
@@ -723,7 +724,7 @@ namespace Titanium.Web.Proxy
//It helps to avoid eventual deterioration of performance due to TCP port exhaustion
//due to default TCP CLOSE_WAIT timeout for 4 minutes
tcpClient
.
LingerState
=
new
LingerOption
(
true
,
0
);
tcpClient
.
Cl
ose
();
tcpClient
.
Disp
ose
();
}
}
catch
...
...
@@ -744,7 +745,6 @@ namespace Titanium.Web.Proxy
private
void
QuitListen
(
ProxyEndPoint
endPoint
)
{
endPoint
.
Listener
.
Stop
();
endPoint
.
Listener
.
Server
.
Close
();
endPoint
.
Listener
.
Server
.
Dispose
();
}
}
...
...
Titanium.Web.Proxy/ResponseHandler.cs
View file @
da855a53
...
...
@@ -217,7 +217,6 @@ namespace Titanium.Web.Proxy
/// <param name="serverConnection"></param>
private
void
Dispose
(
Stream
clientStream
,
CustomBinaryReader
clientStreamReader
,
StreamWriter
clientStreamWriter
,
TcpConnection
serverConnection
)
{
clientStream
?.
Close
();
clientStream
?.
Dispose
();
clientStreamReader
?.
Dispose
();
...
...
Titanium.Web.Proxy/Titanium.Web.Proxy.csproj
View file @
da855a53
...
...
@@ -76,6 +76,7 @@
<Compile
Include=
"EventArguments\DataEventArgs.cs"
/>
<Compile
Include=
"EventArguments\TunnelConnectEventArgs.cs"
/>
<Compile
Include=
"Extensions\ByteArrayExtensions.cs"
/>
<Compile
Include=
"Extensions\DotNetStandardExtensions.cs"
/>
<Compile
Include=
"Extensions\FuncExtensions.cs"
/>
<Compile
Include=
"Helpers\HttpHelper.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