From 65357243cb1b35a1c24d62f1684c2373ce0f2c37 Mon Sep 17 00:00:00 2001 From: Honfika Date: Sat, 31 Aug 2019 19:04:40 +0200 Subject: [PATCH 1/2] small fixes and improvements --- .../MainWindow.xaml | 1 + .../MainWindow.xaml.cs | 3 +- .../SessionListItem.cs | 3 ++ .../EventArguments/LimitedStream.cs | 2 +- .../EventArguments/SessionEventArgs.cs | 12 +++---- .../EventArguments/SessionEventArgsBase.cs | 9 +++--- .../ExplicitClientHandler.cs | 27 ++++++++-------- .../Extensions/StreamExtensions.cs | 10 +++--- .../Extensions/UriExtensions.cs | 2 +- src/Titanium.Web.Proxy/Helpers/HttpHelper.cs | 16 ++++------ .../Helpers/HttpRequestWriter.cs | 4 +-- .../Helpers/HttpResponseWriter.cs | 4 +-- src/Titanium.Web.Proxy/Helpers/HttpWriter.cs | 11 +++---- src/Titanium.Web.Proxy/Helpers/TcpHelper.cs | 31 +++++++------------ .../Models/ProxyEndPoint.cs | 8 ----- .../Network/DebugCustomBufferedStream.cs | 4 +-- .../Network/Tcp/TcpClientConnection.cs | 3 +- .../Network/Tcp/TcpConnectionFactory.cs | 11 ++++--- .../ProxyAuthorizationHandler.cs | 1 + src/Titanium.Web.Proxy/ProxyServer.cs | 13 +------- .../BufferPool/DefaultBufferPool.cs | 17 +++++++++- .../StreamExtended/BufferPool/IBufferPool.cs | 4 +++ .../StreamExtended/Network/CopyStream.cs | 11 +++---- .../Network/CustomBufferedPeekStream.cs | 8 ++--- .../Network/CustomBufferedStream.cs | 25 +++++++-------- .../Network/ICustomStreamReader.cs | 5 ++- .../StreamExtended/Network/TaskResult.cs | 3 +- .../StreamExtended/SslTools.cs | 2 +- .../TransparentClientHandler.cs | 12 +++---- src/Titanium.Web.Proxy/WebSocketHandler.cs | 6 ++-- 30 files changed, 121 insertions(+), 147 deletions(-) diff --git a/examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml b/examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml index ec5e4ff33..e21b1479b 100644 --- a/examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml +++ b/examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml @@ -31,6 +31,7 @@ + diff --git a/examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml.cs b/examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml.cs index e09defe8d..1edd61075 100644 --- a/examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml.cs +++ b/examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml.cs @@ -226,10 +226,11 @@ private SessionListItem createSessionListItem(SessionEventArgsBase e) { Number = lastSessionNumber, HttpClient = e.HttpClient, + ClientEndPoint = e.ClientEndPoint, IsTunnelConnect = isTunnelConnect }; - if (isTunnelConnect || e.HttpClient.Request.UpgradeToWebSocket) + //if (isTunnelConnect || e.HttpClient.Request.UpgradeToWebSocket) { e.DataReceived += (sender, args) => { diff --git a/examples/Titanium.Web.Proxy.Examples.Wpf/SessionListItem.cs b/examples/Titanium.Web.Proxy.Examples.Wpf/SessionListItem.cs index 7cfd456b2..ee8c716ad 100644 --- a/examples/Titanium.Web.Proxy.Examples.Wpf/SessionListItem.cs +++ b/examples/Titanium.Web.Proxy.Examples.Wpf/SessionListItem.cs @@ -1,5 +1,6 @@ using System; using System.ComponentModel; +using System.Net; using System.Runtime.CompilerServices; using Titanium.Web.Proxy.Examples.Wpf.Annotations; using Titanium.Web.Proxy.Http; @@ -22,6 +23,8 @@ public class SessionListItem : INotifyPropertyChanged public HttpWebClient HttpClient { get; set; } + public IPEndPoint ClientEndPoint { get; set; } + public bool IsTunnelConnect { get; set; } public string StatusCode diff --git a/src/Titanium.Web.Proxy/EventArguments/LimitedStream.cs b/src/Titanium.Web.Proxy/EventArguments/LimitedStream.cs index effa14589..18dfcfe7d 100644 --- a/src/Titanium.Web.Proxy/EventArguments/LimitedStream.cs +++ b/src/Titanium.Web.Proxy/EventArguments/LimitedStream.cs @@ -132,7 +132,7 @@ public async Task Finish() { if (bytesRemaining != -1) { - var buffer = bufferPool.GetBuffer(baseStream.BufferSize); + var buffer = bufferPool.GetBuffer(); try { int res = await ReadAsync(buffer, 0, buffer.Length); diff --git a/src/Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs b/src/Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs index 2e14f37f9..fbbe3cc83 100644 --- a/src/Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs +++ b/src/Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs @@ -121,7 +121,6 @@ private async Task readRequestBodyAsync(CancellationToken cancellationToken) // Now set the flag to true // So that next time we can deliver body from cache request.IsBodyRead = true; - OnDataSent(body, 0, body.Length); } } } @@ -194,7 +193,6 @@ private async Task readResponseBodyAsync(CancellationToken cancellationToken) // Now set the flag to true // So that next time we can deliver body from cache response.IsBodyRead = true; - OnDataReceived(body, 0, body.Length); } } } @@ -203,7 +201,7 @@ private async Task readBodyAsync(bool isRequest, CancellationToken cance { using (var bodyStream = new MemoryStream()) { - var writer = new HttpWriter(bodyStream, BufferPool, BufferSize); + var writer = new HttpWriter(bodyStream, BufferPool); if (isRequest) { @@ -235,7 +233,7 @@ internal async Task SyphonOutBodyAsync(bool isRequest, CancellationToken cancell using (var bodyStream = new MemoryStream()) { - var writer = new HttpWriter(bodyStream, BufferPool, BufferSize); + var writer = new HttpWriter(bodyStream, BufferPool); await copyBodyAsync(isRequest, true, writer, TransformationMode.None, null, cancellationToken); } } @@ -256,7 +254,7 @@ internal async Task CopyRequestBodyAsync(HttpWriter writer, TransformationMode t var reader = getStreamReader(true); string boundary = HttpHelper.GetBoundaryFromContentType(request.ContentType); - using (var copyStream = new CopyStream(reader, writer, BufferPool, BufferSize)) + using (var copyStream = new CopyStream(reader, writer, BufferPool)) { while (contentLength > copyStream.ReadBytes) { @@ -317,7 +315,7 @@ private async Task copyBodyAsync(bool isRequest, bool useOriginalHeaderValues, H try { - using (var bufStream = new CustomBufferedStream(s, BufferPool, BufferSize, true)) + using (var bufStream = new CustomBufferedStream(s, BufferPool, true)) { await writer.CopyBodyAsync(bufStream, false, -1, onCopy, cancellationToken); } @@ -339,7 +337,7 @@ private async Task readUntilBoundaryAsync(ICustomStreamReader reader, long { int bufferDataLength = 0; - var buffer = BufferPool.GetBuffer(BufferSize); + var buffer = BufferPool.GetBuffer(); try { int boundaryLength = boundary.Length + 4; diff --git a/src/Titanium.Web.Proxy/EventArguments/SessionEventArgsBase.cs b/src/Titanium.Web.Proxy/EventArguments/SessionEventArgsBase.cs index 05af37bd0..d970ef03a 100644 --- a/src/Titanium.Web.Proxy/EventArguments/SessionEventArgsBase.cs +++ b/src/Titanium.Web.Proxy/EventArguments/SessionEventArgsBase.cs @@ -21,10 +21,11 @@ namespace Titanium.Web.Proxy.EventArguments public abstract class SessionEventArgsBase : EventArgs, IDisposable { internal readonly CancellationTokenSource CancellationTokenSource; + internal TcpServerConnection ServerConnection => HttpClient.Connection; + internal TcpClientConnection ClientConnection => ProxyClient.Connection; - protected readonly int BufferSize; protected readonly IBufferPool BufferPool; protected readonly ExceptionHandler ExceptionFunc; @@ -36,10 +37,8 @@ public abstract class SessionEventArgsBase : EventArgs, IDisposable /// /// Initializes a new instance of the class. /// - private SessionEventArgsBase(ProxyServer server, ProxyEndPoint endPoint, - CancellationTokenSource cancellationTokenSource) + private SessionEventArgsBase(ProxyServer server) { - BufferSize = server.BufferSize; BufferPool = server.BufferPool; ExceptionFunc = server.ExceptionFunc; TimeLine["Session Created"] = DateTime.Now; @@ -47,7 +46,7 @@ private SessionEventArgsBase(ProxyServer server, ProxyEndPoint endPoint, protected SessionEventArgsBase(ProxyServer server, ProxyEndPoint endPoint, CancellationTokenSource cancellationTokenSource, - Request request) : this(server, endPoint, cancellationTokenSource) + Request request) : this(server) { CancellationTokenSource = cancellationTokenSource; diff --git a/src/Titanium.Web.Proxy/ExplicitClientHandler.cs b/src/Titanium.Web.Proxy/ExplicitClientHandler.cs index 496b01f0f..540476753 100644 --- a/src/Titanium.Web.Proxy/ExplicitClientHandler.cs +++ b/src/Titanium.Web.Proxy/ExplicitClientHandler.cs @@ -35,8 +35,8 @@ private async Task handleClient(ExplicitProxyEndPoint endPoint, TcpClientConnect var cancellationTokenSource = new CancellationTokenSource(); var cancellationToken = cancellationTokenSource.Token; - var clientStream = new CustomBufferedStream(clientConnection.GetStream(), BufferPool, BufferSize); - var clientStreamWriter = new HttpResponseWriter(clientStream, BufferPool, BufferSize); + var clientStream = new CustomBufferedStream(clientConnection.GetStream(), BufferPool); + var clientStreamWriter = new HttpResponseWriter(clientStream, BufferPool); Task prefetchConnectionTask = null; bool closeServerConnection = false; @@ -50,7 +50,7 @@ private async Task handleClient(ExplicitProxyEndPoint endPoint, TcpClientConnect TunnelConnectSessionEventArgs connectArgs = null; // Client wants to create a secure tcp tunnel (probably its a HTTPS or Websocket request) - if (await HttpHelper.IsConnectMethod(clientStream, BufferPool, BufferSize, cancellationToken) == 1) + if (await HttpHelper.IsConnectMethod(clientStream, BufferPool, cancellationToken) == 1) { // read the first line HTTP command string httpCmd = await clientStream.ReadLineAsync(cancellationToken); @@ -75,6 +75,8 @@ private async Task handleClient(ExplicitProxyEndPoint endPoint, TcpClientConnect connectArgs = new TunnelConnectSessionEventArgs(this, endPoint, connectRequest, cancellationTokenSource); + clientStream.DataRead += (o, args) => connectArgs.OnDataSent(args.Buffer, args.Offset, args.Count); + clientStream.DataWrite += (o, args) => connectArgs.OnDataReceived(args.Buffer, args.Offset, args.Count); connectArgs.ProxyClient.Connection = clientConnection; connectArgs.ProxyClient.ClientStream = clientStream; @@ -213,8 +215,8 @@ await clientStreamWriter.WriteResponseAsync(connectArgs.HttpClient.Response, #endif // HTTPS server created - we can now decrypt the client's traffic - clientStream = new CustomBufferedStream(sslStream, BufferPool, BufferSize); - clientStreamWriter = new HttpResponseWriter(clientStream, BufferPool, BufferSize); + clientStream = new CustomBufferedStream(sslStream, BufferPool); + clientStreamWriter = new HttpResponseWriter(clientStream, BufferPool); } catch (Exception e) { @@ -223,7 +225,7 @@ await clientStreamWriter.WriteResponseAsync(connectArgs.HttpClient.Response, $"Couldn't authenticate host '{connectHostname}' with certificate '{certName}'.", e, connectArgs); } - if (await HttpHelper.IsConnectMethod(clientStream, BufferPool, BufferSize, cancellationToken) == -1) + if (await HttpHelper.IsConnectMethod(clientStream, BufferPool, cancellationToken) == -1) { decryptSsl = false; } @@ -263,7 +265,7 @@ await clientStreamWriter.WriteResponseAsync(connectArgs.HttpClient.Response, if (available > 0) { // send the buffered data - var data = BufferPool.GetBuffer(BufferSize); + var data = BufferPool.GetBuffer(); try { @@ -283,10 +285,8 @@ await clientStreamWriter.WriteResponseAsync(connectArgs.HttpClient.Response, if (!clientStream.IsClosed && !connection.Stream.IsClosed) { - await TcpHelper.SendRaw(clientStream, connection.Stream, BufferPool, BufferSize, - (buffer, offset, count) => { connectArgs.OnDataSent(buffer, offset, count); }, - (buffer, offset, count) => { connectArgs.OnDataReceived(buffer, offset, count); }, - connectArgs.CancellationTokenSource, ExceptionFunc); + await TcpHelper.SendRaw(clientStream, connection.Stream, BufferPool, + null, null, connectArgs.CancellationTokenSource, ExceptionFunc); } } finally @@ -298,7 +298,7 @@ await TcpHelper.SendRaw(clientStream, connection.Stream, BufferPool, BufferSize, } } - if (connectArgs != null && await HttpHelper.IsPriMethod(clientStream, BufferPool, BufferSize, cancellationToken) == 1) + if (connectArgs != null && await HttpHelper.IsPriMethod(clientStream, BufferPool, cancellationToken) == 1) { // todo string httpCmd = await clientStream.ReadLineAsync(cancellationToken); @@ -335,7 +335,7 @@ await TcpHelper.SendRaw(clientStream, connection.Stream, BufferPool, BufferSize, await connection.StreamWriter.WriteLineAsync("SM", cancellationToken); await connection.StreamWriter.WriteLineAsync(cancellationToken); #if NETCOREAPP2_1 - await Http2Helper.SendHttp2(clientStream, connection.Stream, BufferSize, + await Http2Helper.SendHttp2(clientStream, connection.Stream, BufferPool.BufferSize, (buffer, offset, count) => { connectArgs.OnDataSent(buffer, offset, count); }, (buffer, offset, count) => { connectArgs.OnDataReceived(buffer, offset, count); }, () => new SessionEventArgs(this, endPoint, cancellationTokenSource) @@ -357,6 +357,7 @@ await Http2Helper.SendHttp2(clientStream, connection.Stream, BufferSize, } calledRequestHandler = true; + // Now create the request await handleHttpSessionRequest(endPoint, clientConnection, clientStream, clientStreamWriter, cancellationTokenSource, connectHostname, connectArgs, prefetchConnectionTask); diff --git a/src/Titanium.Web.Proxy/Extensions/StreamExtensions.cs b/src/Titanium.Web.Proxy/Extensions/StreamExtensions.cs index c4d648e52..d59de9bc8 100644 --- a/src/Titanium.Web.Proxy/Extensions/StreamExtensions.cs +++ b/src/Titanium.Web.Proxy/Extensions/StreamExtensions.cs @@ -18,11 +18,10 @@ internal static class StreamExtensions /// /// /// - /// internal static Task CopyToAsync(this Stream input, Stream output, Action onCopy, - IBufferPool bufferPool, int bufferSize) + IBufferPool bufferPool) { - return CopyToAsync(input, output, onCopy, bufferPool, bufferSize, CancellationToken.None); + return CopyToAsync(input, output, onCopy, bufferPool, CancellationToken.None); } /// @@ -32,12 +31,11 @@ internal static Task CopyToAsync(this Stream input, Stream output, Action /// /// - /// /// internal static async Task CopyToAsync(this Stream input, Stream output, Action onCopy, - IBufferPool bufferPool, int bufferSize, CancellationToken cancellationToken) + IBufferPool bufferPool, CancellationToken cancellationToken) { - var buffer = bufferPool.GetBuffer(bufferSize); + var buffer = bufferPool.GetBuffer(); try { while (!cancellationToken.IsCancellationRequested) diff --git a/src/Titanium.Web.Proxy/Extensions/UriExtensions.cs b/src/Titanium.Web.Proxy/Extensions/UriExtensions.cs index 5003c622f..d0de6fd1c 100644 --- a/src/Titanium.Web.Proxy/Extensions/UriExtensions.cs +++ b/src/Titanium.Web.Proxy/Extensions/UriExtensions.cs @@ -12,5 +12,5 @@ internal static string GetOriginalPathAndQuery(this Uri uri) return uri.IsWellFormedOriginalString() ? uri.PathAndQuery : uri.GetComponents(UriComponents.PathAndQuery, UriFormat.Unescaped); } - } + } } diff --git a/src/Titanium.Web.Proxy/Helpers/HttpHelper.cs b/src/Titanium.Web.Proxy/Helpers/HttpHelper.cs index f9751f752..2ddd6f6fc 100644 --- a/src/Titanium.Web.Proxy/Helpers/HttpHelper.cs +++ b/src/Titanium.Web.Proxy/Helpers/HttpHelper.cs @@ -128,39 +128,35 @@ internal static string GetWildCardDomainName(string hostname) /// /// Determines whether is connect method. /// - /// The client stream reader. /// 1: when CONNECT, 0: when valid HTTP method, -1: otherwise - internal static Task IsConnectMethod(ICustomStreamReader clientStreamReader, IBufferPool bufferPool, int bufferSize, CancellationToken cancellationToken = default) + internal static Task IsConnectMethod(ICustomStreamReader clientStreamReader, IBufferPool bufferPool, CancellationToken cancellationToken = default) { - return startsWith(clientStreamReader, bufferPool, bufferSize, "CONNECT", cancellationToken); + return startsWith(clientStreamReader, bufferPool, "CONNECT", cancellationToken); } /// /// Determines whether is pri method (HTTP/2). /// - /// The client stream reader. /// 1: when PRI, 0: when valid HTTP method, -1: otherwise - internal static Task IsPriMethod(ICustomStreamReader clientStreamReader, IBufferPool bufferPool, int bufferSize, CancellationToken cancellationToken = default) + internal static Task IsPriMethod(ICustomStreamReader clientStreamReader, IBufferPool bufferPool, CancellationToken cancellationToken = default) { - return startsWith(clientStreamReader, bufferPool, bufferSize, "PRI", cancellationToken); + return startsWith(clientStreamReader, bufferPool, "PRI", cancellationToken); } /// /// Determines whether the stream starts with the given string. /// - /// The client stream reader. - /// The expected start. /// /// 1: when starts with the given string, 0: when valid HTTP method, -1: otherwise /// - private static async Task startsWith(ICustomStreamReader clientStreamReader, IBufferPool bufferPool, int bufferSize, string expectedStart, CancellationToken cancellationToken = default) + private static async Task startsWith(ICustomStreamReader clientStreamReader, IBufferPool bufferPool, string expectedStart, CancellationToken cancellationToken = default) { int iRet = -1; const int lengthToCheck = 10; byte[] buffer = null; try { - buffer = bufferPool.GetBuffer(Math.Max(bufferSize, lengthToCheck)); + buffer = bufferPool.GetBuffer(Math.Max(bufferPool.BufferSize, lengthToCheck)); int peeked = await clientStreamReader.PeekBytesAsync(buffer, 0, 0, lengthToCheck, cancellationToken); diff --git a/src/Titanium.Web.Proxy/Helpers/HttpRequestWriter.cs b/src/Titanium.Web.Proxy/Helpers/HttpRequestWriter.cs index 00d1e0ea0..4de14c970 100644 --- a/src/Titanium.Web.Proxy/Helpers/HttpRequestWriter.cs +++ b/src/Titanium.Web.Proxy/Helpers/HttpRequestWriter.cs @@ -8,8 +8,8 @@ namespace Titanium.Web.Proxy.Helpers { internal sealed class HttpRequestWriter : HttpWriter { - internal HttpRequestWriter(Stream stream, IBufferPool bufferPool, int bufferSize) - : base(stream, bufferPool, bufferSize) + internal HttpRequestWriter(Stream stream, IBufferPool bufferPool) + : base(stream, bufferPool) { } diff --git a/src/Titanium.Web.Proxy/Helpers/HttpResponseWriter.cs b/src/Titanium.Web.Proxy/Helpers/HttpResponseWriter.cs index b971cdd28..5d0f36e13 100644 --- a/src/Titanium.Web.Proxy/Helpers/HttpResponseWriter.cs +++ b/src/Titanium.Web.Proxy/Helpers/HttpResponseWriter.cs @@ -9,8 +9,8 @@ namespace Titanium.Web.Proxy.Helpers { internal sealed class HttpResponseWriter : HttpWriter { - internal HttpResponseWriter(Stream stream, IBufferPool bufferPool, int bufferSize) - : base(stream, bufferPool, bufferSize) + internal HttpResponseWriter(Stream stream, IBufferPool bufferPool) + : base(stream, bufferPool) { } diff --git a/src/Titanium.Web.Proxy/Helpers/HttpWriter.cs b/src/Titanium.Web.Proxy/Helpers/HttpWriter.cs index bf39f8052..9f14c10dd 100644 --- a/src/Titanium.Web.Proxy/Helpers/HttpWriter.cs +++ b/src/Titanium.Web.Proxy/Helpers/HttpWriter.cs @@ -20,15 +20,12 @@ internal class HttpWriter : ICustomStreamWriter private static readonly Encoding encoder = Encoding.ASCII; - internal HttpWriter(Stream stream, IBufferPool bufferPool, int bufferSize) + internal HttpWriter(Stream stream, IBufferPool bufferPool) { - BufferSize = bufferSize; this.stream = stream; this.bufferPool = bufferPool; } - internal int BufferSize { get; } - /// /// Writes a line async /// @@ -48,9 +45,9 @@ private async Task writeAsyncInternal(string value, bool addNewLine, Cancellatio { int newLineChars = addNewLine ? newLine.Length : 0; int charCount = value.Length; - if (charCount < BufferSize - newLineChars) + if (charCount < bufferPool.BufferSize - newLineChars) { - var buffer = bufferPool.GetBuffer(BufferSize); + var buffer = bufferPool.GetBuffer(); try { int idx = encoder.GetBytes(value, 0, charCount, buffer, 0); @@ -246,7 +243,7 @@ private async Task copyBodyChunkedAsync(ICustomStreamReader reader, Action onCopy, CancellationToken cancellationToken) { - var buffer = bufferPool.GetBuffer(BufferSize); + var buffer = bufferPool.GetBuffer(); try { diff --git a/src/Titanium.Web.Proxy/Helpers/TcpHelper.cs b/src/Titanium.Web.Proxy/Helpers/TcpHelper.cs index eaa3f6fe4..e6ef47fbb 100644 --- a/src/Titanium.Web.Proxy/Helpers/TcpHelper.cs +++ b/src/Titanium.Web.Proxy/Helpers/TcpHelper.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Net.Sockets; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; @@ -8,38 +9,32 @@ namespace Titanium.Web.Proxy.Helpers { - internal enum IpVersion - { - Ipv4 = 1, - Ipv6 = 2 - } - internal class TcpHelper { /// /// Gets the process id by local port number. /// /// Process id. - internal static unsafe int GetProcessIdByLocalPort(IpVersion ipVersion, int localPort) + internal static unsafe int GetProcessIdByLocalPort(AddressFamily addressFamily, int localPort) { var tcpTable = IntPtr.Zero; int tcpTableLength = 0; - int ipVersionValue = ipVersion == IpVersion.Ipv4 ? NativeMethods.AfInet : NativeMethods.AfInet6; + int addressFamilyValue = addressFamily == AddressFamily.InterNetwork ? NativeMethods.AfInet : NativeMethods.AfInet6; const int allPid = (int)NativeMethods.TcpTableType.OwnerPidAll; - if (NativeMethods.GetExtendedTcpTable(tcpTable, ref tcpTableLength, false, ipVersionValue, allPid, 0) != 0) + if (NativeMethods.GetExtendedTcpTable(tcpTable, ref tcpTableLength, false, addressFamilyValue, allPid, 0) != 0) { try { tcpTable = Marshal.AllocHGlobal(tcpTableLength); - if (NativeMethods.GetExtendedTcpTable(tcpTable, ref tcpTableLength, true, ipVersionValue, allPid, + if (NativeMethods.GetExtendedTcpTable(tcpTable, ref tcpTableLength, true, addressFamilyValue, allPid, 0) == 0) { int rowCount = *(int*)tcpTable; uint portInNetworkByteOrder = toNetworkByteOrder((uint)localPort); - if (ipVersion == IpVersion.Ipv4) + if (addressFamily == AddressFamily.InterNetwork) { var rowPtr = (NativeMethods.TcpRow*)(tcpTable + 4); @@ -102,23 +97,21 @@ private static uint toNetworkByteOrder(uint port) /// /// /// - /// /// /// /// /// /// - private static async Task sendRawTap(Stream clientStream, Stream serverStream, - IBufferPool bufferPool, int bufferSize, + private static async Task sendRawTap(Stream clientStream, Stream serverStream, IBufferPool bufferPool, Action onDataSend, Action onDataReceive, CancellationTokenSource cancellationTokenSource, ExceptionHandler exceptionFunc) { // Now async relay all server=>client & client=>server data var sendRelay = - clientStream.CopyToAsync(serverStream, onDataSend, bufferPool, bufferSize, cancellationTokenSource.Token); + clientStream.CopyToAsync(serverStream, onDataSend, bufferPool, cancellationTokenSource.Token); var receiveRelay = - serverStream.CopyToAsync(clientStream, onDataReceive, bufferPool, bufferSize, cancellationTokenSource.Token); + serverStream.CopyToAsync(clientStream, onDataReceive, bufferPool, cancellationTokenSource.Token); await Task.WhenAny(sendRelay, receiveRelay); cancellationTokenSource.Cancel(); @@ -134,20 +127,18 @@ private static async Task sendRawTap(Stream clientStream, Stream serverStream, /// /// /// - /// /// /// /// /// /// - internal static Task SendRaw(Stream clientStream, Stream serverStream, - IBufferPool bufferPool, int bufferSize, + internal static Task SendRaw(Stream clientStream, Stream serverStream, IBufferPool bufferPool, Action onDataSend, Action onDataReceive, CancellationTokenSource cancellationTokenSource, ExceptionHandler exceptionFunc) { // todo: fix APM mode - return sendRawTap(clientStream, serverStream, bufferPool, bufferSize, onDataSend, onDataReceive, + return sendRawTap(clientStream, serverStream, bufferPool, onDataSend, onDataReceive, cancellationTokenSource, exceptionFunc); } diff --git a/src/Titanium.Web.Proxy/Models/ProxyEndPoint.cs b/src/Titanium.Web.Proxy/Models/ProxyEndPoint.cs index 9247a4ed4..6905e296c 100644 --- a/src/Titanium.Web.Proxy/Models/ProxyEndPoint.cs +++ b/src/Titanium.Web.Proxy/Models/ProxyEndPoint.cs @@ -42,14 +42,6 @@ protected ProxyEndPoint(IPAddress ipAddress, int port, bool decryptSsl) /// public bool DecryptSsl { get; } - /// - /// Is IPv6 enabled? - /// - public bool IpV6Enabled => Equals(IpAddress, IPAddress.IPv6Any) - || Equals(IpAddress, IPAddress.IPv6Loopback) - || Equals(IpAddress, IPAddress.IPv6None); - - /// /// Generic certificate to use for SSL decryption. /// diff --git a/src/Titanium.Web.Proxy/Network/DebugCustomBufferedStream.cs b/src/Titanium.Web.Proxy/Network/DebugCustomBufferedStream.cs index d1de89d5e..a49894dc9 100644 --- a/src/Titanium.Web.Proxy/Network/DebugCustomBufferedStream.cs +++ b/src/Titanium.Web.Proxy/Network/DebugCustomBufferedStream.cs @@ -19,8 +19,8 @@ internal class DebugCustomBufferedStream : CustomBufferedStream private readonly FileStream fileStreamSent; - public DebugCustomBufferedStream(Guid connectionId, string type, Stream baseStream, IBufferPool bufferPool, int bufferSize, bool leaveOpen = false) - : base(baseStream, bufferPool, bufferSize, leaveOpen) + public DebugCustomBufferedStream(Guid connectionId, string type, Stream baseStream, IBufferPool bufferPool, bool leaveOpen = false) + : base(baseStream, bufferPool, leaveOpen) { Counter = Interlocked.Increment(ref counter); fileStreamSent = new FileStream(Path.Combine(basePath, $"{connectionId}_{type}_{Counter}_sent.dat"), FileMode.Create); diff --git a/src/Titanium.Web.Proxy/Network/Tcp/TcpClientConnection.cs b/src/Titanium.Web.Proxy/Network/Tcp/TcpClientConnection.cs index 89af0d661..4e0eece06 100644 --- a/src/Titanium.Web.Proxy/Network/Tcp/TcpClientConnection.cs +++ b/src/Titanium.Web.Proxy/Network/Tcp/TcpClientConnection.cs @@ -60,8 +60,7 @@ public int GetProcessId(ProxyEndPoint endPoint) // If client is localhost get the process id if (NetworkHelper.IsLocalIpAddress(remoteEndPoint.Address)) { - var ipVersion = endPoint.IpV6Enabled ? IpVersion.Ipv6 : IpVersion.Ipv4; - processId = TcpHelper.GetProcessIdByLocalPort(ipVersion, remoteEndPoint.Port); + processId = TcpHelper.GetProcessIdByLocalPort(endPoint.IpAddress.AddressFamily, remoteEndPoint.Port); } else { diff --git a/src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs b/src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs index 1548164c2..1146a66c8 100644 --- a/src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs +++ b/src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs @@ -76,8 +76,9 @@ internal string GetConnectionCacheKey(string remoteHostName, int remotePort, /// /// Gets the connection cache key. /// + /// The server. /// The session event arguments. - /// + /// The application protocol. /// internal async Task GetConnectionCacheKey(ProxyServer server, SessionEventArgsBase session, SslApplicationProtocol applicationProtocol) @@ -340,11 +341,11 @@ private async Task createServerConnection(string remoteHost await proxyServer.InvokeConnectionCreateEvent(tcpClient, false); - stream = new CustomBufferedStream(tcpClient.GetStream(), proxyServer.BufferPool, proxyServer.BufferSize); + stream = new CustomBufferedStream(tcpClient.GetStream(), proxyServer.BufferPool); if (useUpstreamProxy && (isConnect || isHttps)) { - var writer = new HttpRequestWriter(stream, proxyServer.BufferPool, proxyServer.BufferSize); + var writer = new HttpRequestWriter(stream, proxyServer.BufferPool); var connectRequest = new ConnectRequest { OriginalUrl = $"{remoteHostName}:{remotePort}", @@ -379,7 +380,7 @@ private async Task createServerConnection(string remoteHost { var sslStream = new SslStream(stream, false, proxyServer.ValidateServerCertificate, proxyServer.SelectClientCertificate); - stream = new CustomBufferedStream(sslStream, proxyServer.BufferPool, proxyServer.BufferSize); + stream = new CustomBufferedStream(sslStream, proxyServer.BufferPool); var options = new SslClientAuthenticationOptions { @@ -423,7 +424,7 @@ private async Task createServerConnection(string remoteHost IsHttps = isHttps, NegotiatedApplicationProtocol = negotiatedApplicationProtocol, UseUpstreamProxy = useUpstreamProxy, - StreamWriter = new HttpRequestWriter(stream, proxyServer.BufferPool, proxyServer.BufferSize), + StreamWriter = new HttpRequestWriter(stream, proxyServer.BufferPool), Stream = stream, Version = httpVersion }; diff --git a/src/Titanium.Web.Proxy/ProxyAuthorizationHandler.cs b/src/Titanium.Web.Proxy/ProxyAuthorizationHandler.cs index eda4602f8..4fee9f838 100644 --- a/src/Titanium.Web.Proxy/ProxyAuthorizationHandler.cs +++ b/src/Titanium.Web.Proxy/ProxyAuthorizationHandler.cs @@ -111,6 +111,7 @@ private async Task authenticateUserBasic(SessionEventArgsBase session, str /// Create an authentication required response. /// /// Response description. + /// The continuation. /// private Response createAuthentication407Response(string description, string continuation = null) { diff --git a/src/Titanium.Web.Proxy/ProxyServer.cs b/src/Titanium.Web.Proxy/ProxyServer.cs index 26148e835..e67ccd145 100644 --- a/src/Titanium.Web.Proxy/ProxyServer.cs +++ b/src/Titanium.Web.Proxy/ProxyServer.cs @@ -95,12 +95,7 @@ public ProxyServer(string rootCertificateName, string rootCertificateIssuerName, bool userTrustRootCertificate = true, bool machineTrustRootCertificate = false, bool trustRootCertificateAsAdmin = false) { - - if (BufferPool == null) - { - BufferPool = new DefaultBufferPool(); - } - + BufferPool = new DefaultBufferPool(); ProxyEndPoints = new List(); tcpConnectionFactory = new TcpConnectionFactory(this); if (RunTime.IsWindows && !RunTime.IsUwpOnWindows) @@ -190,12 +185,6 @@ public ProxyServer(string rootCertificateName, string rootCertificateIssuerName, /// public bool NoDelay { get; set; } = true; - /// - /// Buffer size in bytes used throughout this proxy. - /// Default value is 8192 bytes. - /// - public int BufferSize { get; set; } = 8192; - /// /// Seconds client/server connection are to be kept alive when waiting for read/write to complete. /// This will also determine the pool eviction time when connection pool is enabled. diff --git a/src/Titanium.Web.Proxy/StreamExtended/BufferPool/DefaultBufferPool.cs b/src/Titanium.Web.Proxy/StreamExtended/BufferPool/DefaultBufferPool.cs index e3fbb507c..70eaffed6 100644 --- a/src/Titanium.Web.Proxy/StreamExtended/BufferPool/DefaultBufferPool.cs +++ b/src/Titanium.Web.Proxy/StreamExtended/BufferPool/DefaultBufferPool.cs @@ -9,8 +9,23 @@ namespace Titanium.Web.Proxy.StreamExtended.BufferPool /// Works well when all consumers ask for buffers with the same size. /// If your application would use variable size buffers consider implementing IBufferPool using System.Buffers library from Microsoft. /// - public class DefaultBufferPool : IBufferPool + internal class DefaultBufferPool : IBufferPool { + /// + /// Buffer size in bytes used throughout this proxy. + /// Default value is 8192 bytes. + /// + public int BufferSize { get; set; } = 8192; + + /// + /// Gets a buffer with a default size. + /// + /// + public byte[] GetBuffer() + { + return ArrayPool.Shared.Rent(BufferSize); + } + /// /// Gets a buffer. /// diff --git a/src/Titanium.Web.Proxy/StreamExtended/BufferPool/IBufferPool.cs b/src/Titanium.Web.Proxy/StreamExtended/BufferPool/IBufferPool.cs index 22ebed7e0..d6fe714b9 100644 --- a/src/Titanium.Web.Proxy/StreamExtended/BufferPool/IBufferPool.cs +++ b/src/Titanium.Web.Proxy/StreamExtended/BufferPool/IBufferPool.cs @@ -8,6 +8,10 @@ namespace Titanium.Web.Proxy.StreamExtended.BufferPool /// public interface IBufferPool : IDisposable { + int BufferSize { get; } + + byte[] GetBuffer(); + byte[] GetBuffer(int bufferSize); void ReturnBuffer(byte[] buffer); diff --git a/src/Titanium.Web.Proxy/StreamExtended/Network/CopyStream.cs b/src/Titanium.Web.Proxy/StreamExtended/Network/CopyStream.cs index 025509014..b9566e439 100644 --- a/src/Titanium.Web.Proxy/StreamExtended/Network/CopyStream.cs +++ b/src/Titanium.Web.Proxy/StreamExtended/Network/CopyStream.cs @@ -17,8 +17,6 @@ public class CopyStream : ICustomStreamReader, IDisposable private readonly IBufferPool bufferPool; - public int BufferSize { get; } - private int bufferLength; private byte[] buffer; @@ -31,12 +29,11 @@ public class CopyStream : ICustomStreamReader, IDisposable public long ReadBytes { get; private set; } - public CopyStream(ICustomStreamReader reader, ICustomStreamWriter writer, IBufferPool bufferPool, int bufferSize) + public CopyStream(ICustomStreamReader reader, ICustomStreamWriter writer, IBufferPool bufferPool) { this.reader = reader; this.writer = writer; - BufferSize = bufferSize; - buffer = bufferPool.GetBuffer(bufferSize); + buffer = bufferPool.GetBuffer(); this.bufferPool = bufferPool; } @@ -94,7 +91,7 @@ public int Read(byte[] buffer, int offset, int count) int result = reader.Read(buffer, offset, count); if (result > 0) { - if (bufferLength + result > BufferSize) + if (bufferLength + result > bufferPool.BufferSize) { Flush(); } @@ -113,7 +110,7 @@ public async Task ReadAsync(byte[] buffer, int offset, int count, Cancellat int result = await reader.ReadAsync(buffer, offset, count, cancellationToken); if (result > 0) { - if (bufferLength + result > BufferSize) + if (bufferLength + result > bufferPool.BufferSize) { await FlushAsync(cancellationToken); } diff --git a/src/Titanium.Web.Proxy/StreamExtended/Network/CustomBufferedPeekStream.cs b/src/Titanium.Web.Proxy/StreamExtended/Network/CustomBufferedPeekStream.cs index 08064afe7..e27ac8034 100644 --- a/src/Titanium.Web.Proxy/StreamExtended/Network/CustomBufferedPeekStream.cs +++ b/src/Titanium.Web.Proxy/StreamExtended/Network/CustomBufferedPeekStream.cs @@ -18,8 +18,6 @@ internal CustomBufferedPeekStream(ICustomStreamReader baseStream, IBufferPool bu Position = startPosition; } - int ICustomStreamReader.BufferSize => baseStream.BufferSize; - /// /// Gets a value indicating whether data is available. /// @@ -92,11 +90,12 @@ byte ICustomStreamReader.PeekByteFromBuffer(int index) /// The buffer to copy. /// The offset where copying. /// The index. + /// The count. /// The cancellation token. /// - Task ICustomStreamReader.PeekBytesAsync(byte[] buffer, int offset, int index, int size, CancellationToken cancellationToken) + Task ICustomStreamReader.PeekBytesAsync(byte[] buffer, int offset, int index, int count, CancellationToken cancellationToken) { - return baseStream.PeekBytesAsync(buffer, offset, index, size, cancellationToken); + return baseStream.PeekBytesAsync(buffer, offset, index, count, cancellationToken); } /// @@ -114,7 +113,6 @@ Task ICustomStreamReader.PeekByteAsync(int index, CancellationToken cancell /// Reads a byte from buffer. /// /// - /// Buffer is empty byte ICustomStreamReader.ReadByteFromBuffer() { return ReadByte(); diff --git a/src/Titanium.Web.Proxy/StreamExtended/Network/CustomBufferedStream.cs b/src/Titanium.Web.Proxy/StreamExtended/Network/CustomBufferedStream.cs index 32e6e8879..fedbd25fd 100644 --- a/src/Titanium.Web.Proxy/StreamExtended/Network/CustomBufferedStream.cs +++ b/src/Titanium.Web.Proxy/StreamExtended/Network/CustomBufferedStream.cs @@ -15,7 +15,7 @@ namespace Titanium.Web.Proxy.StreamExtended.Network /// of UTF-8 encoded string or raw bytes asynchronously from last read position. /// /// - public class CustomBufferedStream : Stream, ICustomStreamReader + internal class CustomBufferedStream : Stream, ICustomStreamReader { private readonly bool leaveOpen; private byte[] streamBuffer; @@ -35,8 +35,6 @@ public class CustomBufferedStream : Stream, ICustomStreamReader private readonly IBufferPool bufferPool; - public int BufferSize { get; } - public event EventHandler DataRead; public event EventHandler DataWrite; @@ -68,14 +66,12 @@ static CustomBufferedStream() /// /// The base stream. /// Bufferpool. - /// Size of the buffer. /// to leave the stream open after disposing the object; otherwise, . - public CustomBufferedStream(Stream baseStream, IBufferPool bufferPool, int bufferSize, bool leaveOpen = false) + public CustomBufferedStream(Stream baseStream, IBufferPool bufferPool, bool leaveOpen = false) { BaseStream = baseStream; - BufferSize = bufferSize; this.leaveOpen = leaveOpen; - streamBuffer = bufferPool.GetBuffer(bufferSize); + streamBuffer = bufferPool.GetBuffer(); this.bufferPool = bufferPool; } @@ -278,9 +274,10 @@ public async Task PeekByteAsync(int index, CancellationToken cancellationTo /// The buffer to copy. /// The offset where copying. /// The index. + /// The count. /// The cancellation token. /// - public async Task PeekBytesAsync(byte[] buffer, int offset, int index, int size, CancellationToken cancellationToken = default) + public async Task PeekBytesAsync(byte[] buffer, int offset, int index, int count, CancellationToken cancellationToken = default) { if (Available <= index) { @@ -288,19 +285,19 @@ public async Task PeekBytesAsync(byte[] buffer, int offset, int index, int } // When index is greater than the buffer size - if (streamBuffer.Length <= (index + size)) + if (streamBuffer.Length <= (index + count)) { throw new Exception("Requested Peek index and size exceeds the buffer size. Consider increasing the buffer size."); } - if (Available <= (index + size)) + if (Available <= (index + count)) { return -1; } - Buffer.BlockCopy(streamBuffer, index, buffer, offset, size); + Buffer.BlockCopy(streamBuffer, index, buffer, offset, count); - return size; + return count; } /// @@ -359,7 +356,7 @@ public override async Task WriteAsync(byte[] buffer, int offset, int count, Canc /// The byte to write to the stream. public override void WriteByte(byte value) { - var buffer = bufferPool.GetBuffer(BufferSize); + var buffer = bufferPool.GetBuffer(); try { buffer[0] = value; @@ -576,7 +573,7 @@ internal static async Task ReadLineInternalAsync(ICustomStreamReader rea int bufferDataLength = 0; // try to use buffer from the buffer pool, usually it is enough - var bufferPoolBuffer = bufferPool.GetBuffer(reader.BufferSize); + var bufferPoolBuffer = bufferPool.GetBuffer(); var buffer = bufferPoolBuffer; try diff --git a/src/Titanium.Web.Proxy/StreamExtended/Network/ICustomStreamReader.cs b/src/Titanium.Web.Proxy/StreamExtended/Network/ICustomStreamReader.cs index bf3543d8b..756650cd1 100644 --- a/src/Titanium.Web.Proxy/StreamExtended/Network/ICustomStreamReader.cs +++ b/src/Titanium.Web.Proxy/StreamExtended/Network/ICustomStreamReader.cs @@ -9,8 +9,6 @@ namespace Titanium.Web.Proxy.StreamExtended.Network /// public interface ICustomStreamReader { - int BufferSize { get; } - int Available { get; } bool DataAvailable { get; } @@ -43,9 +41,10 @@ public interface ICustomStreamReader /// The buffer to copy. /// The offset where copying. /// The index. + /// The count. /// The cancellation token. /// - Task PeekBytesAsync(byte[] buffer, int offset, int index, int size, CancellationToken cancellationToken = default); + Task PeekBytesAsync(byte[] buffer, int offset, int index, int count, CancellationToken cancellationToken = default); byte ReadByteFromBuffer(); diff --git a/src/Titanium.Web.Proxy/StreamExtended/Network/TaskResult.cs b/src/Titanium.Web.Proxy/StreamExtended/Network/TaskResult.cs index 42553c2d3..1d443c102 100644 --- a/src/Titanium.Web.Proxy/StreamExtended/Network/TaskResult.cs +++ b/src/Titanium.Web.Proxy/StreamExtended/Network/TaskResult.cs @@ -7,7 +7,6 @@ namespace Titanium.Web.Proxy.StreamExtended.Network /// /// Mimic a Task but you can set AsyncState /// - /// public class TaskResult : IAsyncResult { Task Task; @@ -31,7 +30,7 @@ public TaskResult(Task pTask, object state) } /// - /// Mimic a Task but you can set AsyncState + /// Mimic a Task<T> but you can set AsyncState /// /// public class TaskResult : IAsyncResult diff --git a/src/Titanium.Web.Proxy/StreamExtended/SslTools.cs b/src/Titanium.Web.Proxy/StreamExtended/SslTools.cs index 5b6b87167..cc8dd8c14 100644 --- a/src/Titanium.Web.Proxy/StreamExtended/SslTools.cs +++ b/src/Titanium.Web.Proxy/StreamExtended/SslTools.cs @@ -10,7 +10,7 @@ namespace Titanium.Web.Proxy.StreamExtended /// /// Use this class to peek SSL client/server hello information. /// - public class SslTools + internal class SslTools { /// /// Is the given stream starts with an SSL client hello? diff --git a/src/Titanium.Web.Proxy/TransparentClientHandler.cs b/src/Titanium.Web.Proxy/TransparentClientHandler.cs index 9af6814fe..edcfa31cd 100644 --- a/src/Titanium.Web.Proxy/TransparentClientHandler.cs +++ b/src/Titanium.Web.Proxy/TransparentClientHandler.cs @@ -32,8 +32,8 @@ private async Task handleClient(TransparentProxyEndPoint endPoint, TcpClientConn var cancellationTokenSource = new CancellationTokenSource(); var cancellationToken = cancellationTokenSource.Token; - var clientStream = new CustomBufferedStream(clientConnection.GetStream(), BufferPool, BufferSize); - var clientStreamWriter = new HttpResponseWriter(clientStream, BufferPool, BufferSize); + var clientStream = new CustomBufferedStream(clientConnection.GetStream(), BufferPool); + var clientStreamWriter = new HttpResponseWriter(clientStream, BufferPool); SslStream sslStream = null; @@ -78,9 +78,9 @@ private async Task handleClient(TransparentProxyEndPoint endPoint, TcpClientConn await sslStream.AuthenticateAsServerAsync(certificate, false, SslProtocols.Tls, false); // HTTPS server created - we can now decrypt the client's traffic - clientStream = new CustomBufferedStream(sslStream, BufferPool, BufferSize); + clientStream = new CustomBufferedStream(sslStream, BufferPool); - clientStreamWriter = new HttpResponseWriter(clientStream, BufferPool, BufferSize); + clientStreamWriter = new HttpResponseWriter(clientStream, BufferPool); } catch (Exception e) { @@ -109,7 +109,7 @@ private async Task handleClient(TransparentProxyEndPoint endPoint, TcpClientConn if (available > 0) { // send the buffered data - var data = BufferPool.GetBuffer(BufferSize); + var data = BufferPool.GetBuffer(); try { // clientStream.Available should be at most BufferSize because it is using the same buffer size @@ -124,7 +124,7 @@ private async Task handleClient(TransparentProxyEndPoint endPoint, TcpClientConn if (!clientStream.IsClosed && !connection.Stream.IsClosed) { - await TcpHelper.SendRaw(clientStream, connection.Stream, BufferPool, BufferSize, + await TcpHelper.SendRaw(clientStream, connection.Stream, BufferPool, null, null, cancellationTokenSource, ExceptionFunc); } } diff --git a/src/Titanium.Web.Proxy/WebSocketHandler.cs b/src/Titanium.Web.Proxy/WebSocketHandler.cs index 480b7c573..4db29d790 100644 --- a/src/Titanium.Web.Proxy/WebSocketHandler.cs +++ b/src/Titanium.Web.Proxy/WebSocketHandler.cs @@ -63,10 +63,8 @@ await clientStreamWriter.WriteResponseAsync(response, await invokeBeforeResponse(args); } - await TcpHelper.SendRaw(clientStream, serverConnection.Stream, BufferPool, BufferSize, - (buffer, offset, count) => { args.OnDataSent(buffer, offset, count); }, - (buffer, offset, count) => { args.OnDataReceived(buffer, offset, count); }, - cancellationTokenSource, ExceptionFunc); + await TcpHelper.SendRaw(clientStream, serverConnection.Stream, BufferPool, + args.OnDataSent, args.OnDataReceived, cancellationTokenSource, ExceptionFunc); } } } From 01f82f07cebcb10e7478e88e505f8b4a858462d5 Mon Sep 17 00:00:00 2001 From: buildbot121 Date: Sat, 31 Aug 2019 17:06:04 +0000 Subject: [PATCH 2/2] API documentation update by build server --- ...Proxy.EventArguments.SessionEventArgs.html | 35 +++-- ...y.EventArguments.SessionEventArgsBase.html | 63 +++----- ...guments.TunnelConnectSessionEventArgs.html | 3 - ...eb.Proxy.Models.ExplicitProxyEndPoint.html | 3 - ...tanium.Web.Proxy.Models.ProxyEndPoint.html | 33 +---- ...Proxy.Models.TransparentProxyEndPoint.html | 3 - docs/api/Titanium.Web.Proxy.ProxyServer.html | 134 +++++++----------- docs/index.json | 14 +- docs/xrefmap.yml | 32 ----- 9 files changed, 92 insertions(+), 228 deletions(-) diff --git a/docs/api/Titanium.Web.Proxy.EventArguments.SessionEventArgs.html b/docs/api/Titanium.Web.Proxy.EventArguments.SessionEventArgs.html index 15837346a..6f25c1bd9 100644 --- a/docs/api/Titanium.Web.Proxy.EventArguments.SessionEventArgs.html +++ b/docs/api/Titanium.Web.Proxy.EventArguments.SessionEventArgs.html @@ -102,9 +102,6 @@
Implements
Inherited Members
- @@ -301,7 +298,7 @@

