Commit 5a7f46ce authored by justcoding121's avatar justcoding121

cleanup comments

parent 58afe8a7
......@@ -19,8 +19,9 @@ using Titanium.Web.Proxy.Network.WinAuth.Security;
namespace Titanium.Web.Proxy
{
/// <inheritdoc />
/// <summary>
/// This object is the backbone of proxy. One can create as many instances as needed.
/// 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.
/// </summary>
public partial class ProxyServer : IDisposable
......@@ -29,7 +30,6 @@ namespace Titanium.Web.Proxy
/// HTTP &amp; HTTPS scheme shorthands.
/// </summary>
internal static readonly string UriSchemeHttp = Uri.UriSchemeHttp;
internal static readonly string UriSchemeHttps = Uri.UriSchemeHttps;
/// <summary>
......@@ -57,6 +57,7 @@ namespace Titanium.Web.Proxy
/// </summary>
private WinHttpWebProxyFinder systemProxyResolver;
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of ProxyServer class with provided parameters.
/// </summary>
......@@ -108,7 +109,7 @@ namespace Titanium.Web.Proxy
}
/// <summary>
/// An object that creates tcp connection to server.
/// An factory that creates tcp connection to server.
/// </summary>
private TcpConnectionFactory tcpConnectionFactory { get; }
......@@ -128,7 +129,7 @@ namespace Titanium.Web.Proxy
public bool ForwardToUpstreamGateway { get; set; }
/// <summary>
/// Enable disable Windows Authentication (NTLM/Kerberos)
/// 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.
......@@ -144,6 +145,7 @@ namespace Titanium.Web.Proxy
/// <summary>
/// Does this proxy uses the HTTP protocol 100 continue behaviour strictly?
/// Broken 100 contunue implementations on server/client may cause problems if enabled.
/// Defaults to false.
/// </summary>
public bool Enable100ContinueBehaviour { get; set; }
......@@ -225,12 +227,12 @@ namespace Titanium.Web.Proxy
/// <summary>
/// A callback to authenticate clients.
/// Parameters are username and password as provided by client.
/// Return true for successful authentication.
/// Should return true for successful authentication.
/// </summary>
public Func<string, string, Task<bool>> AuthenticateUserFunc { get; set; }
/// <summary>
/// Dispose Proxy.
/// Dispose the Proxy instance.
/// </summary>
public void Dispose()
{
......@@ -243,37 +245,37 @@ namespace Titanium.Web.Proxy
}
/// <summary>
/// Occurs when client connection count changed.
/// Event occurs when client connection count changed.
/// </summary>
public event EventHandler ClientConnectionCountChanged;
/// <summary>
/// Occurs when server connection count changed.
/// Event occurs when server connection count changed.
/// </summary>
public event EventHandler ServerConnectionCountChanged;
/// <summary>
/// Verifies the remote SSL certificate used for authentication.
/// Event to override the default verification logic of remote SSL certificate received during authentication.
/// </summary>
public event AsyncEventHandler<CertificateValidationEventArgs> ServerCertificateValidationCallback;
/// <summary>
/// Callback to override client certificate selection during mutual SSL authentication.
/// Event to override client certificate selection during mutual SSL authentication.
/// </summary>
public event AsyncEventHandler<CertificateSelectionEventArgs> ClientCertificateSelectionCallback;
/// <summary>
/// Intercept request to server.
/// Intercept request event to server.
/// </summary>
public event AsyncEventHandler<SessionEventArgs> BeforeRequest;
/// <summary>
/// Intercept response from server.
/// Intercept response event from server.
/// </summary>
public event AsyncEventHandler<SessionEventArgs> BeforeResponse;
/// <summary>
/// Intercept after response from server.
/// Intercept after response event from server.
/// </summary>
public event AsyncEventHandler<SessionEventArgs> AfterResponse;
......@@ -299,7 +301,7 @@ namespace Titanium.Web.Proxy
/// <summary>
/// Remove a proxy end point.
/// Will throw error if the end point does'nt exist
/// Will throw error if the end point does'nt exist.
/// </summary>
/// <param name="endPoint">The existing endpoint to remove.</param>
public void RemoveEndPoint(ProxyEndPoint endPoint)
......@@ -320,7 +322,7 @@ namespace Titanium.Web.Proxy
/// <summary>
/// Set the given explicit end point as the default proxy server for current machine.
/// </summary>
/// <param name="endPoint"></param>
/// <param name="endPoint">The explicit endpoint.</param>
public void SetAsSystemHttpProxy(ExplicitProxyEndPoint endPoint)
{
SetAsSystemProxy(endPoint, ProxyProtocolType.Http);
......@@ -329,7 +331,7 @@ namespace Titanium.Web.Proxy
/// <summary>
/// Set the given explicit end point as the default proxy server for current machine.
/// </summary>
/// <param name="endPoint"></param>
/// <param name="endPoint">The explicit endpoint.</param>
public void SetAsSystemHttpsProxy(ExplicitProxyEndPoint endPoint)
{
SetAsSystemProxy(endPoint, ProxyProtocolType.Https);
......@@ -338,8 +340,8 @@ namespace Titanium.Web.Proxy
/// <summary>
/// Set the given explicit end point as the default proxy server for current machine.
/// </summary>
/// <param name="endPoint"></param>
/// <param name="protocolType"></param>
/// <param name="endPoint">The explicit endpoint.</param>
/// <param name="protocolType">The proxy protocol type.</param>
public void SetAsSystemProxy(ExplicitProxyEndPoint endPoint, ProxyProtocolType protocolType)
{
if (RunTime.IsRunningOnMono)
......@@ -472,7 +474,7 @@ namespace Titanium.Web.Proxy
}
// clear any system proxy settings which is pointing to our own endpoint (causing a cycle)
// due to non gracious proxy shutdown before or something else
// due to ungracious proxy shutdown before or something else
if (systemProxySettingsManager != null && RunTime.IsWindows)
{
var proxyInfo = systemProxySettingsManager.GetProxyInfoFromRegistry();
......@@ -604,6 +606,8 @@ namespace Titanium.Web.Proxy
/// <summary>
/// Gets the system up stream proxy.
/// </summary>
/// <param name="sessionEventArgs">The session.</param>
/// <returns>The external proxy as task result.</returns>
private Task<ExternalProxy> GetSystemUpStreamProxy(SessionEventArgsBase sessionEventArgs)
{
var proxy = systemProxyResolver.GetProxy(sessionEventArgs.WebSession.Request.RequestUri);
......@@ -645,6 +649,12 @@ namespace Titanium.Web.Proxy
endPoint.Listener.BeginAcceptTcpClient(OnAcceptConnection, endPoint);
}
/// <summary>
/// Handle the client.
/// </summary>
/// <param name="tcpClient">The client.</param>
/// <param name="endPoint">The proxy endpoint.</param>
/// <returns>The task.</returns>
private async Task HandleClient(TcpClient tcpClient, ProxyEndPoint endPoint)
{
tcpClient.ReceiveTimeout = ConnectionTimeOutSeconds * 1000;
......@@ -663,6 +673,11 @@ namespace Titanium.Web.Proxy
}
}
/// <summary>
/// Handle exception.
/// </summary>
/// <param name="clientStream">The client stream.</param>
/// <param name="exception">The exception.</param>
private void OnException(CustomBufferedStream clientStream, Exception exception)
{
#if DEBUG
......@@ -687,7 +702,7 @@ namespace Titanium.Web.Proxy
/// <summary>
/// Update client connection count.
/// </summary>
/// <param name="increment"></param>
/// <param name="increment">Should we increment/decrement?</param>
internal void UpdateClientConnectionCount(bool increment)
{
if (increment)
......@@ -705,7 +720,7 @@ namespace Titanium.Web.Proxy
/// <summary>
/// Update server connection count.
/// </summary>
/// <param name="increment"></param>
/// <param name="increment">Should we increment/decrement?</param>
internal void UpdateServerConnectionCount(bool increment)
{
if (increment)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment