Unverified Commit 6149ed65 authored by honfika's avatar honfika Committed by GitHub

Merge pull request #722 from justcoding121/master

beta
parents 500ceade 6db82ba8
...@@ -15,6 +15,7 @@ Kindly report only issues/bugs here. For programming help or questions use [Stac ...@@ -15,6 +15,7 @@ Kindly report only issues/bugs here. For programming help or questions use [Stac
* View/modify/redirect/block requests and responses * View/modify/redirect/block requests and responses
* Supports mutual SSL authentication, proxy authentication & automatic upstream proxy detection * Supports mutual SSL authentication, proxy authentication & automatic upstream proxy detection
* Kerberos/NTLM authentication over HTTP protocols for windows domain * Kerberos/NTLM authentication over HTTP protocols for windows domain
* SOCKS4/5 Proxy support
### Installation ### Installation
Install by [nuget](https://www.nuget.org/packages/Titanium.Web.Proxy) Install by [nuget](https://www.nuget.org/packages/Titanium.Web.Proxy)
...@@ -29,21 +30,21 @@ For stable releases on [stable branch](https://github.com/justcoding121/Titanium ...@@ -29,21 +30,21 @@ For stable releases on [stable branch](https://github.com/justcoding121/Titanium
Supports Supports
* .Net Standard 2.0 or above * .NET Standard 2.0 or above
* .Net Framework 4.6.1 or above * .NET Framework 4.5 or above
### Development environment ### Development environment
#### Windows #### Windows
* Visual Studio Code as IDE for .NET core * Visual Studio Code as IDE for .NET Core
* Visual Studio 2017/2019 as IDE for .NET framework/.NET core * Visual Studio 2019 as IDE for .NET Framework/.NET Core
#### Mac OS #### Mac OS
* Visual Studio Code as IDE for .NET core * Visual Studio Code as IDE for .NET Core
* Visual Studio 2017 as IDE for Mono * Visual Studio 2019 as IDE for Mono
#### Linux #### Linux
* Visual Studio Code as IDE for .NET core * Visual Studio Code as IDE for .NET Core
* Mono develop as IDE for Mono * Mono develop as IDE for Mono
### Usage ### Usage
...@@ -191,7 +192,7 @@ public async Task OnResponse(object sender, SessionEventArgs e) ...@@ -191,7 +192,7 @@ public async Task OnResponse(object sender, SessionEventArgs e)
{ {
if (e.HttpClient.Response.ResponseStatusCode == "200") if (e.HttpClient.Response.ResponseStatusCode == "200")
{ {
if (e.HttpClient.Response.ContentType!=null && e.HttpClient.Response.ContentType.Trim().ToLower().Contains("text/html")) if (e.HttpClient.Response.ContentType != null && e.HttpClient.Response.ContentType.Trim().ToLower().Contains("text/html"))
{ {
byte[] bodyBytes = await e.GetResponseBody(); byte[] bodyBytes = await e.GetResponseBody();
await e.SetResponseBody(bodyBytes); await e.SetResponseBody(bodyBytes);
...@@ -202,7 +203,7 @@ public async Task OnResponse(object sender, SessionEventArgs e) ...@@ -202,7 +203,7 @@ public async Task OnResponse(object sender, SessionEventArgs e)
} }
} }
if (e.UserData!=null) if (e.UserData != null)
{ {
// access request from UserData property where we stored it in RequestHandler // access request from UserData property where we stored it in RequestHandler
var request = (Request)e.UserData; var request = (Request)e.UserData;
...@@ -216,14 +217,14 @@ public Task OnCertificateValidation(object sender, CertificateValidationEventArg ...@@ -216,14 +217,14 @@ public Task OnCertificateValidation(object sender, CertificateValidationEventArg
if (e.SslPolicyErrors == System.Net.Security.SslPolicyErrors.None) if (e.SslPolicyErrors == System.Net.Security.SslPolicyErrors.None)
e.IsValid = true; e.IsValid = true;
return Task.FromResult(0); return Task.CompletedTask;
} }
// Allows overriding default client certificate selection logic during mutual authentication // Allows overriding default client certificate selection logic during mutual authentication
public Task OnCertificateSelection(object sender, CertificateSelectionEventArgs e) public Task OnCertificateSelection(object sender, CertificateSelectionEventArgs e)
{ {
// set e.clientCertificate to override // set e.clientCertificate to override
return Task.FromResult(0); return Task.CompletedTask;
} }
``` ```
### Note to contributors ### Note to contributors
......
...@@ -108,6 +108,10 @@ ...@@ -108,6 +108,10 @@
Default.</p> Default.</p>
</td> </td>
</tr> </tr>
<tr>
<td id="Titanium_Web_Proxy_Network_CertificateEngine_BouncyCastleFast">BouncyCastleFast</td>
<td></td>
</tr>
<tr> <tr>
<td id="Titanium_Web_Proxy_Network_CertificateEngine_DefaultWindows">DefaultWindows</td> <td id="Titanium_Web_Proxy_Network_CertificateEngine_DefaultWindows">DefaultWindows</td>
<td><p>Uses Windows Certification Generation API and only valid in Windows OS. <td><p>Uses Windows Certification Generation API and only valid in Windows OS.
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
"api/Titanium.Web.Proxy.Network.CertificateEngine.html": { "api/Titanium.Web.Proxy.Network.CertificateEngine.html": {
"href": "api/Titanium.Web.Proxy.Network.CertificateEngine.html", "href": "api/Titanium.Web.Proxy.Network.CertificateEngine.html",
"title": "Enum CertificateEngine | Titanium Web Proxy", "title": "Enum CertificateEngine | Titanium Web Proxy",
"keywords": "Enum CertificateEngine Certificate Engine option. Namespace : Titanium.Web.Proxy.Network Assembly : Titanium.Web.Proxy.dll Syntax public enum CertificateEngine Fields Name Description BouncyCastle Uses BouncyCastle 3rd party library. Default. DefaultWindows Uses Windows Certification Generation API and only valid in Windows OS. Observed to be faster than BouncyCastle. Bug #468 Reported." "keywords": "Enum CertificateEngine Certificate Engine option. Namespace : Titanium.Web.Proxy.Network Assembly : Titanium.Web.Proxy.dll Syntax public enum CertificateEngine Fields Name Description BouncyCastle Uses BouncyCastle 3rd party library. Default. BouncyCastleFast DefaultWindows Uses Windows Certification Generation API and only valid in Windows OS. Observed to be faster than BouncyCastle. Bug #468 Reported."
}, },
"api/Titanium.Web.Proxy.Network.CertificateManager.html": { "api/Titanium.Web.Proxy.Network.CertificateManager.html": {
"href": "api/Titanium.Web.Proxy.Network.CertificateManager.html", "href": "api/Titanium.Web.Proxy.Network.CertificateManager.html",
......
...@@ -2913,6 +2913,12 @@ references: ...@@ -2913,6 +2913,12 @@ references:
commentId: F:Titanium.Web.Proxy.Network.CertificateEngine.BouncyCastle commentId: F:Titanium.Web.Proxy.Network.CertificateEngine.BouncyCastle
fullName: Titanium.Web.Proxy.Network.CertificateEngine.BouncyCastle fullName: Titanium.Web.Proxy.Network.CertificateEngine.BouncyCastle
nameWithType: CertificateEngine.BouncyCastle nameWithType: CertificateEngine.BouncyCastle
- uid: Titanium.Web.Proxy.Network.CertificateEngine.BouncyCastleFast
name: BouncyCastleFast
href: api/Titanium.Web.Proxy.Network.CertificateEngine.html#Titanium_Web_Proxy_Network_CertificateEngine_BouncyCastleFast
commentId: F:Titanium.Web.Proxy.Network.CertificateEngine.BouncyCastleFast
fullName: Titanium.Web.Proxy.Network.CertificateEngine.BouncyCastleFast
nameWithType: CertificateEngine.BouncyCastleFast
- uid: Titanium.Web.Proxy.Network.CertificateEngine.DefaultWindows - uid: Titanium.Web.Proxy.Network.CertificateEngine.DefaultWindows
name: DefaultWindows name: DefaultWindows
href: api/Titanium.Web.Proxy.Network.CertificateEngine.html#Titanium_Web_Proxy_Network_CertificateEngine_DefaultWindows href: api/Titanium.Web.Proxy.Network.CertificateEngine.html#Titanium_Web_Proxy_Network_CertificateEngine_DefaultWindows
......
...@@ -44,6 +44,10 @@ namespace Titanium.Web.Proxy.Examples.Basic ...@@ -44,6 +44,10 @@ namespace Titanium.Web.Proxy.Examples.Basic
}; };
proxyServer.ForwardToUpstreamGateway = true; proxyServer.ForwardToUpstreamGateway = true;
proxyServer.CertificateManager.SaveFakeCertificates = true; proxyServer.CertificateManager.SaveFakeCertificates = true;
//proxyServer.ProxyBasicAuthenticateFunc = async (args, userName, password) =>
//{
// return true;
//};
// this is just to show the functionality, provided implementations use junk value // this is just to show the functionality, provided implementations use junk value
//proxyServer.GetCustomUpStreamProxyFunc = onGetCustomUpStreamProxyFunc; //proxyServer.GetCustomUpStreamProxyFunc = onGetCustomUpStreamProxyFunc;
...@@ -94,8 +98,11 @@ namespace Titanium.Web.Proxy.Examples.Basic ...@@ -94,8 +98,11 @@ namespace Titanium.Web.Proxy.Examples.Basic
//proxyServer.UpStreamHttpsProxy = new ExternalProxy("localhost", 8888); //proxyServer.UpStreamHttpsProxy = new ExternalProxy("localhost", 8888);
// SOCKS proxy // SOCKS proxy
//proxyServer.UpStreamHttpProxy = new ExternalProxy("46.63.0.17", 4145) { ProxyType = ExternalProxyType.Socks4 }; //proxyServer.UpStreamHttpProxy = new ExternalProxy("127.0.0.1", 1080)
//proxyServer.UpStreamHttpsProxy = new ExternalProxy("46.63.0.17", 4145) { ProxyType = ExternalProxyType.Socks4 }; // { ProxyType = ExternalProxyType.Socks5, UserName = "User1", Password = "Pass" };
//proxyServer.UpStreamHttpsProxy = new ExternalProxy("127.0.0.1", 1080)
// { ProxyType = ExternalProxyType.Socks5, UserName = "User1", Password = "Pass" };
//var socksEndPoint = new SocksProxyEndPoint(IPAddress.Any, 1080, true) //var socksEndPoint = new SocksProxyEndPoint(IPAddress.Any, 1080, true)
//{ //{
...@@ -167,6 +174,12 @@ namespace Titanium.Web.Proxy.Examples.Basic ...@@ -167,6 +174,12 @@ namespace Titanium.Web.Proxy.Examples.Basic
e.GetState().PipelineInfo.AppendLine(nameof(onBeforeTunnelConnectRequest) + ":" + hostname); e.GetState().PipelineInfo.AppendLine(nameof(onBeforeTunnelConnectRequest) + ":" + hostname);
await writeToConsole("Tunnel to: " + hostname); await writeToConsole("Tunnel to: " + hostname);
var clientLocalIp = e.ClientLocalEndPoint.Address;
if (!clientLocalIp.Equals(IPAddress.Loopback) && !clientLocalIp.Equals(IPAddress.IPv6Loopback))
{
e.HttpClient.UpStreamEndPoint = new IPEndPoint(clientLocalIp, 0);
}
if (hostname.Contains("dropbox.com")) if (hostname.Contains("dropbox.com"))
{ {
// Exclude Https addresses you don't want to proxy // Exclude Https addresses you don't want to proxy
...@@ -212,7 +225,7 @@ namespace Titanium.Web.Proxy.Examples.Basic ...@@ -212,7 +225,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
{ {
e.GetState().PipelineInfo.AppendLine(nameof(onBeforeTunnelConnectResponse) + ":" + e.HttpClient.Request.RequestUri); e.GetState().PipelineInfo.AppendLine(nameof(onBeforeTunnelConnectResponse) + ":" + e.HttpClient.Request.RequestUri);
return Task.FromResult(false); return Task.CompletedTask;
} }
// intercept & cancel redirect or update requests // intercept & cancel redirect or update requests
...@@ -356,7 +369,7 @@ namespace Titanium.Web.Proxy.Examples.Basic ...@@ -356,7 +369,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
e.IsValid = true; e.IsValid = true;
} }
return Task.FromResult(0); return Task.CompletedTask;
} }
/// <summary> /// <summary>
...@@ -370,7 +383,7 @@ namespace Titanium.Web.Proxy.Examples.Basic ...@@ -370,7 +383,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
// set e.clientCertificate to override // set e.clientCertificate to override
return Task.FromResult(0); return Task.CompletedTask;
} }
private async Task writeToConsole(string message, ConsoleColor? consoleColor = null) private async Task writeToConsole(string message, ConsoleColor? consoleColor = null)
......
...@@ -21,7 +21,7 @@ namespace WindowsServiceExample ...@@ -21,7 +21,7 @@ namespace WindowsServiceExample
{ {
// we do all this in here so we can reload settings with a simple restart // we do all this in here so we can reload settings with a simple restart
_proxyServerInstance = new ProxyServer(); _proxyServerInstance = new ProxyServer(false);
if (Properties.Settings.Default.ListeningPort <= 0 || if (Properties.Settings.Default.ListeningPort <= 0 ||
Properties.Settings.Default.ListeningPort > 65535) Properties.Settings.Default.ListeningPort > 65535)
......
...@@ -53,7 +53,7 @@ namespace Titanium.Web.Proxy.EventArguments ...@@ -53,7 +53,7 @@ namespace Titanium.Web.Proxy.EventArguments
{ {
BufferPool = server.BufferPool; BufferPool = server.BufferPool;
ExceptionFunc = server.ExceptionFunc; ExceptionFunc = server.ExceptionFunc;
TimeLine["Session Created"] = DateTime.Now; TimeLine["Session Created"] = DateTime.UtcNow;
CancellationTokenSource = cancellationTokenSource; CancellationTokenSource = cancellationTokenSource;
......
...@@ -92,7 +92,7 @@ namespace Titanium.Web.Proxy.Http ...@@ -92,7 +92,7 @@ namespace Titanium.Web.Proxy.Http
/// <param name="serverConnection">Instance of <see cref="TcpServerConnection" /></param> /// <param name="serverConnection">Instance of <see cref="TcpServerConnection" /></param>
internal void SetConnection(TcpServerConnection serverConnection) internal void SetConnection(TcpServerConnection serverConnection)
{ {
serverConnection.LastAccess = DateTime.Now; serverConnection.LastAccess = DateTime.UtcNow;
connection = serverConnection; connection = serverConnection;
} }
......
...@@ -44,7 +44,6 @@ namespace Titanium.Web.Proxy.Network.Certificate ...@@ -44,7 +44,6 @@ namespace Titanium.Web.Proxy.Network.Certificate
/// Makes the certificate. /// Makes the certificate.
/// </summary> /// </summary>
/// <param name="sSubjectCn">The s subject cn.</param> /// <param name="sSubjectCn">The s subject cn.</param>
/// <param name="isRoot">if set to <c>true</c> [is root].</param>
/// <param name="signingCert">The signing cert.</param> /// <param name="signingCert">The signing cert.</param>
/// <returns>X509Certificate2 instance.</returns> /// <returns>X509Certificate2 instance.</returns>
public X509Certificate2 MakeCertificate(string sSubjectCn, X509Certificate2? signingCert = null) public X509Certificate2 MakeCertificate(string sSubjectCn, X509Certificate2? signingCert = null)
......
...@@ -105,7 +105,7 @@ namespace Titanium.Web.Proxy.Network.Certificate ...@@ -105,7 +105,7 @@ namespace Titanium.Web.Proxy.Network.Certificate
// KeyLength // KeyLength
const int keyLength = 2048; const int keyLength = 2048;
var now = DateTime.Now; var now = DateTime.UtcNow;
var graceTime = now.AddDays(graceDays); var graceTime = now.AddDays(graceDays);
var certificate = makeCertificate(sSubjectCN, fullSubject, keyLength, hashAlgo, graceTime, var certificate = makeCertificate(sSubjectCN, fullSubject, keyLength, hashAlgo, graceTime,
now.AddDays(validDays), signingCertificate); now.AddDays(validDays), signingCertificate);
......
...@@ -24,6 +24,8 @@ namespace Titanium.Web.Proxy.Network ...@@ -24,6 +24,8 @@ namespace Titanium.Web.Proxy.Network
/// </summary> /// </summary>
BouncyCastle = 0, BouncyCastle = 0,
BouncyCastleFast = 2,
/// <summary> /// <summary>
/// Uses Windows Certification Generation API and only valid in Windows OS. /// Uses Windows Certification Generation API and only valid in Windows OS.
/// Observed to be faster than BouncyCastle. /// Observed to be faster than BouncyCastle.
...@@ -68,9 +70,19 @@ namespace Titanium.Web.Proxy.Network ...@@ -68,9 +70,19 @@ namespace Titanium.Web.Proxy.Network
{ {
if (certEngineValue == null) if (certEngineValue == null)
{ {
certEngineValue = engine == CertificateEngine.BouncyCastle switch (engine)
? (ICertificateMaker)new BCCertificateMaker(ExceptionFunc) {
: new WinCertificateMaker(ExceptionFunc); case CertificateEngine.BouncyCastle:
certEngineValue = new BCCertificateMaker(ExceptionFunc);
break;
case CertificateEngine.BouncyCastleFast:
certEngineValue = new BCCertificateMakerFast(ExceptionFunc);
break;
case CertificateEngine.DefaultWindows:
default:
certEngineValue = new WinCertificateMaker(ExceptionFunc);
break;
}
} }
return certEngineValue; return certEngineValue;
...@@ -459,7 +471,7 @@ namespace Titanium.Web.Proxy.Network ...@@ -459,7 +471,7 @@ namespace Titanium.Web.Proxy.Network
// check in cache first // check in cache first
if (cachedCertificates.TryGetValue(certificateName, out var cached)) if (cachedCertificates.TryGetValue(certificateName, out var cached))
{ {
cached.LastAccess = DateTime.Now; cached.LastAccess = DateTime.UtcNow;
return cached.Certificate; return cached.Certificate;
} }
...@@ -498,7 +510,7 @@ namespace Titanium.Web.Proxy.Network ...@@ -498,7 +510,7 @@ namespace Titanium.Web.Proxy.Network
var cancellationToken = clearCertificatesTokenSource.Token; var cancellationToken = clearCertificatesTokenSource.Token;
while (!cancellationToken.IsCancellationRequested) while (!cancellationToken.IsCancellationRequested)
{ {
var cutOff = DateTime.Now.AddMinutes(-CertificateCacheTimeOutMinutes); var cutOff = DateTime.UtcNow.AddMinutes(-CertificateCacheTimeOutMinutes);
var outdated = cachedCertificates.Where(x => x.Value.LastAccess < cutOff).ToList(); var outdated = cachedCertificates.Where(x => x.Value.LastAccess < cutOff).ToList();
......
...@@ -241,7 +241,7 @@ namespace Titanium.Web.Proxy.Network.Tcp ...@@ -241,7 +241,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
if (cache.TryGetValue(cacheKey, out var existingConnections)) if (cache.TryGetValue(cacheKey, out var existingConnections))
{ {
// +3 seconds for potential delay after getting connection // +3 seconds for potential delay after getting connection
var cutOff = DateTime.Now.AddSeconds(-proxyServer.ConnectionTimeOutSeconds + 3); var cutOff = DateTime.UtcNow.AddSeconds(-proxyServer.ConnectionTimeOutSeconds + 3);
while (existingConnections.Count > 0) while (existingConnections.Count > 0)
{ {
if (existingConnections.TryDequeue(out var recentConnection)) if (existingConnections.TryDequeue(out var recentConnection))
...@@ -350,7 +350,7 @@ retry: ...@@ -350,7 +350,7 @@ retry:
if (sessionArgs != null) if (sessionArgs != null)
{ {
sessionArgs.TimeLine["Dns Resolved"] = DateTime.Now; sessionArgs.TimeLine["Dns Resolved"] = DateTime.UtcNow;
} }
Array.Sort(ipAddresses, (x, y) => x.AddressFamily.CompareTo(y.AddressFamily)); Array.Sort(ipAddresses, (x, y) => x.AddressFamily.CompareTo(y.AddressFamily));
...@@ -458,7 +458,7 @@ retry: ...@@ -458,7 +458,7 @@ retry:
if (newUpstreamProxy != null) if (newUpstreamProxy != null)
{ {
sessionArgs.CustomUpStreamProxyUsed = newUpstreamProxy; sessionArgs.CustomUpStreamProxyUsed = newUpstreamProxy;
sessionArgs.TimeLine["Retrying Upstream Proxy Connection"] = DateTime.Now; sessionArgs.TimeLine["Retrying Upstream Proxy Connection"] = DateTime.UtcNow;
return await createServerConnection(remoteHostName, remotePort, httpVersion, isHttps, sslProtocol, applicationProtocols, isConnect, proxyServer, sessionArgs, upStreamEndPoint, externalProxy, cacheKey, cancellationToken); return await createServerConnection(remoteHostName, remotePort, httpVersion, isHttps, sslProtocol, applicationProtocols, isConnect, proxyServer, sessionArgs, upStreamEndPoint, externalProxy, cacheKey, cancellationToken);
} }
} }
...@@ -468,7 +468,7 @@ retry: ...@@ -468,7 +468,7 @@ retry:
if (sessionArgs != null) if (sessionArgs != null)
{ {
sessionArgs.TimeLine["Connection Established"] = DateTime.Now; sessionArgs.TimeLine["Connection Established"] = DateTime.UtcNow;
} }
await proxyServer.InvokeServerConnectionCreateEvent(tcpServerSocket); await proxyServer.InvokeServerConnectionCreateEvent(tcpServerSocket);
...@@ -532,7 +532,7 @@ retry: ...@@ -532,7 +532,7 @@ retry:
if (sessionArgs != null) if (sessionArgs != null)
{ {
sessionArgs.TimeLine["HTTPS Established"] = DateTime.Now; sessionArgs.TimeLine["HTTPS Established"] = DateTime.UtcNow;
} }
} }
} }
...@@ -570,7 +570,7 @@ retry: ...@@ -570,7 +570,7 @@ retry:
return; return;
} }
connection.LastAccess = DateTime.Now; connection.LastAccess = DateTime.UtcNow;
try try
{ {
...@@ -634,7 +634,7 @@ retry: ...@@ -634,7 +634,7 @@ retry:
{ {
try try
{ {
var cutOff = DateTime.Now.AddSeconds(-Server.ConnectionTimeOutSeconds); var cutOff = DateTime.UtcNow.AddSeconds(-Server.ConnectionTimeOutSeconds);
foreach (var item in cache) foreach (var item in cache)
{ {
var queue = item.Value; var queue = item.Value;
......
...@@ -20,7 +20,7 @@ namespace Titanium.Web.Proxy.Network.Tcp ...@@ -20,7 +20,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
Version version, IExternalProxy? upStreamProxy, IPEndPoint? upStreamEndPoint, string cacheKey) Version version, IExternalProxy? upStreamProxy, IPEndPoint? upStreamEndPoint, string cacheKey)
{ {
TcpSocket = tcpSocket; TcpSocket = tcpSocket;
LastAccess = DateTime.Now; LastAccess = DateTime.UtcNow;
this.proxyServer = proxyServer; this.proxyServer = proxyServer;
this.proxyServer.UpdateServerConnectionCount(true); this.proxyServer.UpdateServerConnectionCount(true);
Stream = stream; Stream = stream;
......
...@@ -43,7 +43,7 @@ namespace Titanium.Web.Proxy.Network.WinAuth.Security ...@@ -43,7 +43,7 @@ namespace Titanium.Web.Proxy.Network.WinAuth.Security
Credentials = new Common.SecurityHandle(0); Credentials = new Common.SecurityHandle(0);
Context = new Common.SecurityHandle(0); Context = new Common.SecurityHandle(0);
LastSeen = DateTime.Now; LastSeen = DateTime.UtcNow;
AuthState = WinAuthState.UNAUTHORIZED; AuthState = WinAuthState.UNAUTHORIZED;
} }
...@@ -56,7 +56,7 @@ namespace Titanium.Web.Proxy.Network.WinAuth.Security ...@@ -56,7 +56,7 @@ namespace Titanium.Web.Proxy.Network.WinAuth.Security
internal void UpdatePresence() internal void UpdatePresence()
{ {
LastSeen = DateTime.Now; LastSeen = DateTime.UtcNow;
} }
} }
} }
...@@ -279,7 +279,7 @@ namespace Titanium.Web.Proxy ...@@ -279,7 +279,7 @@ namespace Titanium.Web.Proxy
// set the connection and send request headers // set the connection and send request headers
args.HttpClient.SetConnection(connection); args.HttpClient.SetConnection(connection);
args.TimeLine["Connection Ready"] = DateTime.Now; args.TimeLine["Connection Ready"] = DateTime.UtcNow;
if (args.HttpClient.Request.UpgradeToWebSocket) if (args.HttpClient.Request.UpgradeToWebSocket)
{ {
...@@ -335,7 +335,7 @@ namespace Titanium.Web.Proxy ...@@ -335,7 +335,7 @@ namespace Titanium.Web.Proxy
} }
} }
args.TimeLine["Request Sent"] = DateTime.Now; args.TimeLine["Request Sent"] = DateTime.UtcNow;
// parse and send response // parse and send response
await handleHttpSessionResponse(args); await handleHttpSessionResponse(args);
...@@ -374,7 +374,7 @@ namespace Titanium.Web.Proxy ...@@ -374,7 +374,7 @@ namespace Titanium.Web.Proxy
/// <returns></returns> /// <returns></returns>
private async Task onBeforeRequest(SessionEventArgs args) private async Task onBeforeRequest(SessionEventArgs args)
{ {
args.TimeLine["Request Received"] = DateTime.Now; args.TimeLine["Request Received"] = DateTime.UtcNow;
if (BeforeRequest != null) if (BeforeRequest != null)
{ {
......
...@@ -32,7 +32,7 @@ namespace Titanium.Web.Proxy ...@@ -32,7 +32,7 @@ namespace Titanium.Web.Proxy
await args.HttpClient.ReceiveResponse(cancellationToken); await args.HttpClient.ReceiveResponse(cancellationToken);
} }
args.TimeLine["Response Received"] = DateTime.Now; args.TimeLine["Response Received"] = DateTime.UtcNow;
var response = args.HttpClient.Response; var response = args.HttpClient.Response;
args.ReRequest = false; args.ReRequest = false;
...@@ -122,7 +122,7 @@ namespace Titanium.Web.Proxy ...@@ -122,7 +122,7 @@ namespace Titanium.Web.Proxy
} }
} }
args.TimeLine["Response Sent"] = DateTime.Now; args.TimeLine["Response Sent"] = DateTime.UtcNow;
} }
/// <summary> /// <summary>
......
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