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.
Implements
Inherited Members
Namespace: Titanium.Web.Proxy.EventArguments
Assembly: Titanium.Web.Proxy.dll
Syntax
public class SessionEventArgs : SessionEventArgsBase, IDisposable
Properties
| Improve this Doc View SourceIsPromise
Is this session a HTTP/2 promise?
Declaration
public bool IsPromise { get; }
Property Value
Type | Description |
---|---|
Boolean |
ReRequest
Should we send the request again ?
Declaration
public bool ReRequest { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
WebSocketDecoder
Declaration
[Obsolete("Use [WebSocketDecoderReceive] instead")]
public WebSocketDecoder WebSocketDecoder { get; }
Property Value
Type | Description |
---|---|
WebSocketDecoder |
WebSocketDecoderReceive
Declaration
public WebSocketDecoder WebSocketDecoderReceive { get; }
Property Value
Type | Description |
---|---|
WebSocketDecoder |
WebSocketDecoderSend
Declaration
public WebSocketDecoder WebSocketDecoderSend { get; }
Property Value
Type | Description |
---|---|
WebSocketDecoder |
Methods
| Improve this Doc View SourceDispose(Boolean)
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposing |
Overrides
| Improve this Doc View SourceFinalize()
Declaration
protected void Finalize()
GenericResponse(Byte[], HttpStatusCode, IDictionary<String, HttpHeader>, 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, IDictionary<string, HttpHeader> headers, bool closeServerConnection = false)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | result | The bytes to sent. |
HttpStatusCode | status | The HTTP status code. |
IDictionary<String, HttpHeader> | headers | The HTTP headers. |
Boolean | closeServerConnection | Close the server connection used by request if any? |
GenericResponse(Byte[], HttpStatusCode, IEnumerable<HttpHeader>, 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, IEnumerable<HttpHeader> headers, bool closeServerConnection = false)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | result | The bytes to sent. |
HttpStatusCode | status | The HTTP status code. |
IEnumerable<HttpHeader> | headers | The HTTP headers. |
Boolean | closeServerConnection | Close the server connection used by request if any? |
GenericResponse(String, HttpStatusCode, IDictionary<String, HttpHeader>, 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, IDictionary<string, HttpHeader> headers, bool closeServerConnection = false)
Parameters
Type | Name | Description |
---|---|---|
String | html | The html content. |
HttpStatusCode | status | The HTTP status code. |
IDictionary<String, HttpHeader> | headers | The HTTP headers. |
Boolean | closeServerConnection | Close the server connection used by request if any? |
GenericResponse(String, HttpStatusCode, IEnumerable<HttpHeader>, 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, IEnumerable<HttpHeader> headers = null, bool closeServerConnection = false)
Parameters
Type | Name | Description |
---|---|---|
String | html | The html content. |
HttpStatusCode | status | The HTTP status code. |
IEnumerable<HttpHeader> | headers | The HTTP headers. |
Boolean | closeServerConnection | Close the server connection used by request if any? |
GetRequestBody(CancellationToken)
Gets the request body as bytes.
Declaration
public async Task<byte[]> 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. |
GetRequestBodyAsString(CancellationToken)
Gets the request body as string.
Declaration
public async Task<string> 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. |
GetResponseBody(CancellationToken)
Gets the response body as bytes.
Declaration
public async Task<byte[]> 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. |
GetResponseBodyAsString(CancellationToken)
Gets the response body as string.
Declaration
public async Task<string> 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. |
Ok(Byte[], IDictionary<String, HttpHeader>, Boolean)
Before request is made to server respond with the specified byte[] to client and ignore the request.
Declaration
public void Ok(byte[] result, IDictionary<string, HttpHeader> headers, bool closeServerConnection = false)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | result | The html content bytes. |
IDictionary<String, HttpHeader> | headers | The HTTP headers. |
Boolean | closeServerConnection | Close the server connection used by request if any? |
Ok(Byte[], IEnumerable<HttpHeader>, Boolean)
Before request is made to server respond with the specified byte[] to client and ignore the request.
Declaration
public void Ok(byte[] result, IEnumerable<HttpHeader> headers = null, bool closeServerConnection = false)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | result | The html content bytes. |
IEnumerable<HttpHeader> | headers | The HTTP headers. |
Boolean | closeServerConnection | Close the server connection used by request if any? |
Ok(String, IDictionary<String, HttpHeader>, 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, IDictionary<string, HttpHeader> headers, bool closeServerConnection = false)
Parameters
Type | Name | Description |
---|---|---|
String | html | HTML content to sent. |
IDictionary<String, HttpHeader> | headers | HTTP response headers. |
Boolean | closeServerConnection | Close the server connection used by request if any? |
Ok(String, IEnumerable<HttpHeader>, 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, IEnumerable<HttpHeader> headers = null, bool closeServerConnection = false)
Parameters
Type | Name | Description |
---|---|---|
String | html | HTML content to sent. |
IEnumerable<HttpHeader> | headers | HTTP response headers. |
Boolean | closeServerConnection | Close the server connection used by request if any? |
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? |
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? |
SetRequestBody(Byte[])
Sets the request body.
Declaration
public void SetRequestBody(byte[] body)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | body | The request body bytes. |
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. |
SetResponseBody(Byte[])
Set the response body bytes.
Declaration
public void SetResponseBody(byte[] body)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | body | The body bytes to set. |
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. |
TerminateServerConnection()
Terminate the connection to server at the end of this HTTP request/response session.
Declaration
public void TerminateServerConnection()
Events
| Improve this Doc View SourceMultipartRequestPartSent
Occurs when multipart request part sent.
Declaration
public event EventHandler<MultipartRequestPartSentEventArgs> MultipartRequestPartSent
Event Type
Type | Description |
---|---|
EventHandler<MultipartRequestPartSentEventArgs> |