Commit 1972efac authored by titanium007's avatar titanium007

Make properties readonly

parent 8fcb1868
...@@ -37,12 +37,20 @@ namespace Titanium.Web.Proxy.Models ...@@ -37,12 +37,20 @@ namespace Titanium.Web.Proxy.Models
internal HttpWebRequest proxyRequest { get; set; } internal HttpWebRequest proxyRequest { get; set; }
internal HttpWebResponse serverResponse { get; set; } internal HttpWebResponse serverResponse { get; set; }
public int ClientPort { get; set; } internal bool isHttps { get; set; }
public IPAddress ClientIpAddress { get; set; } internal string requestURL { get; set; }
internal string requestHostname { get; set; }
internal int clientPort { get; set; }
internal IPAddress clientIpAddress { get; set; }
public int ClientPort { get { return this.clientPort; } }
public IPAddress ClientIpAddress { get { return this.clientIpAddress; } }
public bool IsHttps { get { return this.isHttps; } }
public string RequestURL { get { return this.requestURL; } }
public string RequestHostname { get { return this.requestHostname; } }
public bool IsHttps { get; set; }
public string RequestURL { get; set; }
public string RequestHostname { get; set; }
public string RequestMethod { get { return this.proxyRequest.Method; } } public string RequestMethod { get { return this.proxyRequest.Method; } }
public int RequestContentLength { get { return requestContentLength; } } public int RequestContentLength { get { return requestContentLength; } }
......
...@@ -191,7 +191,7 @@ namespace Titanium.Web.Proxy ...@@ -191,7 +191,7 @@ namespace Titanium.Web.Proxy
if (splitBuffer.Length != 3) if (splitBuffer.Length != 3)
{ {
TcpHelper.SendRaw(httpCmd, httpsHostName, requestLines, args.IsHttps, clientStreamReader.BaseStream); TcpHelper.SendRaw(httpCmd, httpsHostName, requestLines, args.isHttps, clientStreamReader.BaseStream);
Dispose(client, clientStream, clientStreamReader, clientStreamWriter, args); Dispose(client, clientStream, clientStreamReader, clientStreamWriter, args);
...@@ -212,7 +212,7 @@ namespace Titanium.Web.Proxy ...@@ -212,7 +212,7 @@ namespace Titanium.Web.Proxy
if (httpsDecoratedHostName != null) if (httpsDecoratedHostName != null)
{ {
remoteUri = httpsDecoratedHostName + remoteUri; remoteUri = httpsDecoratedHostName + remoteUri;
args.IsHttps = true; args.isHttps = true;
} }
//construct the web request that we are going to issue on behalf of the client. //construct the web request that we are going to issue on behalf of the client.
...@@ -234,7 +234,7 @@ namespace Titanium.Web.Proxy ...@@ -234,7 +234,7 @@ namespace Titanium.Web.Proxy
if ((header[0] == "upgrade") && (header[1] == "websocket")) if ((header[0] == "upgrade") && (header[1] == "websocket"))
{ {
TcpHelper.SendRaw(httpCmd, httpsHostName, requestLines, args.IsHttps, clientStreamReader.BaseStream); TcpHelper.SendRaw(httpCmd, httpsHostName, requestLines, args.isHttps, clientStreamReader.BaseStream);
Dispose(client, clientStream, clientStreamReader, clientStreamWriter, args); Dispose(client, clientStream, clientStreamReader, clientStreamWriter, args);
...@@ -246,10 +246,10 @@ namespace Titanium.Web.Proxy ...@@ -246,10 +246,10 @@ namespace Titanium.Web.Proxy
args.proxyRequest.AllowAutoRedirect = false; args.proxyRequest.AllowAutoRedirect = false;
args.proxyRequest.AutomaticDecompression = DecompressionMethods.None; args.proxyRequest.AutomaticDecompression = DecompressionMethods.None;
args.RequestHostname = args.proxyRequest.RequestUri.Host; args.requestHostname = args.proxyRequest.RequestUri.Host;
args.RequestURL = args.proxyRequest.RequestUri.OriginalString; args.requestURL = args.proxyRequest.RequestUri.OriginalString;
args.ClientPort = ((IPEndPoint)client.Client.RemoteEndPoint).Port; args.clientPort = ((IPEndPoint)client.Client.RemoteEndPoint).Port;
args.ClientIpAddress = ((IPEndPoint)client.Client.RemoteEndPoint).Address; args.clientIpAddress = ((IPEndPoint)client.Client.RemoteEndPoint).Address;
args.requestHttpVersion = version; args.requestHttpVersion = version;
args.requestIsAlive = args.proxyRequest.KeepAlive; args.requestIsAlive = args.proxyRequest.KeepAlive;
...@@ -270,7 +270,7 @@ namespace Titanium.Web.Proxy ...@@ -270,7 +270,7 @@ namespace Titanium.Web.Proxy
return; return;
} }
args.proxyRequest.ConnectionGroupName = args.RequestHostname; args.proxyRequest.ConnectionGroupName = args.requestHostname;
args.proxyRequest.AllowWriteStreamBuffering = true; args.proxyRequest.AllowWriteStreamBuffering = true;
//If request was modified by user //If request was modified by user
......
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