Methods Improve this Doc - View Source + View Source

Dispose()

@@ -319,7 +316,7 @@
Overrides
Improve this Doc - View Source + View Source

GenericResponse(Byte[], HttpStatusCode, Dictionary<String, HttpHeader>, Boolean)

@@ -372,7 +369,7 @@
Parameters
Improve this Doc - View Source + View Source

GenericResponse(String, HttpStatusCode, Dictionary<String, HttpHeader>, Boolean)

@@ -426,7 +423,7 @@
Parameters
Improve this Doc - View Source + View Source

GetRequestBody(CancellationToken)

@@ -476,7 +473,7 @@
Returns
Improve this Doc - View Source + View Source

GetRequestBodyAsString(CancellationToken)

@@ -526,7 +523,7 @@
Returns
Improve this Doc - View Source + View Source

GetResponseBody(CancellationToken)

@@ -576,7 +573,7 @@
Returns
Improve this Doc - View Source + View Source

GetResponseBodyAsString(CancellationToken)

@@ -626,7 +623,7 @@
Returns
Improve this Doc - View Source + View Source

Ok(Byte[], Dictionary<String, HttpHeader>, Boolean)

@@ -673,7 +670,7 @@
Parameters
Improve this Doc - View Source + View Source

Ok(String, Dictionary<String, HttpHeader>, Boolean)

