Commit 348e1b37 authored by justcoding121's avatar justcoding121

Update documentation

parent fe9de696
......@@ -2,5 +2,12 @@
namespace Titanium.Web.Proxy.EventArguments
{
/// <summary>
/// A generic asynchronous event handler used by this proxy.
/// </summary>
/// <typeparam name="TEventArgs"></typeparam>
/// <param name="sender">The proxy server instance.</param>
/// <param name="e">The event arguments.</param>
/// <returns></returns>
public delegate Task AsyncEventHandler<in TEventArgs>(object sender, TEventArgs e);
}
......@@ -3,6 +3,9 @@ using System.Threading;
namespace Titanium.Web.Proxy.EventArguments
{
/// <summary>
/// This is used in transparent endpoint before authenticating client.
/// </summary>
public class BeforeSslAuthenticateEventArgs : EventArgs
{
internal readonly CancellationTokenSource TaskCancellationSource;
......@@ -12,10 +15,21 @@ namespace Titanium.Web.Proxy.EventArguments
TaskCancellationSource = taskCancellationSource;
}
/// <summary>
/// The server name indication hostname.
/// </summary>
public string SniHostName { get; internal set; }
/// <summary>
/// Should we decrypt the SSL request?
/// If true we decrypt with fake certificate.
/// If false we relay the connection to the hostname mentioned in SniHostname.
/// </summary>
public bool DecryptSsl { get; set; } = true;
/// <summary>
/// Terminate the request abruptly.
/// </summary>
public void TerminateSession()
{
TaskCancellationSource.Cancel();
......
......@@ -4,37 +4,37 @@ using System.Security.Cryptography.X509Certificates;
namespace Titanium.Web.Proxy.EventArguments
{
/// <summary>
/// An argument passed on to user for client certificate selection during mutual SSL authentication
/// An argument passed on to user for client certificate selection during mutual SSL authentication.
/// </summary>
public class CertificateSelectionEventArgs : EventArgs
{
/// <summary>
/// Sender object.
/// The proxy server instance.
/// </summary>
public object Sender { get; internal set; }
/// <summary>
/// Target host.
/// The host to which we are authenticating against.
/// </summary>
public string TargetHost { get; internal set; }
/// <summary>
/// Local certificates.
/// Local certificates with matching issuers.
/// </summary>
public X509CertificateCollection LocalCertificates { get; internal set; }
/// <summary>
/// Remote certificate.
/// Remote certificate of the server.
/// </summary>
public X509Certificate RemoteCertificate { get; internal set; }
/// <summary>
/// Acceptable issuers.
/// Acceptable issuers mentioned by server.
/// </summary>
public string[] AcceptableIssuers { get; internal set; }
/// <summary>
/// Client Certificate.
/// Client Certificate we selected.
/// </summary>
public X509Certificate ClientCertificate { get; set; }
}
......
......@@ -5,17 +5,18 @@ using System.Security.Cryptography.X509Certificates;
namespace Titanium.Web.Proxy.EventArguments
{
/// <summary>
/// An argument passed on to the user for validating the server certificate during SSL authentication
/// An argument passed on to the user for validating the server certificate
/// during SSL authentication.
/// </summary>
public class CertificateValidationEventArgs : EventArgs
{
/// <summary>
/// Certificate
/// Server certificate.
/// </summary>
public X509Certificate Certificate { get; internal set; }
/// <summary>
/// Certificate chain
/// Certificate chain.
/// </summary>
public X509Chain Chain { get; internal set; }
......@@ -25,7 +26,7 @@ namespace Titanium.Web.Proxy.EventArguments
public SslPolicyErrors SslPolicyErrors { get; internal set; }
/// <summary>
/// is a valid certificate?
/// Is the given server certificate is valid?
/// </summary>
public bool IsValid { get; set; }
}
......
......@@ -2,6 +2,9 @@ using System;
namespace Titanium.Web.Proxy.EventArguments
{
/// <summary>
/// Wraps the data sent/received by a proxy server instance.
/// </summary>
public class DataEventArgs : EventArgs
{
internal DataEventArgs(byte[] buffer, int offset, int count)
......@@ -11,10 +14,19 @@ namespace Titanium.Web.Proxy.EventArguments
Count = count;
}
/// <summary>
/// The buffer with data.
/// </summary>
public byte[] Buffer { get; }
/// <summary>
/// Offset in Buffer where valid data begins.
/// </summary>
public int Offset { get; }
/// <summary>
/// Length from offset in Buffer with valid data.
/// </summary>
public int Count { get; }
}
}
......@@ -3,6 +3,9 @@ using Titanium.Web.Proxy.Http;
namespace Titanium.Web.Proxy.EventArguments
{
/// <summary>
/// Class that wraps the multipart sent request arguments.
/// </summary>
public class MultipartRequestPartSentEventArgs : EventArgs
{
public MultipartRequestPartSentEventArgs(string boundary, HeaderCollection headers)
......@@ -11,8 +14,14 @@ namespace Titanium.Web.Proxy.EventArguments
Headers = headers;
}
/// <summary>
/// Boundary
/// </summary>
public string Boundary { get; }
/// <summary>
/// The header collection.
/// </summary>
public HeaderCollection Headers { get; }
}
}
......@@ -15,10 +15,10 @@ using Titanium.Web.Proxy.Models;
namespace Titanium.Web.Proxy.EventArguments
{
/// <summary>
/// Holds info related to a single proxy session (single request/response sequence)
/// A proxy session is bounded to a single connection from client
/// 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
/// or when server terminates connection from proxy.
/// </summary>
public class SessionEventArgs : SessionEventArgsBase
{
......@@ -47,7 +47,7 @@ namespace Titanium.Web.Proxy.EventArguments
private bool hasMulipartEventSubscribers => MultipartRequestPartSent != null;
/// <summary>
/// Should we send the request again
/// Should we send the request again ?
/// </summary>
public bool ReRequest
{
......@@ -346,9 +346,10 @@ namespace Titanium.Web.Proxy.EventArguments
}
/// <summary>
/// Gets the request body as bytes
/// Gets the request body as bytes.
/// </summary>
/// <returns></returns>
/// <param name="cancellationToken"></param>
/// <returns>The body as bytes.</returns>
public async Task<byte[]> GetRequestBody(CancellationToken cancellationToken = default)
{
if (!WebSession.Request.IsBodyRead)
......@@ -360,9 +361,10 @@ namespace Titanium.Web.Proxy.EventArguments
}
/// <summary>
/// Gets the request body as string
/// Gets the request body as string.
/// </summary>
/// <returns></returns>
/// <param name="cancellationToken">Cancellation token for this async task is optional.</param>
/// <returns>The body as string.</returns>
public async Task<string> GetRequestBodyAsString(CancellationToken cancellationToken = default)
{
if (!WebSession.Request.IsBodyRead)
......@@ -374,9 +376,9 @@ namespace Titanium.Web.Proxy.EventArguments
}
/// <summary>
/// Sets the request body
/// Sets the request body.
/// </summary>
/// <param name="body"></param>
/// <param name="body">The request body bytes.</param>
public void SetRequestBody(byte[] body)
{
var request = WebSession.Request;
......@@ -389,9 +391,9 @@ namespace Titanium.Web.Proxy.EventArguments
}
/// <summary>
/// Sets the body with the specified string
/// Sets the body with the specified string.
/// </summary>
/// <param name="body"></param>
/// <param name="body">The request body string to set.</param>
public void SetRequestBodyString(string body)
{
if (WebSession.Request.Locked)
......@@ -403,7 +405,7 @@ namespace Titanium.Web.Proxy.EventArguments
}
/// <summary>
/// Gets the response body as byte array
/// Gets the response body as bytes.
/// </summary>
/// <returns></returns>
public async Task<byte[]> GetResponseBody(CancellationToken cancellationToken = default)
......@@ -417,9 +419,9 @@ namespace Titanium.Web.Proxy.EventArguments
}
/// <summary>
/// Gets the response body as string
/// Gets the response body as string.
/// </summary>
/// <returns></returns>
/// <returns>The string body.</returns>
public async Task<string> GetResponseBodyAsString(CancellationToken cancellationToken = default)
{
if (!WebSession.Response.IsBodyRead)
......@@ -431,7 +433,7 @@ namespace Titanium.Web.Proxy.EventArguments
}
/// <summary>
/// Set the response body bytes
/// Set the response body bytes.
/// </summary>
/// <param name="body"></param>
public void SetResponseBody(byte[] body)
......@@ -446,7 +448,7 @@ namespace Titanium.Web.Proxy.EventArguments
}
/// <summary>
/// Replace the response body with the specified string
/// Replace the response body with the specified string.
/// </summary>
/// <param name="body"></param>
public void SetResponseBodyString(string body)
......@@ -462,9 +464,8 @@ namespace Titanium.Web.Proxy.EventArguments
}
/// <summary>
/// Before request is made to server
/// Respond with the specified HTML string to client
/// and ignore the request
/// Before request is made to server respond with the specified HTML string to client
/// and ignore the request.
/// </summary>
/// <param name="html"></param>
/// <param name="headers"></param>
......@@ -483,9 +484,8 @@ namespace Titanium.Web.Proxy.EventArguments
}
/// <summary>
/// Before request is made to server
/// Respond with the specified byte[] to client
/// and ignore the request
/// Before request is made to server respond with the specified byte[] to client
/// and ignore the request.
/// </summary>
/// <param name="result"></param>
/// <param name="headers"></param>
......@@ -501,9 +501,8 @@ namespace Titanium.Web.Proxy.EventArguments
/// <summary>
/// Before request is made to server 
/// Respond with the specified HTML string to client
/// and the specified status
/// and ignore the request 
/// respond with the specified HTML string and the specified status to client.
/// And then ignore the request. 
/// </summary>
/// <param name="html"></param>
/// <param name="status"></param>
......@@ -520,10 +519,8 @@ namespace Titanium.Web.Proxy.EventArguments
}
/// <summary>
/// Before request is made to server
/// Respond with the specified byte[] to client
/// and the specified status
/// and ignore the request
/// Before request is made to server respond with the specified byte[],
/// the specified status to client. And then ignore the request.
/// </summary>
/// <param name="result"></param>
/// <param name="status"></param>
......@@ -540,7 +537,7 @@ namespace Titanium.Web.Proxy.EventArguments
}
/// <summary>
/// Redirect to URL.
/// Redirect to provided URL.
/// </summary>
/// <param name="url"></param>
/// <returns></returns>
......
......@@ -2,5 +2,9 @@ using System;
namespace Titanium.Web.Proxy
{
/// <summary>
/// A delegate to catch exceptions occuring in proxy.
/// </summary>
/// <param name="exception">The exception occurred in proxy.</param>
public delegate void ExceptionHandler(Exception exception);
}
This diff is collapsed.
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