Skip to content
This repository was archived by the owner on Jul 9, 2023. It is now read-only.

Commit de42d9b

Browse files
committed
add descriptions to public API metadata
1 parent f284e4f commit de42d9b

30 files changed

+278
-223
lines changed

Titanium.Web.Proxy/Compression/CompressionFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ internal static class CompressionFactory
1212
private static readonly ICompression gzip = new GZipCompression();
1313
private static readonly ICompression deflate = new DeflateCompression();
1414

15-
public static ICompression GetCompression(string type)
15+
internal static ICompression GetCompression(string type)
1616
{
1717
switch (type)
1818
{

Titanium.Web.Proxy/Decompression/DecompressionFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ internal class DecompressionFactory
1313

1414
private static readonly IDecompression deflate = new DeflateDecompression();
1515

16-
public static IDecompression Create(string type)
16+
internal static IDecompression Create(string type)
1717
{
1818
switch (type)
1919
{

Titanium.Web.Proxy/EventArguments/AsyncEventHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace Titanium.Web.Proxy.EventArguments
44
{
55
/// <summary>
6-
/// A generic asynchronous event handler used by this proxy.
6+
/// A generic asynchronous event handler used by the proxy.
77
/// </summary>
8-
/// <typeparam name="TEventArgs"></typeparam>
8+
/// <typeparam name="TEventArgs">Event argument type.</typeparam>
99
/// <param name="sender">The proxy server instance.</param>
1010
/// <param name="e">The event arguments.</param>
1111
/// <returns></returns>

Titanium.Web.Proxy/EventArguments/BeforeSslAuthenticateEventArgs.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ internal BeforeSslAuthenticateEventArgs(CancellationTokenSource taskCancellation
1616
}
1717

1818
/// <summary>
19-
/// The server name indication hostname.
19+
/// The server name indication hostname if available. Otherwise the generic certificate hostname of TransparentEndPoint.
2020
/// </summary>
2121
public string SniHostName { get; internal set; }
2222

@@ -28,7 +28,7 @@ internal BeforeSslAuthenticateEventArgs(CancellationTokenSource taskCancellation
2828
public bool DecryptSsl { get; set; } = true;
2929

3030
/// <summary>
31-
/// Terminate the request abruptly.
31+
/// Terminate the request abruptly by closing client/server connections.
3232
/// </summary>
3333
public void TerminateSession()
3434
{

Titanium.Web.Proxy/EventArguments/CertificateSelectionEventArgs.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,27 @@ public class CertificateSelectionEventArgs : EventArgs
1414
public object Sender { get; internal set; }
1515

1616
/// <summary>
17-
/// The host to which we are authenticating against.
17+
/// The remote hostname to which we are authenticating against.
1818
/// </summary>
1919
public string TargetHost { get; internal set; }
2020

2121
/// <summary>
22-
/// Local certificates with matching issuers.
22+
/// Local certificates in store with matching issuers requested by TargetHost website.
2323
/// </summary>
2424
public X509CertificateCollection LocalCertificates { get; internal set; }
2525

2626
/// <summary>
27-
/// Remote certificate of the server.
27+
/// Certificate of the remote server.
2828
/// </summary>
2929
public X509Certificate RemoteCertificate { get; internal set; }
3030

3131
/// <summary>
32-
/// Acceptable issuers mentioned by server.
32+
/// Acceptable issuers as listed by remoted server.
3333
/// </summary>
3434
public string[] AcceptableIssuers { get; internal set; }
3535

3636
/// <summary>
37-
/// Client Certificate we selected.
37+
/// Client Certificate we selected. Set this value to override.
3838
/// </summary>
3939
public X509Certificate ClientCertificate { get; set; }
4040
}

Titanium.Web.Proxy/EventArguments/CertificateValidationEventArgs.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class CertificateValidationEventArgs : EventArgs
2626
public SslPolicyErrors SslPolicyErrors { get; internal set; }
2727

2828
/// <summary>
29-
/// Is the given server certificate is valid?
29+
/// Is the given server certificate valid?
3030
/// </summary>
3131
public bool IsValid { get; set; }
3232
}

Titanium.Web.Proxy/EventArguments/DataEventArgs.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ internal DataEventArgs(byte[] buffer, int offset, int count)
2020
public byte[] Buffer { get; }
2121

2222
/// <summary>
23-
/// Offset in Buffer where valid data begins.
23+
/// Offset in buffer from which valid data begins.
2424
/// </summary>
2525
public int Offset { get; }
2626

2727
/// <summary>
28-
/// Length from offset in Buffer with valid data.
28+
/// Length from offset in buffer with valid data.
2929
/// </summary>
3030
public int Count { get; }
3131
}

Titanium.Web.Proxy/EventArguments/LimitedStream.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ private void GetNextChunk()
5454
readChunkTrail = true;
5555

5656
string chunkHead = baseReader.ReadLineAsync().Result;
57-
int idx = chunkHead.IndexOf(";");
57+
int idx = chunkHead.IndexOf(";", StringComparison.Ordinal);
5858
if (idx >= 0)
5959
{
6060
chunkHead = chunkHead.Substring(0, idx);
@@ -68,7 +68,7 @@ private void GetNextChunk()
6868
bytesRemaining = -1;
6969

7070
//chunk trail
71-
string s = baseReader.ReadLineAsync().Result;
71+
baseReader.ReadLineAsync().Wait();
7272
}
7373
}
7474

Titanium.Web.Proxy/EventArguments/MultipartRequestPartSentEventArgs.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ namespace Titanium.Web.Proxy.EventArguments
88
/// </summary>
99
public class MultipartRequestPartSentEventArgs : EventArgs
1010
{
11-
public MultipartRequestPartSentEventArgs(string boundary, HeaderCollection headers)
11+
internal MultipartRequestPartSentEventArgs(string boundary, HeaderCollection headers)
1212
{
1313
Boundary = boundary;
1414
Headers = headers;
1515
}
1616

1717
/// <summary>
18-
/// Boundary
18+
/// Boundary.
1919
/// </summary>
2020
public string Boundary { get; }
2121

Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ private async Task<long> ReadUntilBoundaryAsync(CustomBinaryReader reader, long
348348
/// <summary>
349349
/// Gets the request body as bytes.
350350
/// </summary>
351-
/// <param name="cancellationToken"></param>
351+
/// <param name="cancellationToken">Optional cancellation token for this async task.</param>
352352
/// <returns>The body as bytes.</returns>
353353
public async Task<byte[]> GetRequestBody(CancellationToken cancellationToken = default)
354354
{
@@ -363,7 +363,7 @@ public async Task<byte[]> GetRequestBody(CancellationToken cancellationToken = d
363363
/// <summary>
364364
/// Gets the request body as string.
365365
/// </summary>
366-
/// <param name="cancellationToken">Cancellation token for this async task is optional.</param>
366+
/// <param name="cancellationToken">Optional cancellation token for this async task.</param>
367367
/// <returns>The body as string.</returns>
368368
public async Task<string> GetRequestBodyAsString(CancellationToken cancellationToken = default)
369369
{
@@ -404,10 +404,12 @@ public void SetRequestBodyString(string body)
404404
SetRequestBody(WebSession.Request.Encoding.GetBytes(body));
405405
}
406406

407+
407408
/// <summary>
408409
/// Gets the response body as bytes.
409410
/// </summary>
410-
/// <returns></returns>
411+
/// <param name="cancellationToken">Optional cancellation token for this async task.</param>
412+
/// <returns>The resulting bytes.</returns>
411413
public async Task<byte[]> GetResponseBody(CancellationToken cancellationToken = default)
412414
{
413415
if (!WebSession.Response.IsBodyRead)
@@ -421,6 +423,7 @@ public async Task<byte[]> GetResponseBody(CancellationToken cancellationToken =
421423
/// <summary>
422424
/// Gets the response body as string.
423425
/// </summary>
426+
/// <param name="cancellationToken">Optional cancellation token for this async task.</param>
424427
/// <returns>The string body.</returns>
425428
public async Task<string> GetResponseBodyAsString(CancellationToken cancellationToken = default)
426429
{
@@ -435,7 +438,7 @@ public async Task<string> GetResponseBodyAsString(CancellationToken cancellation
435438
/// <summary>
436439
/// Set the response body bytes.
437440
/// </summary>
438-
/// <param name="body"></param>
441+
/// <param name="body">The body bytes to set.</param>
439442
public void SetResponseBody(byte[] body)
440443
{
441444
if (!WebSession.Request.Locked)
@@ -450,7 +453,7 @@ public void SetResponseBody(byte[] body)
450453
/// <summary>
451454
/// Replace the response body with the specified string.
452455
/// </summary>
453-
/// <param name="body"></param>
456+
/// <param name="body">The body string to set.</param>
454457
public void SetResponseBodyString(string body)
455458
{
456459
if (!WebSession.Request.Locked)
@@ -467,8 +470,8 @@ public void SetResponseBodyString(string body)
467470
/// Before request is made to server respond with the specified HTML string to client
468471
/// and ignore the request.
469472
/// </summary>
470-
/// <param name="html"></param>
471-
/// <param name="headers"></param>
473+
/// <param name="html">HTML content to sent.</param>
474+
/// <param name="headers">HTTP response headers.</param>
472475
public void Ok(string html, Dictionary<string, HttpHeader> headers = null)
473476
{
474477
var response = new OkResponse();
@@ -487,8 +490,8 @@ public void Ok(string html, Dictionary<string, HttpHeader> headers = null)
487490
/// Before request is made to server respond with the specified byte[] to client
488491
/// and ignore the request.
489492
/// </summary>
490-
/// <param name="result"></param>
491-
/// <param name="headers"></param>
493+
/// <param name="result">The html content bytes.</param>
494+
/// <param name="headers">The HTTP headers.</param>
492495
public void Ok(byte[] result, Dictionary<string, HttpHeader> headers = null)
493496
{
494497
var response = new OkResponse();
@@ -504,9 +507,9 @@ public void Ok(byte[] result, Dictionary<string, HttpHeader> headers = null)
504507
/// respond with the specified HTML string and the specified status to client.
505508
/// And then ignore the request. 
506509
/// </summary>
507-
/// <param name="html"></param>
508-
/// <param name="status"></param>
509-
/// <param name="headers"></param>
510+
/// <param name="html">The html content.</param>
511+
/// <param name="status">The HTTP status code.</param>
512+
/// <param name="headers">The HTTP headers.</param>
510513
/// <returns></returns>
511514
public void GenericResponse(string html, HttpStatusCode status, Dictionary<string, HttpHeader> headers = null)
512515
{
@@ -522,9 +525,9 @@ public void GenericResponse(string html, HttpStatusCode status, Dictionary<strin
522525
/// Before request is made to server respond with the specified byte[],
523526
/// the specified status to client. And then ignore the request.
524527
/// </summary>
525-
/// <param name="result"></param>
526-
/// <param name="status"></param>
527-
/// <param name="headers"></param>
528+
/// <param name="result">The bytes to sent.</param>
529+
/// <param name="status">The HTTP status code.</param>
530+
/// <param name="headers">The HTTP headers.</param>
528531
/// <returns></returns>
529532
public void GenericResponse(byte[] result, HttpStatusCode status, Dictionary<string, HttpHeader> headers)
530533
{
@@ -539,7 +542,7 @@ public void GenericResponse(byte[] result, HttpStatusCode status, Dictionary<str
539542
/// <summary>
540543
/// Redirect to provided URL.
541544
/// </summary>
542-
/// <param name="url"></param>
545+
/// <param name="url">The URL to redirect.</param>
543546
/// <returns></returns>
544547
public void Redirect(string url)
545548
{
@@ -551,7 +554,10 @@ public void Redirect(string url)
551554
Respond(response);
552555
}
553556

554-
/// a generic responder method
557+
/// <summary>
558+
/// Respond with given response object to client.
559+
/// </summary>
560+
/// <param name="response">The response object.</param>
555561
public void Respond(Response response)
556562
{
557563
if (WebSession.Request.Locked)
@@ -576,13 +582,16 @@ public void Respond(Response response)
576582
}
577583
}
578584

585+
/// <summary>
586+
/// Terminate the connection to server.
587+
/// </summary>
579588
public void TerminateServerConnection()
580589
{
581590
WebSession.Response.TerminateResponse = true;
582591
}
583592

584593
/// <summary>
585-
/// implement any cleanup here
594+
/// Implement any cleanup here
586595
/// </summary>
587596
public override void Dispose()
588597
{

0 commit comments

Comments
 (0)