@@ -720,7 +717,7 @@
Parameters
Improve this Doc - View Source + View Source

Redirect(String, Boolean)

@@ -760,7 +757,7 @@
Parameters
Improve this Doc - View Source + View Source

Respond(Response, Boolean)

@@ -800,7 +797,7 @@
Parameters
Improve this Doc - View Source + View Source

SetRequestBody(Byte[])

@@ -834,7 +831,7 @@
Parameters
Improve this Doc - View Source + View Source

SetRequestBodyString(String)

@@ -868,7 +865,7 @@
Parameters
Improve this Doc - View Source + View Source

SetResponseBody(Byte[])

@@ -902,7 +899,7 @@
Parameters
Improve this Doc - View Source + View Source

SetResponseBodyString(String)

@@ -936,7 +933,7 @@
Parameters
Improve this Doc - View Source + View Source

TerminateServerConnection()

diff --git a/docs/api/Titanium.Web.Proxy.EventArguments.SessionEventArgsBase.html b/docs/api/Titanium.Web.Proxy.EventArguments.SessionEventArgsBase.html index eff890138..15f9157a2 100644 --- a/docs/api/Titanium.Web.Proxy.EventArguments.SessionEventArgsBase.html +++ b/docs/api/Titanium.Web.Proxy.EventArguments.SessionEventArgsBase.html @@ -141,7 +141,7 @@

