Commit 8580aaac authored by ilushka85's avatar ilushka85

Merge remote-tracking branch 'origin/release'

Conflicts:
	Titanium.Web.Proxy/ProxyServer.cs
parents 47c487e8 f212d2c6
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Titanium.Web.Proxy.Exceptions;
......@@ -335,7 +336,6 @@ namespace Titanium.Web.Proxy.EventArguments
return await decompressor.Decompress(responseBodyStream, bufferSize);
}
/// <summary>
/// Before request is made to server
/// Respond with the specified HTML string to client
......@@ -343,6 +343,18 @@ namespace Titanium.Web.Proxy.EventArguments
/// </summary>
/// <param name="html"></param>
public async Task Ok(string html)
{
await Ok(html, null);
}
/// <summary>
/// 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>
public async Task Ok(string html, Dictionary<string, HttpHeader> headers)
{
if (WebSession.Request.RequestLocked)
{
......@@ -356,7 +368,7 @@ namespace Titanium.Web.Proxy.EventArguments
var result = Encoding.Default.GetBytes(html);
await Ok(result);
await Ok(result, headers);
}
/// <summary>
......@@ -364,11 +376,26 @@ namespace Titanium.Web.Proxy.EventArguments
/// Respond with the specified byte[] to client
/// and ignore the request
/// </summary>
/// <param name="body"></param>
/// <param name="result"></param>
public async Task Ok(byte[] result)
{
var response = new OkResponse();
await Ok(result, null);
}
/// <summary>
/// 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>
public async Task Ok(byte[] result, Dictionary<string, HttpHeader> headers)
{
var response = new OkResponse();
if (headers != null && headers.Count > 0)
{
response.ResponseHeaders = headers;
}
response.HttpVersion = WebSession.Request.HttpVersion;
response.ResponseBody = result;
......
......@@ -138,8 +138,12 @@ namespace Titanium.Web.Proxy
/// <summary>
/// Constructor
/// </summary>
public ProxyServer()
public ProxyServer() : this(null, null) { }
public ProxyServer(string rootCertificateName, string rootCertificateIssuerName)
{
RootCertificateName = rootCertificateName;
RootCertificateIssuerName = rootCertificateIssuerName;
//default values
ConnectionTimeOutSeconds = 120;
CertificateCacheTimeOutMinutes = 60;
......@@ -415,6 +419,7 @@ namespace Titanium.Web.Proxy
await HandleClient(endPoint as ExplicitProxyEndPoint, tcpClient);
}
}
finally
{
......
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