Constructors Improve this Doc - View Source + View Source

SessionEventArgsBase(ProxyServer, ProxyEndPoint, CancellationTokenSource, Request)

@@ -190,7 +190,7 @@

Fields Improve this Doc - View Source + View Source

BufferPool

@@ -214,41 +214,12 @@
Field Value
- - | - Improve this Doc - - - View Source - -

BufferSize

-
-
-
Declaration
-
-
protected readonly int BufferSize
-
-
Field Value
- - - - - - - - - - - - - -
TypeDescription
Int32
| Improve this Doc - View Source + View Source

ExceptionFunc

@@ -279,7 +250,7 @@

Properties Improve this Doc - View Source + View Source

ClientEndPoint

@@ -310,7 +281,7 @@
Property Value
Improve this Doc - View Source + View Source

CustomUpStreamProxyUsed

@@ -341,7 +312,7 @@
Property Value
Improve this Doc - View Source + View Source

Exception

@@ -372,7 +343,7 @@
Property Value
Improve this Doc - View Source + View Source

HttpClient

@@ -403,7 +374,7 @@
Property Value
Improve this Doc - View Source + View Source

IsHttps

@@ -434,7 +405,7 @@
Property Value
Improve this Doc - View Source + View Source

IsTransparent

@@ -465,7 +436,7 @@
Property Value
Improve this Doc - View Source + View Source

LocalEndPoint

@@ -496,7 +467,7 @@
Property Value
Improve this Doc - View Source + View Source

TimeLine

@@ -527,7 +498,7 @@
Property Value
Improve this Doc - View Source + View Source

UserData

@@ -559,7 +530,7 @@
Property Value
Improve this Doc - View Source + View Source

WebSession

@@ -592,7 +563,7 @@

Methods Improve this Doc - View Source + View Source

Dispose()

@@ -608,7 +579,7 @@
Declaration
Improve this Doc - View Source + View Source

TerminateSession()

@@ -626,7 +597,7 @@

Events Improve this Doc - View Source + View Source

DataReceived

Fired when data is received within this session from client/server.

@@ -656,7 +627,7 @@
Event Type
Improve this Doc - View Source + View Source

DataSent

Fired when data is sent within this session to server/client.

diff --git a/docs/api/Titanium.Web.Proxy.EventArguments.TunnelConnectSessionEventArgs.html b/docs/api/Titanium.Web.Proxy.EventArguments.TunnelConnectSessionEventArgs.html index 6bb9ca430..dec7ba309 100644 --- a/docs/api/Titanium.Web.Proxy.EventArguments.TunnelConnectSessionEventArgs.html +++ b/docs/api/Titanium.Web.Proxy.EventArguments.TunnelConnectSessionEventArgs.html @@ -99,9 +99,6 @@
Implements
Inherited Members
- diff --git a/docs/api/Titanium.Web.Proxy.Models.ExplicitProxyEndPoint.html b/docs/api/Titanium.Web.Proxy.Models.ExplicitProxyEndPoint.html index d4cf7b7c8..6d0d13347 100644 --- a/docs/api/Titanium.Web.Proxy.Models.ExplicitProxyEndPoint.html +++ b/docs/api/Titanium.Web.Proxy.Models.ExplicitProxyEndPoint.html @@ -104,9 +104,6 @@
Inherited Members
- diff --git a/docs/api/Titanium.Web.Proxy.Models.ProxyEndPoint.html b/docs/api/Titanium.Web.Proxy.Models.ProxyEndPoint.html index 1a173bf8c..333371a0e 100644 --- a/docs/api/Titanium.Web.Proxy.Models.ProxyEndPoint.html +++ b/docs/api/Titanium.Web.Proxy.Models.ProxyEndPoint.html @@ -206,7 +206,7 @@
Property Value
Improve this Doc - View Source + View Source

GenericCertificate

@@ -263,37 +263,6 @@
Property Value
- - | - Improve this Doc - - - View Source - - -

IpV6Enabled

-

Is IPv6 enabled?

-
-
-
Declaration
-
-
public bool IpV6Enabled { get; }
-
-
Property Value
- - - - - - - - - - - - - -
TypeDescription
Boolean
| Improve this Doc diff --git a/docs/api/Titanium.Web.Proxy.Models.TransparentProxyEndPoint.html b/docs/api/Titanium.Web.Proxy.Models.TransparentProxyEndPoint.html index d7b4aa2dc..15c4c93ec 100644 --- a/docs/api/Titanium.Web.Proxy.Models.TransparentProxyEndPoint.html +++ b/docs/api/Titanium.Web.Proxy.Models.TransparentProxyEndPoint.html @@ -104,9 +104,6 @@
Inherited Members
- diff --git a/docs/api/Titanium.Web.Proxy.ProxyServer.html b/docs/api/Titanium.Web.Proxy.ProxyServer.html index 23e0df9f2..d733700a9 100644 --- a/docs/api/Titanium.Web.Proxy.ProxyServer.html +++ b/docs/api/Titanium.Web.Proxy.ProxyServer.html @@ -243,7 +243,7 @@

Properties Improve this Doc - View Source + View Source

BufferPool

@@ -271,44 +271,12 @@
Property Value
- - | - Improve this Doc - - - View Source - - -

BufferSize

-

Buffer size in bytes used throughout this proxy. -Default value is 8192 bytes.

-
-
-
Declaration
-
-
public int BufferSize { get; set; }
-
-
Property Value
- - - - - - - - - - - - - -
TypeDescription
Int32
| Improve this Doc - View Source + View Source

CertificateManager

@@ -339,7 +307,7 @@
Property Value
Improve this Doc
- View Source + View Source

CheckCertificateRevocation

@@ -371,7 +339,7 @@
Property Value
Improve this Doc - View Source + View Source

ClientConnectionCount

@@ -402,7 +370,7 @@
Property Value
Improve this Doc - View Source + View Source

ConnectionTimeOutSeconds

@@ -435,7 +403,7 @@
Property Value
Improve this Doc - View Source + View Source

Enable100ContinueBehaviour

@@ -468,7 +436,7 @@
Property Value
Improve this Doc - View Source + View Source

EnableConnectionPool

@@ -500,7 +468,7 @@
Property Value
Improve this Doc - View Source + View Source

EnableHttp2

@@ -536,7 +504,7 @@
Property Value
Improve this Doc - View Source + View Source

EnableTcpServerConnectionPrefetch

@@ -572,7 +540,7 @@
Property Value
Improve this Doc - View Source + View Source

EnableWinAuth

@@ -607,7 +575,7 @@
Property Value
Improve this Doc - View Source + View Source

ExceptionFunc

@@ -638,7 +606,7 @@
Property Value
Improve this Doc - View Source + View Source

ForwardToUpstreamGateway

@@ -670,7 +638,7 @@
Property Value
Improve this Doc - View Source + View Source

GetCustomUpStreamProxyFunc

@@ -702,7 +670,7 @@
Property Value
Improve this Doc - View Source + View Source

MaxCachedConnections

@@ -735,7 +703,7 @@
Property Value
Improve this Doc - View Source + View Source

NoDelay

@@ -767,7 +735,7 @@
Property Value
Improve this Doc - View Source + View Source

ProxyAuthenticationRealm

@@ -798,7 +766,7 @@
Property Value
Improve this Doc - View Source + View Source

ProxyAuthenticationSchemes

@@ -830,7 +798,7 @@
Property Value
Improve this Doc - View Source + View Source

ProxyBasicAuthenticateFunc

@@ -863,7 +831,7 @@
Property Value
Improve this Doc - View Source + View Source

ProxyEndPoints

@@ -894,7 +862,7 @@
Property Value
Improve this Doc - View Source + View Source

ProxyRunning

@@ -925,7 +893,7 @@
Property Value
Improve this Doc - View Source + View Source

ProxySchemeAuthenticateFunc

@@ -958,7 +926,7 @@
Property Value
Improve this Doc - View Source + View Source

ReuseSocket

@@ -990,7 +958,7 @@
Property Value
Improve this Doc - View Source + View Source

ServerConnectionCount

@@ -1021,7 +989,7 @@
Property Value
Improve this Doc - View Source + View Source

SupportedSslProtocols

@@ -1052,7 +1020,7 @@
Property Value
Improve this Doc - View Source + View Source

TcpTimeWaitSeconds

@@ -1084,7 +1052,7 @@
Property Value
Improve this Doc - View Source + View Source

ThreadPoolWorkerThread

@@ -1115,7 +1083,7 @@
Property Value
Improve this Doc - View Source + View Source

UpStreamEndPoint

@@ -1147,7 +1115,7 @@
Property Value
Improve this Doc - View Source + View Source

UpStreamHttpProxy

@@ -1178,7 +1146,7 @@
Property Value
Improve this Doc - View Source + View Source

UpStreamHttpsProxy

@@ -1211,7 +1179,7 @@

Methods Improve this Doc - View Source + View Source

AddEndPoint(ProxyEndPoint)

@@ -1245,7 +1213,7 @@
Parameters
Improve this Doc - View Source + View Source

DisableAllSystemProxies()

@@ -1261,7 +1229,7 @@
Declaration
Improve this Doc - View Source + View Source

DisableSystemHttpProxy()

@@ -1277,7 +1245,7 @@
Declaration
Improve this Doc - View Source + View Source

DisableSystemHttpsProxy()

@@ -1293,7 +1261,7 @@
Declaration
Improve this Doc - View Source + View Source

DisableSystemProxy(ProxyProtocolType)

@@ -1326,7 +1294,7 @@
Parameters
Improve this Doc - View Source + View Source

Dispose()

@@ -1342,7 +1310,7 @@
Declaration
Improve this Doc - View Source + View Source

RemoveEndPoint(ProxyEndPoint)

@@ -1377,7 +1345,7 @@
Parameters
Improve this Doc - View Source + View Source

RestoreOriginalProxySettings()

@@ -1393,7 +1361,7 @@
Declaration
Improve this Doc - View Source + View Source

SetAsSystemHttpProxy(ExplicitProxyEndPoint)

@@ -1427,7 +1395,7 @@
Parameters
Improve this Doc - View Source + View Source

SetAsSystemHttpsProxy(ExplicitProxyEndPoint)

@@ -1461,7 +1429,7 @@
Parameters
Improve this Doc - View Source + View Source

SetAsSystemProxy(ExplicitProxyEndPoint, ProxyProtocolType)

@@ -1501,7 +1469,7 @@
Parameters
Improve this Doc - View Source + View Source

Start()

@@ -1517,7 +1485,7 @@
Declaration
Improve this Doc - View Source + View Source

Stop()

@@ -1535,7 +1503,7 @@

Events Improve this Doc - View Source + View Source

AfterResponse

Intercept after response event from server.

@@ -1565,7 +1533,7 @@
Event Type
Improve this Doc - View Source + View Source

BeforeRequest

Intercept request event to server.

@@ -1595,7 +1563,7 @@
Event Type
Improve this Doc - View Source + View Source

BeforeResponse

Intercept response event from server.

@@ -1625,7 +1593,7 @@
Event Type
Improve this Doc - View Source + View Source

ClientCertificateSelectionCallback

Event to override client certificate selection during mutual SSL authentication.

@@ -1655,7 +1623,7 @@
Event Type
Improve this Doc - View Source + View Source

ClientConnectionCountChanged

Event occurs when client connection count changed.

@@ -1685,7 +1653,7 @@
Event Type
Improve this Doc - View Source + View Source

OnClientConnectionCreate

Customize TcpClient used for client connection upon create.

@@ -1715,7 +1683,7 @@
Event Type
Improve this Doc - View Source + View Source

OnServerConnectionCreate

Customize TcpClient used for server connection upon create.

@@ -1745,7 +1713,7 @@
Event Type
Improve this Doc - View Source + View Source

ServerCertificateValidationCallback

Event to override the default verification logic of remote SSL certificate received during authentication.

@@ -1775,7 +1743,7 @@
Event Type
Improve this Doc - View Source + View Source

ServerConnectionCountChanged

Event occurs when server connection count changed.

diff --git a/docs/index.json b/docs/index.json index 895f512f7..1b71f553e 100644 --- a/docs/index.json +++ b/docs/index.json @@ -32,17 +32,17 @@ "api/Titanium.Web.Proxy.EventArguments.SessionEventArgs.html": { "href": "api/Titanium.Web.Proxy.EventArguments.SessionEventArgs.html", "title": "Class SessionEventArgs | Titanium Web Proxy", - "keywords": "Class SessionEventArgs Holds info related to a single proxy session (single request/response sequence). A proxy session is bounded to a single connection from client. A proxy session ends when client terminates connection to proxy or when server terminates connection from proxy. Inheritance Object EventArgs SessionEventArgsBase SessionEventArgs Implements IDisposable Inherited Members SessionEventArgsBase.BufferSize SessionEventArgsBase.BufferPool SessionEventArgsBase.ExceptionFunc SessionEventArgsBase.TimeLine SessionEventArgsBase.UserData SessionEventArgsBase.IsHttps SessionEventArgsBase.ClientEndPoint SessionEventArgsBase.HttpClient SessionEventArgsBase.WebSession SessionEventArgsBase.CustomUpStreamProxyUsed SessionEventArgsBase.LocalEndPoint SessionEventArgsBase.IsTransparent SessionEventArgsBase.Exception SessionEventArgsBase.DataSent SessionEventArgsBase.DataReceived SessionEventArgsBase.TerminateSession() EventArgs.Empty Object.Equals(Object) Object.Equals(Object, Object) Object.GetHashCode() Object.GetType() Object.MemberwiseClone() Object.ReferenceEquals(Object, Object) Object.ToString() Namespace : Titanium.Web.Proxy.EventArguments Assembly : Titanium.Web.Proxy.dll Syntax public class SessionEventArgs : SessionEventArgsBase, IDisposable Constructors | Improve this Doc View Source SessionEventArgs(ProxyServer, ProxyEndPoint, Request, CancellationTokenSource) Declaration protected SessionEventArgs(ProxyServer server, ProxyEndPoint endPoint, Request request, CancellationTokenSource cancellationTokenSource) Parameters Type Name Description ProxyServer server ProxyEndPoint endPoint Request request CancellationTokenSource cancellationTokenSource Properties | Improve this Doc View Source IsPromise Is this session a HTTP/2 promise? Declaration public bool IsPromise { get; } Property Value Type Description Boolean | Improve this Doc View Source ReRequest Should we send the request again ? Declaration public bool ReRequest { get; set; } Property Value Type Description Boolean Methods | Improve this Doc View Source Dispose() Implement any cleanup here Declaration public override void Dispose() Overrides SessionEventArgsBase.Dispose() | Improve this Doc View Source GenericResponse(Byte[], HttpStatusCode, Dictionary, Boolean) Before request is made to server respond with the specified byte[], the specified status to client. And then ignore the request. Declaration public void GenericResponse(byte[] result, HttpStatusCode status, Dictionary headers, bool closeServerConnection = false) Parameters Type Name Description Byte [] result The bytes to sent. HttpStatusCode status The HTTP status code. Dictionary < String , HttpHeader > headers The HTTP headers. Boolean closeServerConnection Close the server connection used by request if any? | Improve this Doc View Source GenericResponse(String, HttpStatusCode, Dictionary, Boolean) Before request is made to server respond with the specified HTML string and the specified status to client. And then ignore the request. Declaration public void GenericResponse(string html, HttpStatusCode status, Dictionary headers = null, bool closeServerConnection = false) Parameters Type Name Description String html The html content. HttpStatusCode status The HTTP status code. Dictionary < String , HttpHeader > headers The HTTP headers. Boolean closeServerConnection Close the server connection used by request if any? | Improve this Doc View Source GetRequestBody(CancellationToken) Gets the request body as bytes. Declaration public Task GetRequestBody(CancellationToken cancellationToken = default(CancellationToken)) Parameters Type Name Description CancellationToken cancellationToken Optional cancellation token for this async task. Returns Type Description Task < Byte []> The body as bytes. | Improve this Doc View Source GetRequestBodyAsString(CancellationToken) Gets the request body as string. Declaration public Task GetRequestBodyAsString(CancellationToken cancellationToken = default(CancellationToken)) Parameters Type Name Description CancellationToken cancellationToken Optional cancellation token for this async task. Returns Type Description Task < String > The body as string. | Improve this Doc View Source GetResponseBody(CancellationToken) Gets the response body as bytes. Declaration public Task GetResponseBody(CancellationToken cancellationToken = default(CancellationToken)) Parameters Type Name Description CancellationToken cancellationToken Optional cancellation token for this async task. Returns Type Description Task < Byte []> The resulting bytes. | Improve this Doc View Source GetResponseBodyAsString(CancellationToken) Gets the response body as string. Declaration public Task GetResponseBodyAsString(CancellationToken cancellationToken = default(CancellationToken)) Parameters Type Name Description CancellationToken cancellationToken Optional cancellation token for this async task. Returns Type Description Task < String > The string body. | Improve this Doc View Source Ok(Byte[], Dictionary, Boolean) Before request is made to server respond with the specified byte[] to client and ignore the request. Declaration public void Ok(byte[] result, Dictionary headers = null, bool closeServerConnection = false) Parameters Type Name Description Byte [] result The html content bytes. Dictionary < String , HttpHeader > headers The HTTP headers. Boolean closeServerConnection Close the server connection used by request if any? | Improve this Doc View Source Ok(String, Dictionary, Boolean) Before request is made to server respond with the specified HTML string to client and ignore the request. Declaration public void Ok(string html, Dictionary headers = null, bool closeServerConnection = false) Parameters Type Name Description String html HTML content to sent. Dictionary < String , HttpHeader > headers HTTP response headers. Boolean closeServerConnection Close the server connection used by request if any? | Improve this Doc View Source Redirect(String, Boolean) Redirect to provided URL. Declaration public void Redirect(string url, bool closeServerConnection = false) Parameters Type Name Description String url The URL to redirect. Boolean closeServerConnection Close the server connection used by request if any? | Improve this Doc View Source Respond(Response, Boolean) Respond with given response object to client. Declaration public void Respond(Response response, bool closeServerConnection = false) Parameters Type Name Description Response response The response object. Boolean closeServerConnection Close the server connection used by request if any? | Improve this Doc View Source SetRequestBody(Byte[]) Sets the request body. Declaration public void SetRequestBody(byte[] body) Parameters Type Name Description Byte [] body The request body bytes. | Improve this Doc View Source SetRequestBodyString(String) Sets the body with the specified string. Declaration public void SetRequestBodyString(string body) Parameters Type Name Description String body The request body string to set. | Improve this Doc View Source SetResponseBody(Byte[]) Set the response body bytes. Declaration public void SetResponseBody(byte[] body) Parameters Type Name Description Byte [] body The body bytes to set. | Improve this Doc View Source SetResponseBodyString(String) Replace the response body with the specified string. Declaration public void SetResponseBodyString(string body) Parameters Type Name Description String body The body string to set. | Improve this Doc View Source TerminateServerConnection() Terminate the connection to server at the end of this HTTP request/response session. Declaration public void TerminateServerConnection() Events | Improve this Doc View Source MultipartRequestPartSent Occurs when multipart request part sent. Declaration public event EventHandler MultipartRequestPartSent Event Type Type Description EventHandler < MultipartRequestPartSentEventArgs > Implements System.IDisposable" + "keywords": "Class SessionEventArgs Holds info related to a single proxy session (single request/response sequence). A proxy session is bounded to a single connection from client. A proxy session ends when client terminates connection to proxy or when server terminates connection from proxy. Inheritance Object EventArgs SessionEventArgsBase SessionEventArgs Implements IDisposable Inherited Members SessionEventArgsBase.BufferPool SessionEventArgsBase.ExceptionFunc SessionEventArgsBase.TimeLine SessionEventArgsBase.UserData SessionEventArgsBase.IsHttps SessionEventArgsBase.ClientEndPoint SessionEventArgsBase.HttpClient SessionEventArgsBase.WebSession SessionEventArgsBase.CustomUpStreamProxyUsed SessionEventArgsBase.LocalEndPoint SessionEventArgsBase.IsTransparent SessionEventArgsBase.Exception SessionEventArgsBase.DataSent SessionEventArgsBase.DataReceived SessionEventArgsBase.TerminateSession() EventArgs.Empty Object.Equals(Object) Object.Equals(Object, Object) Object.GetHashCode() Object.GetType() Object.MemberwiseClone() Object.ReferenceEquals(Object, Object) Object.ToString() Namespace : Titanium.Web.Proxy.EventArguments Assembly : Titanium.Web.Proxy.dll Syntax public class SessionEventArgs : SessionEventArgsBase, IDisposable Constructors | Improve this Doc View Source SessionEventArgs(ProxyServer, ProxyEndPoint, Request, CancellationTokenSource) Declaration protected SessionEventArgs(ProxyServer server, ProxyEndPoint endPoint, Request request, CancellationTokenSource cancellationTokenSource) Parameters Type Name Description ProxyServer server ProxyEndPoint endPoint Request request CancellationTokenSource cancellationTokenSource Properties | Improve this Doc View Source IsPromise Is this session a HTTP/2 promise? Declaration public bool IsPromise { get; } Property Value Type Description Boolean | Improve this Doc View Source ReRequest Should we send the request again ? Declaration public bool ReRequest { get; set; } Property Value Type Description Boolean Methods | Improve this Doc View Source Dispose() Implement any cleanup here Declaration public override void Dispose() Overrides SessionEventArgsBase.Dispose() | Improve this Doc View Source GenericResponse(Byte[], HttpStatusCode, Dictionary, Boolean) Before request is made to server respond with the specified byte[], the specified status to client. And then ignore the request. Declaration public void GenericResponse(byte[] result, HttpStatusCode status, Dictionary headers, bool closeServerConnection = false) Parameters Type Name Description Byte [] result The bytes to sent. HttpStatusCode status The HTTP status code. Dictionary < String , HttpHeader > headers The HTTP headers. Boolean closeServerConnection Close the server connection used by request if any? | Improve this Doc View Source GenericResponse(String, HttpStatusCode, Dictionary, Boolean) Before request is made to server respond with the specified HTML string and the specified status to client. And then ignore the request. Declaration public void GenericResponse(string html, HttpStatusCode status, Dictionary headers = null, bool closeServerConnection = false) Parameters Type Name Description String html The html content. HttpStatusCode status The HTTP status code. Dictionary < String , HttpHeader > headers The HTTP headers. Boolean closeServerConnection Close the server connection used by request if any? | Improve this Doc View Source GetRequestBody(CancellationToken) Gets the request body as bytes. Declaration public Task GetRequestBody(CancellationToken cancellationToken = default(CancellationToken)) Parameters Type Name Description CancellationToken cancellationToken Optional cancellation token for this async task. Returns Type Description Task < Byte []> The body as bytes. | Improve this Doc View Source GetRequestBodyAsString(CancellationToken) Gets the request body as string. Declaration public Task GetRequestBodyAsString(CancellationToken cancellationToken = default(CancellationToken)) Parameters Type Name Description CancellationToken cancellationToken Optional cancellation token for this async task. Returns Type Description Task < String > The body as string. | Improve this Doc View Source GetResponseBody(CancellationToken) Gets the response body as bytes. Declaration public Task GetResponseBody(CancellationToken cancellationToken = default(CancellationToken)) Parameters Type Name Description CancellationToken cancellationToken Optional cancellation token for this async task. Returns Type Description Task < Byte []> The resulting bytes. | Improve this Doc View Source GetResponseBodyAsString(CancellationToken) Gets the response body as string. Declaration public Task GetResponseBodyAsString(CancellationToken cancellationToken = default(CancellationToken)) Parameters Type Name Description CancellationToken cancellationToken Optional cancellation token for this async task. Returns Type Description Task < String > The string body. | Improve this Doc View Source Ok(Byte[], Dictionary, Boolean) Before request is made to server respond with the specified byte[] to client and ignore the request. Declaration public void Ok(byte[] result, Dictionary headers = null, bool closeServerConnection = false) Parameters Type Name Description Byte [] result The html content bytes. Dictionary < String , HttpHeader > headers The HTTP headers. Boolean closeServerConnection Close the server connection used by request if any? | Improve this Doc View Source Ok(String, Dictionary, Boolean) Before request is made to server respond with the specified HTML string to client and ignore the request. Declaration public void Ok(string html, Dictionary headers = null, bool closeServerConnection = false) Parameters Type Name Description String html HTML content to sent. Dictionary < String , HttpHeader > headers HTTP response headers. Boolean closeServerConnection Close the server connection used by request if any? | Improve this Doc View Source Redirect(String, Boolean) Redirect to provided URL. Declaration public void Redirect(string url, bool closeServerConnection = false) Parameters Type Name Description String url The URL to redirect. Boolean closeServerConnection Close the server connection used by request if any? | Improve this Doc View Source Respond(Response, Boolean) Respond with given response object to client. Declaration public void Respond(Response response, bool closeServerConnection = false) Parameters Type Name Description Response response The response object. Boolean closeServerConnection Close the server connection used by request if any? | Improve this Doc View Source SetRequestBody(Byte[]) Sets the request body. Declaration public void SetRequestBody(byte[] body) Parameters Type Name Description Byte [] body The request body bytes. | Improve this Doc View Source SetRequestBodyString(String) Sets the body with the specified string. Declaration public void SetRequestBodyString(string body) Parameters Type Name Description String body The request body string to set. | Improve this Doc View Source SetResponseBody(Byte[]) Set the response body bytes. Declaration public void SetResponseBody(byte[] body) Parameters Type Name Description Byte [] body The body bytes to set. | Improve this Doc View Source SetResponseBodyString(String) Replace the response body with the specified string. Declaration public void SetResponseBodyString(string body) Parameters Type Name Description String body The body string to set. | Improve this Doc View Source TerminateServerConnection() Terminate the connection to server at the end of this HTTP request/response session. Declaration public void TerminateServerConnection() Events | Improve this Doc View Source MultipartRequestPartSent Occurs when multipart request part sent. Declaration public event EventHandler MultipartRequestPartSent Event Type Type Description EventHandler < MultipartRequestPartSentEventArgs > Implements System.IDisposable" }, "api/Titanium.Web.Proxy.EventArguments.SessionEventArgsBase.html": { "href": "api/Titanium.Web.Proxy.EventArguments.SessionEventArgsBase.html", "title": "Class SessionEventArgsBase | Titanium Web Proxy", - "keywords": "Class SessionEventArgsBase Holds info related to a single proxy session (single request/response sequence). A proxy session is bounded to a single connection from client. A proxy session ends when client terminates connection to proxy or when server terminates connection from proxy. Inheritance Object EventArgs SessionEventArgsBase SessionEventArgs TunnelConnectSessionEventArgs Implements IDisposable Inherited Members EventArgs.Empty Object.Equals(Object) Object.Equals(Object, Object) Object.GetHashCode() Object.GetType() Object.MemberwiseClone() Object.ReferenceEquals(Object, Object) Object.ToString() Namespace : Titanium.Web.Proxy.EventArguments Assembly : Titanium.Web.Proxy.dll Syntax public abstract class SessionEventArgsBase : EventArgs, IDisposable Constructors | Improve this Doc View Source SessionEventArgsBase(ProxyServer, ProxyEndPoint, CancellationTokenSource, Request) Declaration protected SessionEventArgsBase(ProxyServer server, ProxyEndPoint endPoint, CancellationTokenSource cancellationTokenSource, Request request) Parameters Type Name Description ProxyServer server ProxyEndPoint endPoint CancellationTokenSource cancellationTokenSource Request request Fields | Improve this Doc View Source BufferPool Declaration protected readonly IBufferPool BufferPool Field Value Type Description IBufferPool | Improve this Doc View Source BufferSize Declaration protected readonly int BufferSize Field Value Type Description Int32 | Improve this Doc View Source ExceptionFunc Declaration protected readonly ExceptionHandler ExceptionFunc Field Value Type Description ExceptionHandler Properties | Improve this Doc View Source ClientEndPoint Client End Point. Declaration public IPEndPoint ClientEndPoint { get; } Property Value Type Description IPEndPoint | Improve this Doc View Source CustomUpStreamProxyUsed Are we using a custom upstream HTTP(S) proxy? Declaration public ExternalProxy CustomUpStreamProxyUsed { get; } Property Value Type Description ExternalProxy | Improve this Doc View Source Exception The last exception that happened. Declaration public Exception Exception { get; } Property Value Type Description Exception | Improve this Doc View Source HttpClient The web client used to communicate with server for this session. Declaration public HttpWebClient HttpClient { get; } Property Value Type Description HttpWebClient | Improve this Doc View Source IsHttps Does this session uses SSL? Declaration public bool IsHttps { get; } Property Value Type Description Boolean | Improve this Doc View Source IsTransparent Is this a transparent endpoint? Declaration public bool IsTransparent { get; } Property Value Type Description Boolean | Improve this Doc View Source LocalEndPoint Local endpoint via which we make the request. Declaration public ProxyEndPoint LocalEndPoint { get; } Property Value Type Description ProxyEndPoint | Improve this Doc View Source TimeLine Relative milliseconds for various events. Declaration public Dictionary TimeLine { get; } Property Value Type Description Dictionary < String , DateTime > | Improve this Doc View Source UserData Returns a user data for this request/response session which is same as the user data of HttpClient. Declaration public object UserData { get; set; } Property Value Type Description Object | Improve this Doc View Source WebSession Declaration [Obsolete(\"Use HttpClient instead.\")] public HttpWebClient WebSession { get; } Property Value Type Description HttpWebClient Methods | Improve this Doc View Source Dispose() Implements cleanup here. Declaration public virtual void Dispose() | Improve this Doc View Source TerminateSession() Terminates the session abruptly by terminating client/server connections. Declaration public void TerminateSession() Events | Improve this Doc View Source DataReceived Fired when data is received within this session from client/server. Declaration public event EventHandler DataReceived Event Type Type Description EventHandler < DataEventArgs > | Improve this Doc View Source DataSent Fired when data is sent within this session to server/client. Declaration public event EventHandler DataSent Event Type Type Description EventHandler < DataEventArgs > Implements System.IDisposable" + "keywords": "Class SessionEventArgsBase Holds info related to a single proxy session (single request/response sequence). A proxy session is bounded to a single connection from client. A proxy session ends when client terminates connection to proxy or when server terminates connection from proxy. Inheritance Object EventArgs SessionEventArgsBase SessionEventArgs TunnelConnectSessionEventArgs Implements IDisposable Inherited Members EventArgs.Empty Object.Equals(Object) Object.Equals(Object, Object) Object.GetHashCode() Object.GetType() Object.MemberwiseClone() Object.ReferenceEquals(Object, Object) Object.ToString() Namespace : Titanium.Web.Proxy.EventArguments Assembly : Titanium.Web.Proxy.dll Syntax public abstract class SessionEventArgsBase : EventArgs, IDisposable Constructors | Improve this Doc View Source SessionEventArgsBase(ProxyServer, ProxyEndPoint, CancellationTokenSource, Request) Declaration protected SessionEventArgsBase(ProxyServer server, ProxyEndPoint endPoint, CancellationTokenSource cancellationTokenSource, Request request) Parameters Type Name Description ProxyServer server ProxyEndPoint endPoint CancellationTokenSource cancellationTokenSource Request request Fields | Improve this Doc View Source BufferPool Declaration protected readonly IBufferPool BufferPool Field Value Type Description IBufferPool | Improve this Doc View Source ExceptionFunc Declaration protected readonly ExceptionHandler ExceptionFunc Field Value Type Description ExceptionHandler Properties | Improve this Doc View Source ClientEndPoint Client End Point. Declaration public IPEndPoint ClientEndPoint { get; } Property Value Type Description IPEndPoint | Improve this Doc View Source CustomUpStreamProxyUsed Are we using a custom upstream HTTP(S) proxy? Declaration public ExternalProxy CustomUpStreamProxyUsed { get; } Property Value Type Description ExternalProxy | Improve this Doc View Source Exception The last exception that happened. Declaration public Exception Exception { get; } Property Value Type Description Exception | Improve this Doc View Source HttpClient The web client used to communicate with server for this session. Declaration public HttpWebClient HttpClient { get; } Property Value Type Description HttpWebClient | Improve this Doc View Source IsHttps Does this session uses SSL? Declaration public bool IsHttps { get; } Property Value Type Description Boolean | Improve this Doc View Source IsTransparent Is this a transparent endpoint? Declaration public bool IsTransparent { get; } Property Value Type Description Boolean | Improve this Doc View Source LocalEndPoint Local endpoint via which we make the request. Declaration public ProxyEndPoint LocalEndPoint { get; } Property Value Type Description ProxyEndPoint | Improve this Doc View Source TimeLine Relative milliseconds for various events. Declaration public Dictionary TimeLine { get; } Property Value Type Description Dictionary < String , DateTime > | Improve this Doc View Source UserData Returns a user data for this request/response session which is same as the user data of HttpClient. Declaration public object UserData { get; set; } Property Value Type Description Object | Improve this Doc View Source WebSession Declaration [Obsolete(\"Use HttpClient instead.\")] public HttpWebClient WebSession { get; } Property Value Type Description HttpWebClient Methods | Improve this Doc View Source Dispose() Implements cleanup here. Declaration public virtual void Dispose() | Improve this Doc View Source TerminateSession() Terminates the session abruptly by terminating client/server connections. Declaration public void TerminateSession() Events | Improve this Doc View Source DataReceived Fired when data is received within this session from client/server. Declaration public event EventHandler DataReceived Event Type Type Description EventHandler < DataEventArgs > | Improve this Doc View Source DataSent Fired when data is sent within this session to server/client. Declaration public event EventHandler DataSent Event Type Type Description EventHandler < DataEventArgs > Implements System.IDisposable" }, "api/Titanium.Web.Proxy.EventArguments.TunnelConnectSessionEventArgs.html": { "href": "api/Titanium.Web.Proxy.EventArguments.TunnelConnectSessionEventArgs.html", "title": "Class TunnelConnectSessionEventArgs | Titanium Web Proxy", - "keywords": "Class TunnelConnectSessionEventArgs A class that wraps the state when a tunnel connect event happen for Explicit endpoints. Inheritance Object EventArgs SessionEventArgsBase TunnelConnectSessionEventArgs Implements IDisposable Inherited Members SessionEventArgsBase.BufferSize SessionEventArgsBase.BufferPool SessionEventArgsBase.ExceptionFunc SessionEventArgsBase.TimeLine SessionEventArgsBase.UserData SessionEventArgsBase.IsHttps SessionEventArgsBase.ClientEndPoint SessionEventArgsBase.HttpClient SessionEventArgsBase.WebSession SessionEventArgsBase.CustomUpStreamProxyUsed SessionEventArgsBase.LocalEndPoint SessionEventArgsBase.IsTransparent SessionEventArgsBase.Exception SessionEventArgsBase.Dispose() SessionEventArgsBase.DataSent SessionEventArgsBase.DataReceived SessionEventArgsBase.TerminateSession() EventArgs.Empty Object.Equals(Object) Object.Equals(Object, Object) Object.GetHashCode() Object.GetType() Object.MemberwiseClone() Object.ReferenceEquals(Object, Object) Object.ToString() Namespace : Titanium.Web.Proxy.EventArguments Assembly : Titanium.Web.Proxy.dll Syntax public class TunnelConnectSessionEventArgs : SessionEventArgsBase, IDisposable Properties | Improve this Doc View Source DecryptSsl Should we decrypt the Ssl or relay it to server? Default is true. Declaration public bool DecryptSsl { get; set; } Property Value Type Description Boolean | Improve this Doc View Source DenyConnect When set to true it denies the connect request with a Forbidden status. Declaration public bool DenyConnect { get; set; } Property Value Type Description Boolean | Improve this Doc View Source IsHttpsConnect Is this a connect request to secure HTTP server? Or is it to some other protocol. Declaration public bool IsHttpsConnect { get; } Property Value Type Description Boolean Implements System.IDisposable" + "keywords": "Class TunnelConnectSessionEventArgs A class that wraps the state when a tunnel connect event happen for Explicit endpoints. Inheritance Object EventArgs SessionEventArgsBase TunnelConnectSessionEventArgs Implements IDisposable Inherited Members SessionEventArgsBase.BufferPool SessionEventArgsBase.ExceptionFunc SessionEventArgsBase.TimeLine SessionEventArgsBase.UserData SessionEventArgsBase.IsHttps SessionEventArgsBase.ClientEndPoint SessionEventArgsBase.HttpClient SessionEventArgsBase.WebSession SessionEventArgsBase.CustomUpStreamProxyUsed SessionEventArgsBase.LocalEndPoint SessionEventArgsBase.IsTransparent SessionEventArgsBase.Exception SessionEventArgsBase.Dispose() SessionEventArgsBase.DataSent SessionEventArgsBase.DataReceived SessionEventArgsBase.TerminateSession() EventArgs.Empty Object.Equals(Object) Object.Equals(Object, Object) Object.GetHashCode() Object.GetType() Object.MemberwiseClone() Object.ReferenceEquals(Object, Object) Object.ToString() Namespace : Titanium.Web.Proxy.EventArguments Assembly : Titanium.Web.Proxy.dll Syntax public class TunnelConnectSessionEventArgs : SessionEventArgsBase, IDisposable Properties | Improve this Doc View Source DecryptSsl Should we decrypt the Ssl or relay it to server? Default is true. Declaration public bool DecryptSsl { get; set; } Property Value Type Description Boolean | Improve this Doc View Source DenyConnect When set to true it denies the connect request with a Forbidden status. Declaration public bool DenyConnect { get; set; } Property Value Type Description Boolean | Improve this Doc View Source IsHttpsConnect Is this a connect request to secure HTTP server? Or is it to some other protocol. Declaration public bool IsHttpsConnect { get; } Property Value Type Description Boolean Implements System.IDisposable" }, "api/Titanium.Web.Proxy.ExceptionHandler.html": { "href": "api/Titanium.Web.Proxy.ExceptionHandler.html", @@ -217,7 +217,7 @@ "api/Titanium.Web.Proxy.Models.ExplicitProxyEndPoint.html": { "href": "api/Titanium.Web.Proxy.Models.ExplicitProxyEndPoint.html", "title": "Class ExplicitProxyEndPoint | Titanium Web Proxy", - "keywords": "Class ExplicitProxyEndPoint A proxy endpoint that the client is aware of. So client application know that it is communicating with a proxy server. Inheritance Object ProxyEndPoint ExplicitProxyEndPoint Inherited Members ProxyEndPoint.IpAddress ProxyEndPoint.Port ProxyEndPoint.DecryptSsl ProxyEndPoint.IpV6Enabled ProxyEndPoint.GenericCertificate Object.Equals(Object) Object.Equals(Object, Object) Object.GetHashCode() Object.GetType() Object.MemberwiseClone() Object.ReferenceEquals(Object, Object) Object.ToString() Namespace : Titanium.Web.Proxy.Models Assembly : Titanium.Web.Proxy.dll Syntax public class ExplicitProxyEndPoint : ProxyEndPoint Constructors | Improve this Doc View Source ExplicitProxyEndPoint(IPAddress, Int32, Boolean) Constructor. Declaration public ExplicitProxyEndPoint(IPAddress ipAddress, int port, bool decryptSsl = true) Parameters Type Name Description IPAddress ipAddress Listening IP address. Int32 port Listening port. Boolean decryptSsl Should we decrypt ssl? Events | Improve this Doc View Source BeforeTunnelConnectRequest Intercept tunnel connect request. Valid only for explicit endpoints. Set the DecryptSsl property to false if this HTTP connect request shouldn't be decrypted and instead be relayed. Declaration public event AsyncEventHandler BeforeTunnelConnectRequest Event Type Type Description AsyncEventHandler < TunnelConnectSessionEventArgs > | Improve this Doc View Source BeforeTunnelConnectResponse Intercept tunnel connect response. Valid only for explicit endpoints. Declaration public event AsyncEventHandler BeforeTunnelConnectResponse Event Type Type Description AsyncEventHandler < TunnelConnectSessionEventArgs >" + "keywords": "Class ExplicitProxyEndPoint A proxy endpoint that the client is aware of. So client application know that it is communicating with a proxy server. Inheritance Object ProxyEndPoint ExplicitProxyEndPoint Inherited Members ProxyEndPoint.IpAddress ProxyEndPoint.Port ProxyEndPoint.DecryptSsl ProxyEndPoint.GenericCertificate Object.Equals(Object) Object.Equals(Object, Object) Object.GetHashCode() Object.GetType() Object.MemberwiseClone() Object.ReferenceEquals(Object, Object) Object.ToString() Namespace : Titanium.Web.Proxy.Models Assembly : Titanium.Web.Proxy.dll Syntax public class ExplicitProxyEndPoint : ProxyEndPoint Constructors | Improve this Doc View Source ExplicitProxyEndPoint(IPAddress, Int32, Boolean) Constructor. Declaration public ExplicitProxyEndPoint(IPAddress ipAddress, int port, bool decryptSsl = true) Parameters Type Name Description IPAddress ipAddress Listening IP address. Int32 port Listening port. Boolean decryptSsl Should we decrypt ssl? Events | Improve this Doc View Source BeforeTunnelConnectRequest Intercept tunnel connect request. Valid only for explicit endpoints. Set the DecryptSsl property to false if this HTTP connect request shouldn't be decrypted and instead be relayed. Declaration public event AsyncEventHandler BeforeTunnelConnectRequest Event Type Type Description AsyncEventHandler < TunnelConnectSessionEventArgs > | Improve this Doc View Source BeforeTunnelConnectResponse Intercept tunnel connect response. Valid only for explicit endpoints. Declaration public event AsyncEventHandler BeforeTunnelConnectResponse Event Type Type Description AsyncEventHandler < TunnelConnectSessionEventArgs >" }, "api/Titanium.Web.Proxy.Models.ExternalProxy.html": { "href": "api/Titanium.Web.Proxy.Models.ExternalProxy.html", @@ -247,7 +247,7 @@ "api/Titanium.Web.Proxy.Models.ProxyEndPoint.html": { "href": "api/Titanium.Web.Proxy.Models.ProxyEndPoint.html", "title": "Class ProxyEndPoint | Titanium Web Proxy", - "keywords": "Class ProxyEndPoint An abstract endpoint where the proxy listens Inheritance Object ProxyEndPoint ExplicitProxyEndPoint TransparentProxyEndPoint Inherited Members Object.Equals(Object) Object.Equals(Object, Object) Object.GetHashCode() Object.GetType() Object.MemberwiseClone() Object.ReferenceEquals(Object, Object) Object.ToString() Namespace : Titanium.Web.Proxy.Models Assembly : Titanium.Web.Proxy.dll Syntax public abstract class ProxyEndPoint Constructors | Improve this Doc View Source ProxyEndPoint(IPAddress, Int32, Boolean) Constructor. Declaration protected ProxyEndPoint(IPAddress ipAddress, int port, bool decryptSsl) Parameters Type Name Description IPAddress ipAddress Int32 port Boolean decryptSsl Properties | Improve this Doc View Source DecryptSsl Enable SSL? Declaration public bool DecryptSsl { get; } Property Value Type Description Boolean | Improve this Doc View Source GenericCertificate Generic certificate to use for SSL decryption. Declaration public X509Certificate2 GenericCertificate { get; set; } Property Value Type Description X509Certificate2 | Improve this Doc View Source IpAddress Ip Address we are listening. Declaration public IPAddress IpAddress { get; } Property Value Type Description IPAddress | Improve this Doc View Source IpV6Enabled Is IPv6 enabled? Declaration public bool IpV6Enabled { get; } Property Value Type Description Boolean | Improve this Doc View Source Port Port we are listening. Declaration public int Port { get; } Property Value Type Description Int32" + "keywords": "Class ProxyEndPoint An abstract endpoint where the proxy listens Inheritance Object ProxyEndPoint ExplicitProxyEndPoint TransparentProxyEndPoint Inherited Members Object.Equals(Object) Object.Equals(Object, Object) Object.GetHashCode() Object.GetType() Object.MemberwiseClone() Object.ReferenceEquals(Object, Object) Object.ToString() Namespace : Titanium.Web.Proxy.Models Assembly : Titanium.Web.Proxy.dll Syntax public abstract class ProxyEndPoint Constructors | Improve this Doc View Source ProxyEndPoint(IPAddress, Int32, Boolean) Constructor. Declaration protected ProxyEndPoint(IPAddress ipAddress, int port, bool decryptSsl) Parameters Type Name Description IPAddress ipAddress Int32 port Boolean decryptSsl Properties | Improve this Doc View Source DecryptSsl Enable SSL? Declaration public bool DecryptSsl { get; } Property Value Type Description Boolean | Improve this Doc View Source GenericCertificate Generic certificate to use for SSL decryption. Declaration public X509Certificate2 GenericCertificate { get; set; } Property Value Type Description X509Certificate2 | Improve this Doc View Source IpAddress Ip Address we are listening. Declaration public IPAddress IpAddress { get; } Property Value Type Description IPAddress | Improve this Doc View Source Port Port we are listening. Declaration public int Port { get; } Property Value Type Description Int32" }, "api/Titanium.Web.Proxy.Models.ProxyProtocolType.html": { "href": "api/Titanium.Web.Proxy.Models.ProxyProtocolType.html", @@ -257,7 +257,7 @@ "api/Titanium.Web.Proxy.Models.TransparentProxyEndPoint.html": { "href": "api/Titanium.Web.Proxy.Models.TransparentProxyEndPoint.html", "title": "Class TransparentProxyEndPoint | Titanium Web Proxy", - "keywords": "Class TransparentProxyEndPoint A proxy end point client is not aware of. Useful when requests are redirected to this proxy end point through port forwarding via router. Inheritance Object ProxyEndPoint TransparentProxyEndPoint Inherited Members ProxyEndPoint.IpAddress ProxyEndPoint.Port ProxyEndPoint.DecryptSsl ProxyEndPoint.IpV6Enabled ProxyEndPoint.GenericCertificate Object.Equals(Object) Object.Equals(Object, Object) Object.GetHashCode() Object.GetType() Object.MemberwiseClone() Object.ReferenceEquals(Object, Object) Object.ToString() Namespace : Titanium.Web.Proxy.Models Assembly : Titanium.Web.Proxy.dll Syntax public class TransparentProxyEndPoint : ProxyEndPoint Constructors | Improve this Doc View Source TransparentProxyEndPoint(IPAddress, Int32, Boolean) Initialize a new instance. Declaration public TransparentProxyEndPoint(IPAddress ipAddress, int port, bool decryptSsl = true) Parameters Type Name Description IPAddress ipAddress Listening Ip address. Int32 port Listening port. Boolean decryptSsl Should we decrypt ssl? Properties | Improve this Doc View Source GenericCertificateName Name of the Certificate need to be sent (same as the hostname we want to proxy). This is valid only when UseServerNameIndication is set to false. Declaration public string GenericCertificateName { get; set; } Property Value Type Description String Events | Improve this Doc View Source BeforeSslAuthenticate Before Ssl authentication this event is fired. Declaration public event AsyncEventHandler BeforeSslAuthenticate Event Type Type Description AsyncEventHandler < BeforeSslAuthenticateEventArgs >" + "keywords": "Class TransparentProxyEndPoint A proxy end point client is not aware of. Useful when requests are redirected to this proxy end point through port forwarding via router. Inheritance Object ProxyEndPoint TransparentProxyEndPoint Inherited Members ProxyEndPoint.IpAddress ProxyEndPoint.Port ProxyEndPoint.DecryptSsl ProxyEndPoint.GenericCertificate Object.Equals(Object) Object.Equals(Object, Object) Object.GetHashCode() Object.GetType() Object.MemberwiseClone() Object.ReferenceEquals(Object, Object) Object.ToString() Namespace : Titanium.Web.Proxy.Models Assembly : Titanium.Web.Proxy.dll Syntax public class TransparentProxyEndPoint : ProxyEndPoint Constructors | Improve this Doc View Source TransparentProxyEndPoint(IPAddress, Int32, Boolean) Initialize a new instance. Declaration public TransparentProxyEndPoint(IPAddress ipAddress, int port, bool decryptSsl = true) Parameters Type Name Description IPAddress ipAddress Listening Ip address. Int32 port Listening port. Boolean decryptSsl Should we decrypt ssl? Properties | Improve this Doc View Source GenericCertificateName Name of the Certificate need to be sent (same as the hostname we want to proxy). This is valid only when UseServerNameIndication is set to false. Declaration public string GenericCertificateName { get; set; } Property Value Type Description String Events | Improve this Doc View Source BeforeSslAuthenticate Before Ssl authentication this event is fired. Declaration public event AsyncEventHandler BeforeSslAuthenticate Event Type Type Description AsyncEventHandler < BeforeSslAuthenticateEventArgs >" }, "api/Titanium.Web.Proxy.Network.CertificateEngine.html": { "href": "api/Titanium.Web.Proxy.Network.CertificateEngine.html", @@ -277,6 +277,6 @@ "api/Titanium.Web.Proxy.ProxyServer.html": { "href": "api/Titanium.Web.Proxy.ProxyServer.html", "title": "Class ProxyServer | Titanium Web Proxy", - "keywords": "Class ProxyServer This class is the backbone of proxy. One can create as many instances as needed. However care should be taken to avoid using the same listening ports across multiple instances. Inheritance Object ProxyServer Implements IDisposable Inherited Members Object.Equals(Object) Object.Equals(Object, Object) Object.GetHashCode() Object.GetType() Object.MemberwiseClone() Object.ReferenceEquals(Object, Object) Object.ToString() Namespace : Titanium.Web.Proxy Assembly : Titanium.Web.Proxy.dll Syntax public class ProxyServer : IDisposable Constructors | Improve this Doc View Source ProxyServer(Boolean, Boolean, Boolean) Initializes a new instance of ProxyServer class with provided parameters. Declaration public ProxyServer(bool userTrustRootCertificate = true, bool machineTrustRootCertificate = false, bool trustRootCertificateAsAdmin = false) Parameters Type Name Description Boolean userTrustRootCertificate Should fake HTTPS certificate be trusted by this machine's user certificate store? Boolean machineTrustRootCertificate Should fake HTTPS certificate be trusted by this machine's certificate store? Boolean trustRootCertificateAsAdmin Should we attempt to trust certificates with elevated permissions by prompting for UAC if required? | Improve this Doc View Source ProxyServer(String, String, Boolean, Boolean, Boolean) Initializes a new instance of ProxyServer class with provided parameters. Declaration public ProxyServer(string rootCertificateName, string rootCertificateIssuerName, bool userTrustRootCertificate = true, bool machineTrustRootCertificate = false, bool trustRootCertificateAsAdmin = false) Parameters Type Name Description String rootCertificateName Name of the root certificate. String rootCertificateIssuerName Name of the root certificate issuer. Boolean userTrustRootCertificate Should fake HTTPS certificate be trusted by this machine's user certificate store? Boolean machineTrustRootCertificate Should fake HTTPS certificate be trusted by this machine's certificate store? Boolean trustRootCertificateAsAdmin Should we attempt to trust certificates with elevated permissions by prompting for UAC if required? Properties | Improve this Doc View Source BufferPool The buffer pool used throughout this proxy instance. Set custom implementations by implementing this interface. By default this uses DefaultBufferPool implementation available in StreamExtended library package. Declaration public IBufferPool BufferPool { get; set; } Property Value Type Description IBufferPool | Improve this Doc View Source BufferSize Buffer size in bytes used throughout this proxy. Default value is 8192 bytes. Declaration public int BufferSize { get; set; } Property Value Type Description Int32 | Improve this Doc View Source CertificateManager Manages certificates used by this proxy. Declaration public CertificateManager CertificateManager { get; } Property Value Type Description CertificateManager | Improve this Doc View Source CheckCertificateRevocation Should we check for certificate revocation during SSL authentication to servers Note: If enabled can reduce performance. Defaults to false. Declaration public X509RevocationMode CheckCertificateRevocation { get; set; } Property Value Type Description X509RevocationMode | Improve this Doc View Source ClientConnectionCount Total number of active client connections. Declaration public int ClientConnectionCount { get; } Property Value Type Description Int32 | Improve this Doc View Source ConnectionTimeOutSeconds Seconds client/server connection are to be kept alive when waiting for read/write to complete. This will also determine the pool eviction time when connection pool is enabled. Default value is 60 seconds. Declaration public int ConnectionTimeOutSeconds { get; set; } Property Value Type Description Int32 | Improve this Doc View Source Enable100ContinueBehaviour Does this proxy uses the HTTP protocol 100 continue behaviour strictly? Broken 100 continue implementations on server/client may cause problems if enabled. Defaults to false. Declaration public bool Enable100ContinueBehaviour { get; set; } Property Value Type Description Boolean | Improve this Doc View Source EnableConnectionPool Should we enable experimental server connection pool? Defaults to true. Declaration public bool EnableConnectionPool { get; set; } Property Value Type Description Boolean | Improve this Doc View Source EnableHttp2 Enable disable HTTP/2 support. Warning: HTTP/2 support is very limited only enabled when both client and server supports it (no protocol changing in proxy) cannot modify the request/response (e.g header modifications in BeforeRequest/Response events are ignored) Declaration public bool EnableHttp2 { get; set; } Property Value Type Description Boolean | Improve this Doc View Source EnableTcpServerConnectionPrefetch Should we enable tcp server connection prefetching? When enabled, as soon as we receive a client connection we concurrently initiate corresponding server connection process using CONNECT hostname or SNI hostname on a separate task so that after parsing client request we will have the server connection immediately ready or in the process of getting ready. If a server connection is available in cache then this prefetch task will immediately return with the available connection from cache. Defaults to true. Declaration public bool EnableTcpServerConnectionPrefetch { get; set; } Property Value Type Description Boolean | Improve this Doc View Source EnableWinAuth Enable disable Windows Authentication (NTLM/Kerberos). Note: NTLM/Kerberos will always send local credentials of current user running the proxy process. This is because a man in middle attack with Windows domain authentication is not currently supported. Defaults to false. Declaration public bool EnableWinAuth { get; set; } Property Value Type Description Boolean | Improve this Doc View Source ExceptionFunc Callback for error events in this proxy instance. Declaration public ExceptionHandler ExceptionFunc { get; set; } Property Value Type Description ExceptionHandler | Improve this Doc View Source ForwardToUpstreamGateway Gets or sets a value indicating whether requests will be chained to upstream gateway. Defaults to false. Declaration public bool ForwardToUpstreamGateway { get; set; } Property Value Type Description Boolean | Improve this Doc View Source GetCustomUpStreamProxyFunc A callback to provide authentication credentials for up stream proxy this proxy is using for HTTP(S) requests. User should return the ExternalProxy object with valid credentials. Declaration public Func> GetCustomUpStreamProxyFunc { get; set; } Property Value Type Description Func < SessionEventArgsBase , Task < ExternalProxy >> | Improve this Doc View Source MaxCachedConnections Maximum number of concurrent connections per remote host in cache. Only valid when connection pooling is enabled. Default value is 2. Declaration public int MaxCachedConnections { get; set; } Property Value Type Description Int32 | Improve this Doc View Source NoDelay 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. Declaration public bool NoDelay { get; set; } Property Value Type Description Boolean | Improve this Doc View Source ProxyAuthenticationRealm Realm used during Proxy Basic Authentication. Declaration public string ProxyAuthenticationRealm { get; set; } Property Value Type Description String | Improve this Doc View Source ProxyAuthenticationSchemes A collection of scheme types, e.g. basic, NTLM, Kerberos, Negotiate, to return if scheme authentication is required. Works in relation with ProxySchemeAuthenticateFunc. Declaration public IEnumerable ProxyAuthenticationSchemes { get; set; } Property Value Type Description IEnumerable < String > | Improve this Doc View Source ProxyBasicAuthenticateFunc A callback to authenticate proxy clients via basic authentication. Parameters are username and password as provided by client. Should return true for successful authentication. Declaration public Func> ProxyBasicAuthenticateFunc { get; set; } Property Value Type Description Func < SessionEventArgsBase , String , String , Task < Boolean >> | Improve this Doc View Source ProxyEndPoints A list of IpAddress and port this proxy is listening to. Declaration public List ProxyEndPoints { get; set; } Property Value Type Description List < ProxyEndPoint > | Improve this Doc View Source ProxyRunning Is the proxy currently running? Declaration public bool ProxyRunning { get; } Property Value Type Description Boolean | Improve this Doc View Source ProxySchemeAuthenticateFunc A pluggable callback to authenticate clients by scheme instead of requiring basic authentication through ProxyBasicAuthenticateFunc. Parameters are current working session, schemeType, and token as provided by a calling client. Should return success for successful authentication, continuation if the package requests, or failure. Declaration public Func> ProxySchemeAuthenticateFunc { get; set; } Property Value Type Description Func < SessionEventArgsBase , String , String , Task < ProxyAuthenticationContext >> | Improve this Doc View Source ReuseSocket Should we reuse client/server tcp sockets. Default is true (disabled for linux/macOS due to bug in .Net core). Declaration public bool ReuseSocket { get; set; } Property Value Type Description Boolean | Improve this Doc View Source ServerConnectionCount Total number of active server connections. Declaration public int ServerConnectionCount { get; } Property Value Type Description Int32 | Improve this Doc View Source SupportedSslProtocols List of supported Ssl versions. Declaration public SslProtocols SupportedSslProtocols { get; set; } Property Value Type Description SslProtocols | Improve this Doc View Source TcpTimeWaitSeconds Number of seconds to linger when Tcp connection is in TIME_WAIT state. Default value is 30. Declaration public int TcpTimeWaitSeconds { get; set; } Property Value Type Description Int32 | Improve this Doc View Source ThreadPoolWorkerThread Customize the minimum ThreadPool size (increase it on a server) Declaration public int ThreadPoolWorkerThread { get; set; } Property Value Type Description Int32 | Improve this Doc View Source UpStreamEndPoint Local adapter/NIC endpoint where proxy makes request via. Defaults via any IP addresses of this machine. Declaration public IPEndPoint UpStreamEndPoint { get; set; } Property Value Type Description IPEndPoint | Improve this Doc View Source UpStreamHttpProxy External proxy used for Http requests. Declaration public ExternalProxy UpStreamHttpProxy { get; set; } Property Value Type Description ExternalProxy | Improve this Doc View Source UpStreamHttpsProxy External proxy used for Https requests. Declaration public ExternalProxy UpStreamHttpsProxy { get; set; } Property Value Type Description ExternalProxy Methods | Improve this Doc View Source AddEndPoint(ProxyEndPoint) Add a proxy end point. Declaration public void AddEndPoint(ProxyEndPoint endPoint) Parameters Type Name Description ProxyEndPoint endPoint The proxy endpoint. | Improve this Doc View Source DisableAllSystemProxies() Clear all proxy settings for current machine. Declaration public void DisableAllSystemProxies() | Improve this Doc View Source DisableSystemHttpProxy() Clear HTTP proxy settings of current machine. Declaration public void DisableSystemHttpProxy() | Improve this Doc View Source DisableSystemHttpsProxy() Clear HTTPS proxy settings of current machine. Declaration public void DisableSystemHttpsProxy() | Improve this Doc View Source DisableSystemProxy(ProxyProtocolType) Clear the specified proxy setting for current machine. Declaration public void DisableSystemProxy(ProxyProtocolType protocolType) Parameters Type Name Description ProxyProtocolType protocolType | Improve this Doc View Source Dispose() Dispose the Proxy instance. Declaration public void Dispose() | Improve this Doc View Source RemoveEndPoint(ProxyEndPoint) Remove a proxy end point. Will throw error if the end point doesn't exist. Declaration public void RemoveEndPoint(ProxyEndPoint endPoint) Parameters Type Name Description ProxyEndPoint endPoint The existing endpoint to remove. | Improve this Doc View Source RestoreOriginalProxySettings() Restores the original proxy settings. Declaration public void RestoreOriginalProxySettings() | Improve this Doc View Source SetAsSystemHttpProxy(ExplicitProxyEndPoint) Set the given explicit end point as the default proxy server for current machine. Declaration public void SetAsSystemHttpProxy(ExplicitProxyEndPoint endPoint) Parameters Type Name Description ExplicitProxyEndPoint endPoint The explicit endpoint. | Improve this Doc View Source SetAsSystemHttpsProxy(ExplicitProxyEndPoint) Set the given explicit end point as the default proxy server for current machine. Declaration public void SetAsSystemHttpsProxy(ExplicitProxyEndPoint endPoint) Parameters Type Name Description ExplicitProxyEndPoint endPoint The explicit endpoint. | Improve this Doc View Source SetAsSystemProxy(ExplicitProxyEndPoint, ProxyProtocolType) Set the given explicit end point as the default proxy server for current machine. Declaration public void SetAsSystemProxy(ExplicitProxyEndPoint endPoint, ProxyProtocolType protocolType) Parameters Type Name Description ExplicitProxyEndPoint endPoint The explicit endpoint. ProxyProtocolType protocolType The proxy protocol type. | Improve this Doc View Source Start() Start this proxy server instance. Declaration public void Start() | Improve this Doc View Source Stop() Stop this proxy server instance. Declaration public void Stop() Events | Improve this Doc View Source AfterResponse Intercept after response event from server. Declaration public event AsyncEventHandler AfterResponse Event Type Type Description AsyncEventHandler < SessionEventArgs > | Improve this Doc View Source BeforeRequest Intercept request event to server. Declaration public event AsyncEventHandler BeforeRequest Event Type Type Description AsyncEventHandler < SessionEventArgs > | Improve this Doc View Source BeforeResponse Intercept response event from server. Declaration public event AsyncEventHandler BeforeResponse Event Type Type Description AsyncEventHandler < SessionEventArgs > | Improve this Doc View Source ClientCertificateSelectionCallback Event to override client certificate selection during mutual SSL authentication. Declaration public event AsyncEventHandler ClientCertificateSelectionCallback Event Type Type Description AsyncEventHandler < CertificateSelectionEventArgs > | Improve this Doc View Source ClientConnectionCountChanged Event occurs when client connection count changed. Declaration public event EventHandler ClientConnectionCountChanged Event Type Type Description EventHandler | Improve this Doc View Source OnClientConnectionCreate Customize TcpClient used for client connection upon create. Declaration public event AsyncEventHandler OnClientConnectionCreate Event Type Type Description AsyncEventHandler < TcpClient > | Improve this Doc View Source OnServerConnectionCreate Customize TcpClient used for server connection upon create. Declaration public event AsyncEventHandler OnServerConnectionCreate Event Type Type Description AsyncEventHandler < TcpClient > | Improve this Doc View Source ServerCertificateValidationCallback Event to override the default verification logic of remote SSL certificate received during authentication. Declaration public event AsyncEventHandler ServerCertificateValidationCallback Event Type Type Description AsyncEventHandler < CertificateValidationEventArgs > | Improve this Doc View Source ServerConnectionCountChanged Event occurs when server connection count changed. Declaration public event EventHandler ServerConnectionCountChanged Event Type Type Description EventHandler Implements System.IDisposable" + "keywords": "Class ProxyServer This class is the backbone of proxy. One can create as many instances as needed. However care should be taken to avoid using the same listening ports across multiple instances. Inheritance Object ProxyServer Implements IDisposable Inherited Members Object.Equals(Object) Object.Equals(Object, Object) Object.GetHashCode() Object.GetType() Object.MemberwiseClone() Object.ReferenceEquals(Object, Object) Object.ToString() Namespace : Titanium.Web.Proxy Assembly : Titanium.Web.Proxy.dll Syntax public class ProxyServer : IDisposable Constructors | Improve this Doc View Source ProxyServer(Boolean, Boolean, Boolean) Initializes a new instance of ProxyServer class with provided parameters. Declaration public ProxyServer(bool userTrustRootCertificate = true, bool machineTrustRootCertificate = false, bool trustRootCertificateAsAdmin = false) Parameters Type Name Description Boolean userTrustRootCertificate Should fake HTTPS certificate be trusted by this machine's user certificate store? Boolean machineTrustRootCertificate Should fake HTTPS certificate be trusted by this machine's certificate store? Boolean trustRootCertificateAsAdmin Should we attempt to trust certificates with elevated permissions by prompting for UAC if required? | Improve this Doc View Source ProxyServer(String, String, Boolean, Boolean, Boolean) Initializes a new instance of ProxyServer class with provided parameters. Declaration public ProxyServer(string rootCertificateName, string rootCertificateIssuerName, bool userTrustRootCertificate = true, bool machineTrustRootCertificate = false, bool trustRootCertificateAsAdmin = false) Parameters Type Name Description String rootCertificateName Name of the root certificate. String rootCertificateIssuerName Name of the root certificate issuer. Boolean userTrustRootCertificate Should fake HTTPS certificate be trusted by this machine's user certificate store? Boolean machineTrustRootCertificate Should fake HTTPS certificate be trusted by this machine's certificate store? Boolean trustRootCertificateAsAdmin Should we attempt to trust certificates with elevated permissions by prompting for UAC if required? Properties | Improve this Doc View Source BufferPool The buffer pool used throughout this proxy instance. Set custom implementations by implementing this interface. By default this uses DefaultBufferPool implementation available in StreamExtended library package. Declaration public IBufferPool BufferPool { get; set; } Property Value Type Description IBufferPool | Improve this Doc View Source CertificateManager Manages certificates used by this proxy. Declaration public CertificateManager CertificateManager { get; } Property Value Type Description CertificateManager | Improve this Doc View Source CheckCertificateRevocation Should we check for certificate revocation during SSL authentication to servers Note: If enabled can reduce performance. Defaults to false. Declaration public X509RevocationMode CheckCertificateRevocation { get; set; } Property Value Type Description X509RevocationMode | Improve this Doc View Source ClientConnectionCount Total number of active client connections. Declaration public int ClientConnectionCount { get; } Property Value Type Description Int32 | Improve this Doc View Source ConnectionTimeOutSeconds Seconds client/server connection are to be kept alive when waiting for read/write to complete. This will also determine the pool eviction time when connection pool is enabled. Default value is 60 seconds. Declaration public int ConnectionTimeOutSeconds { get; set; } Property Value Type Description Int32 | Improve this Doc View Source Enable100ContinueBehaviour Does this proxy uses the HTTP protocol 100 continue behaviour strictly? Broken 100 continue implementations on server/client may cause problems if enabled. Defaults to false. Declaration public bool Enable100ContinueBehaviour { get; set; } Property Value Type Description Boolean | Improve this Doc View Source EnableConnectionPool Should we enable experimental server connection pool? Defaults to true. Declaration public bool EnableConnectionPool { get; set; } Property Value Type Description Boolean | Improve this Doc View Source EnableHttp2 Enable disable HTTP/2 support. Warning: HTTP/2 support is very limited only enabled when both client and server supports it (no protocol changing in proxy) cannot modify the request/response (e.g header modifications in BeforeRequest/Response events are ignored) Declaration public bool EnableHttp2 { get; set; } Property Value Type Description Boolean | Improve this Doc View Source EnableTcpServerConnectionPrefetch Should we enable tcp server connection prefetching? When enabled, as soon as we receive a client connection we concurrently initiate corresponding server connection process using CONNECT hostname or SNI hostname on a separate task so that after parsing client request we will have the server connection immediately ready or in the process of getting ready. If a server connection is available in cache then this prefetch task will immediately return with the available connection from cache. Defaults to true. Declaration public bool EnableTcpServerConnectionPrefetch { get; set; } Property Value Type Description Boolean | Improve this Doc View Source EnableWinAuth Enable disable Windows Authentication (NTLM/Kerberos). Note: NTLM/Kerberos will always send local credentials of current user running the proxy process. This is because a man in middle attack with Windows domain authentication is not currently supported. Defaults to false. Declaration public bool EnableWinAuth { get; set; } Property Value Type Description Boolean | Improve this Doc View Source ExceptionFunc Callback for error events in this proxy instance. Declaration public ExceptionHandler ExceptionFunc { get; set; } Property Value Type Description ExceptionHandler | Improve this Doc View Source ForwardToUpstreamGateway Gets or sets a value indicating whether requests will be chained to upstream gateway. Defaults to false. Declaration public bool ForwardToUpstreamGateway { get; set; } Property Value Type Description Boolean | Improve this Doc View Source GetCustomUpStreamProxyFunc A callback to provide authentication credentials for up stream proxy this proxy is using for HTTP(S) requests. User should return the ExternalProxy object with valid credentials. Declaration public Func> GetCustomUpStreamProxyFunc { get; set; } Property Value Type Description Func < SessionEventArgsBase , Task < ExternalProxy >> | Improve this Doc View Source MaxCachedConnections Maximum number of concurrent connections per remote host in cache. Only valid when connection pooling is enabled. Default value is 2. Declaration public int MaxCachedConnections { get; set; } Property Value Type Description Int32 | Improve this Doc View Source NoDelay 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. Declaration public bool NoDelay { get; set; } Property Value Type Description Boolean | Improve this Doc View Source ProxyAuthenticationRealm Realm used during Proxy Basic Authentication. Declaration public string ProxyAuthenticationRealm { get; set; } Property Value Type Description String | Improve this Doc View Source ProxyAuthenticationSchemes A collection of scheme types, e.g. basic, NTLM, Kerberos, Negotiate, to return if scheme authentication is required. Works in relation with ProxySchemeAuthenticateFunc. Declaration public IEnumerable ProxyAuthenticationSchemes { get; set; } Property Value Type Description IEnumerable < String > | Improve this Doc View Source ProxyBasicAuthenticateFunc A callback to authenticate proxy clients via basic authentication. Parameters are username and password as provided by client. Should return true for successful authentication. Declaration public Func> ProxyBasicAuthenticateFunc { get; set; } Property Value Type Description Func < SessionEventArgsBase , String , String , Task < Boolean >> | Improve this Doc View Source ProxyEndPoints A list of IpAddress and port this proxy is listening to. Declaration public List ProxyEndPoints { get; set; } Property Value Type Description List < ProxyEndPoint > | Improve this Doc View Source ProxyRunning Is the proxy currently running? Declaration public bool ProxyRunning { get; } Property Value Type Description Boolean | Improve this Doc View Source ProxySchemeAuthenticateFunc A pluggable callback to authenticate clients by scheme instead of requiring basic authentication through ProxyBasicAuthenticateFunc. Parameters are current working session, schemeType, and token as provided by a calling client. Should return success for successful authentication, continuation if the package requests, or failure. Declaration public Func> ProxySchemeAuthenticateFunc { get; set; } Property Value Type Description Func < SessionEventArgsBase , String , String , Task < ProxyAuthenticationContext >> | Improve this Doc View Source ReuseSocket Should we reuse client/server tcp sockets. Default is true (disabled for linux/macOS due to bug in .Net core). Declaration public bool ReuseSocket { get; set; } Property Value Type Description Boolean | Improve this Doc View Source ServerConnectionCount Total number of active server connections. Declaration public int ServerConnectionCount { get; } Property Value Type Description Int32 | Improve this Doc View Source SupportedSslProtocols List of supported Ssl versions. Declaration public SslProtocols SupportedSslProtocols { get; set; } Property Value Type Description SslProtocols | Improve this Doc View Source TcpTimeWaitSeconds Number of seconds to linger when Tcp connection is in TIME_WAIT state. Default value is 30. Declaration public int TcpTimeWaitSeconds { get; set; } Property Value Type Description Int32 | Improve this Doc View Source ThreadPoolWorkerThread Customize the minimum ThreadPool size (increase it on a server) Declaration public int ThreadPoolWorkerThread { get; set; } Property Value Type Description Int32 | Improve this Doc View Source UpStreamEndPoint Local adapter/NIC endpoint where proxy makes request via. Defaults via any IP addresses of this machine. Declaration public IPEndPoint UpStreamEndPoint { get; set; } Property Value Type Description IPEndPoint | Improve this Doc View Source UpStreamHttpProxy External proxy used for Http requests. Declaration public ExternalProxy UpStreamHttpProxy { get; set; } Property Value Type Description ExternalProxy | Improve this Doc View Source UpStreamHttpsProxy External proxy used for Https requests. Declaration public ExternalProxy UpStreamHttpsProxy { get; set; } Property Value Type Description ExternalProxy Methods | Improve this Doc View Source AddEndPoint(ProxyEndPoint) Add a proxy end point. Declaration public void AddEndPoint(ProxyEndPoint endPoint) Parameters Type Name Description ProxyEndPoint endPoint The proxy endpoint. | Improve this Doc View Source DisableAllSystemProxies() Clear all proxy settings for current machine. Declaration public void DisableAllSystemProxies() | Improve this Doc View Source DisableSystemHttpProxy() Clear HTTP proxy settings of current machine. Declaration public void DisableSystemHttpProxy() | Improve this Doc View Source DisableSystemHttpsProxy() Clear HTTPS proxy settings of current machine. Declaration public void DisableSystemHttpsProxy() | Improve this Doc View Source DisableSystemProxy(ProxyProtocolType) Clear the specified proxy setting for current machine. Declaration public void DisableSystemProxy(ProxyProtocolType protocolType) Parameters Type Name Description ProxyProtocolType protocolType | Improve this Doc View Source Dispose() Dispose the Proxy instance. Declaration public void Dispose() | Improve this Doc View Source RemoveEndPoint(ProxyEndPoint) Remove a proxy end point. Will throw error if the end point doesn't exist. Declaration public void RemoveEndPoint(ProxyEndPoint endPoint) Parameters Type Name Description ProxyEndPoint endPoint The existing endpoint to remove. | Improve this Doc View Source RestoreOriginalProxySettings() Restores the original proxy settings. Declaration public void RestoreOriginalProxySettings() | Improve this Doc View Source SetAsSystemHttpProxy(ExplicitProxyEndPoint) Set the given explicit end point as the default proxy server for current machine. Declaration public void SetAsSystemHttpProxy(ExplicitProxyEndPoint endPoint) Parameters Type Name Description ExplicitProxyEndPoint endPoint The explicit endpoint. | Improve this Doc View Source SetAsSystemHttpsProxy(ExplicitProxyEndPoint) Set the given explicit end point as the default proxy server for current machine. Declaration public void SetAsSystemHttpsProxy(ExplicitProxyEndPoint endPoint) Parameters Type Name Description ExplicitProxyEndPoint endPoint The explicit endpoint. | Improve this Doc View Source SetAsSystemProxy(ExplicitProxyEndPoint, ProxyProtocolType) Set the given explicit end point as the default proxy server for current machine. Declaration public void SetAsSystemProxy(ExplicitProxyEndPoint endPoint, ProxyProtocolType protocolType) Parameters Type Name Description ExplicitProxyEndPoint endPoint The explicit endpoint. ProxyProtocolType protocolType The proxy protocol type. | Improve this Doc View Source Start() Start this proxy server instance. Declaration public void Start() | Improve this Doc View Source Stop() Stop this proxy server instance. Declaration public void Stop() Events | Improve this Doc View Source AfterResponse Intercept after response event from server. Declaration public event AsyncEventHandler AfterResponse Event Type Type Description AsyncEventHandler < SessionEventArgs > | Improve this Doc View Source BeforeRequest Intercept request event to server. Declaration public event AsyncEventHandler BeforeRequest Event Type Type Description AsyncEventHandler < SessionEventArgs > | Improve this Doc View Source BeforeResponse Intercept response event from server. Declaration public event AsyncEventHandler BeforeResponse Event Type Type Description AsyncEventHandler < SessionEventArgs > | Improve this Doc View Source ClientCertificateSelectionCallback Event to override client certificate selection during mutual SSL authentication. Declaration public event AsyncEventHandler ClientCertificateSelectionCallback Event Type Type Description AsyncEventHandler < CertificateSelectionEventArgs > | Improve this Doc View Source ClientConnectionCountChanged Event occurs when client connection count changed. Declaration public event EventHandler ClientConnectionCountChanged Event Type Type Description EventHandler | Improve this Doc View Source OnClientConnectionCreate Customize TcpClient used for client connection upon create. Declaration public event AsyncEventHandler OnClientConnectionCreate Event Type Type Description AsyncEventHandler < TcpClient > | Improve this Doc View Source OnServerConnectionCreate Customize TcpClient used for server connection upon create. Declaration public event AsyncEventHandler OnServerConnectionCreate Event Type Type Description AsyncEventHandler < TcpClient > | Improve this Doc View Source ServerCertificateValidationCallback Event to override the default verification logic of remote SSL certificate received during authentication. Declaration public event AsyncEventHandler ServerCertificateValidationCallback Event Type Type Description AsyncEventHandler < CertificateValidationEventArgs > | Improve this Doc View Source ServerConnectionCountChanged Event occurs when server connection count changed. Declaration public event EventHandler ServerConnectionCountChanged Event Type Type Description EventHandler Implements System.IDisposable" } } diff --git a/docs/xrefmap.yml b/docs/xrefmap.yml index e5b3def1c..0f686c94a 100644 --- a/docs/xrefmap.yml +++ b/docs/xrefmap.yml @@ -529,12 +529,6 @@ references: commentId: F:Titanium.Web.Proxy.EventArguments.SessionEventArgsBase.BufferPool fullName: Titanium.Web.Proxy.EventArguments.SessionEventArgsBase.BufferPool nameWithType: SessionEventArgsBase.BufferPool -- uid: Titanium.Web.Proxy.EventArguments.SessionEventArgsBase.BufferSize - name: BufferSize - href: api/Titanium.Web.Proxy.EventArguments.SessionEventArgsBase.html#Titanium_Web_Proxy_EventArguments_SessionEventArgsBase_BufferSize - commentId: F:Titanium.Web.Proxy.EventArguments.SessionEventArgsBase.BufferSize - fullName: Titanium.Web.Proxy.EventArguments.SessionEventArgsBase.BufferSize - nameWithType: SessionEventArgsBase.BufferSize - uid: Titanium.Web.Proxy.EventArguments.SessionEventArgsBase.ClientEndPoint name: ClientEndPoint href: api/Titanium.Web.Proxy.EventArguments.SessionEventArgsBase.html#Titanium_Web_Proxy_EventArguments_SessionEventArgsBase_ClientEndPoint @@ -2865,19 +2859,6 @@ references: isSpec: "True" fullName: Titanium.Web.Proxy.Models.ProxyEndPoint.IpAddress nameWithType: ProxyEndPoint.IpAddress -- uid: Titanium.Web.Proxy.Models.ProxyEndPoint.IpV6Enabled - name: IpV6Enabled - href: api/Titanium.Web.Proxy.Models.ProxyEndPoint.html#Titanium_Web_Proxy_Models_ProxyEndPoint_IpV6Enabled - commentId: P:Titanium.Web.Proxy.Models.ProxyEndPoint.IpV6Enabled - fullName: Titanium.Web.Proxy.Models.ProxyEndPoint.IpV6Enabled - nameWithType: ProxyEndPoint.IpV6Enabled -- uid: Titanium.Web.Proxy.Models.ProxyEndPoint.IpV6Enabled* - name: IpV6Enabled - href: api/Titanium.Web.Proxy.Models.ProxyEndPoint.html#Titanium_Web_Proxy_Models_ProxyEndPoint_IpV6Enabled_ - commentId: Overload:Titanium.Web.Proxy.Models.ProxyEndPoint.IpV6Enabled - isSpec: "True" - fullName: Titanium.Web.Proxy.Models.ProxyEndPoint.IpV6Enabled - nameWithType: ProxyEndPoint.IpV6Enabled - uid: Titanium.Web.Proxy.Models.ProxyEndPoint.Port name: Port href: api/Titanium.Web.Proxy.Models.ProxyEndPoint.html#Titanium_Web_Proxy_Models_ProxyEndPoint_Port @@ -3369,19 +3350,6 @@ references: isSpec: "True" fullName: Titanium.Web.Proxy.ProxyServer.BufferPool nameWithType: ProxyServer.BufferPool -- uid: Titanium.Web.Proxy.ProxyServer.BufferSize - name: BufferSize - href: api/Titanium.Web.Proxy.ProxyServer.html#Titanium_Web_Proxy_ProxyServer_BufferSize - commentId: P:Titanium.Web.Proxy.ProxyServer.BufferSize - fullName: Titanium.Web.Proxy.ProxyServer.BufferSize - nameWithType: ProxyServer.BufferSize -- uid: Titanium.Web.Proxy.ProxyServer.BufferSize* - name: BufferSize - href: api/Titanium.Web.Proxy.ProxyServer.html#Titanium_Web_Proxy_ProxyServer_BufferSize_ - commentId: Overload:Titanium.Web.Proxy.ProxyServer.BufferSize - isSpec: "True" - fullName: Titanium.Web.Proxy.ProxyServer.BufferSize - nameWithType: ProxyServer.BufferSize - uid: Titanium.Web.Proxy.ProxyServer.CertificateManager name: CertificateManager href: api/Titanium.Web.Proxy.ProxyServer.html#Titanium_Web_Proxy_ProxyServer_CertificateManager