1485 lines
38 KiB
C#
1485 lines
38 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Diagnostics;
|
|
using System.IO;
|
|
using System.Net.Sockets;
|
|
using System.Reflection;
|
|
using System.Security;
|
|
using System.Security.Cryptography.X509Certificates;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using Mono.Security.Protocol.Tls;
|
|
|
|
namespace System.Net
|
|
{
|
|
// Token: 0x02000261 RID: 609
|
|
internal class WebConnection
|
|
{
|
|
// Token: 0x06001629 RID: 5673 RVA: 0x00047E14 File Offset: 0x00046014
|
|
public WebConnection(WebConnectionGroup group, ServicePoint sPoint)
|
|
{
|
|
this.sPoint = sPoint;
|
|
this.buffer = new byte[4096];
|
|
this.readState = ReadState.None;
|
|
this.Data = new WebConnectionData();
|
|
this.initConn = new WaitCallback(this.InitConnection);
|
|
this.queue = group.Queue;
|
|
this.abortHelper = new WebConnection.AbortHelper();
|
|
this.abortHelper.Connection = this;
|
|
this.abortHandler = new EventHandler(this.abortHelper.Abort);
|
|
}
|
|
|
|
// Token: 0x0600162B RID: 5675 RVA: 0x00047EC8 File Offset: 0x000460C8
|
|
private bool CanReuse()
|
|
{
|
|
return !this.socket.Poll(0, global::System.Net.Sockets.SelectMode.SelectRead);
|
|
}
|
|
|
|
// Token: 0x0600162C RID: 5676 RVA: 0x00047EDC File Offset: 0x000460DC
|
|
private void LoggedThrow(Exception e)
|
|
{
|
|
Console.WriteLine("Throwing this exception: " + e);
|
|
throw e;
|
|
}
|
|
|
|
// Token: 0x0600162D RID: 5677 RVA: 0x00047EF0 File Offset: 0x000460F0
|
|
internal static Stream DownloadPolicy(string url, string proxy)
|
|
{
|
|
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
|
|
if (proxy != null)
|
|
{
|
|
httpWebRequest.Proxy = new WebProxy(proxy);
|
|
}
|
|
return httpWebRequest.GetResponse().GetResponseStream();
|
|
}
|
|
|
|
// Token: 0x0600162E RID: 5678 RVA: 0x00047F28 File Offset: 0x00046128
|
|
private void CheckUnityWebSecurity(HttpWebRequest request)
|
|
{
|
|
if (!Environment.SocketSecurityEnabled)
|
|
{
|
|
return;
|
|
}
|
|
Console.WriteLine("CheckingSecurityForUrl: " + request.RequestUri.AbsoluteUri);
|
|
global::System.Uri requestUri = request.RequestUri;
|
|
string text = string.Empty;
|
|
if (!requestUri.IsDefaultPort)
|
|
{
|
|
text = ":" + requestUri.Port;
|
|
}
|
|
if (requestUri.ToString() == string.Concat(new string[] { requestUri.Scheme, "://", requestUri.Host, text, "/crossdomain.xml" }))
|
|
{
|
|
return;
|
|
}
|
|
try
|
|
{
|
|
if (WebConnection.method_GetSecurityPolicyFromNonMainThread == null)
|
|
{
|
|
Type type = Type.GetType("UnityEngine.UnityCrossDomainHelper, CrossDomainPolicyParser, Version=1.0.0.0, Culture=neutral");
|
|
if (type == null)
|
|
{
|
|
this.LoggedThrow(new SecurityException("Cant find type UnityCrossDomainHelper"));
|
|
}
|
|
WebConnection.method_GetSecurityPolicyFromNonMainThread = type.GetMethod("GetSecurityPolicyForDotNetWebRequest");
|
|
if (WebConnection.method_GetSecurityPolicyFromNonMainThread == null)
|
|
{
|
|
this.LoggedThrow(new SecurityException("Cant find GetSecurityPolicyFromNonMainThread"));
|
|
}
|
|
}
|
|
MethodInfo method = typeof(WebConnection).GetMethod("DownloadPolicy", BindingFlags.Static | BindingFlags.NonPublic);
|
|
if (method == null)
|
|
{
|
|
this.LoggedThrow(new SecurityException("Cannot find method DownloadPolicy"));
|
|
}
|
|
if (!(bool)WebConnection.method_GetSecurityPolicyFromNonMainThread.Invoke(null, new object[]
|
|
{
|
|
request.RequestUri.ToString(),
|
|
method
|
|
}))
|
|
{
|
|
this.LoggedThrow(new SecurityException("Webrequest was denied"));
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
this.LoggedThrow(new SecurityException("Unexpected error while trying to call method_GetSecurityPolicyBlocking : " + ex));
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600162F RID: 5679 RVA: 0x000480CC File Offset: 0x000462CC
|
|
private void Connect(HttpWebRequest request)
|
|
{
|
|
object obj = this.socketLock;
|
|
lock (obj)
|
|
{
|
|
if (this.socket != null && this.socket.Connected && this.status == WebExceptionStatus.Success && this.CanReuse() && this.CompleteChunkedRead())
|
|
{
|
|
this.reused = true;
|
|
}
|
|
else
|
|
{
|
|
this.reused = false;
|
|
if (this.socket != null)
|
|
{
|
|
this.socket.Close();
|
|
this.socket = null;
|
|
}
|
|
this.chunkStream = null;
|
|
IPHostEntry hostEntry = this.sPoint.HostEntry;
|
|
if (hostEntry == null)
|
|
{
|
|
this.status = ((!this.sPoint.UsesProxy) ? WebExceptionStatus.NameResolutionFailure : WebExceptionStatus.ProxyNameResolutionFailure);
|
|
}
|
|
else
|
|
{
|
|
WebConnectionData data = this.Data;
|
|
foreach (IPAddress ipaddress in hostEntry.AddressList)
|
|
{
|
|
this.socket = new global::System.Net.Sockets.Socket(ipaddress.AddressFamily, global::System.Net.Sockets.SocketType.Stream, global::System.Net.Sockets.ProtocolType.Tcp);
|
|
IPEndPoint ipendPoint = new IPEndPoint(ipaddress, this.sPoint.Address.Port);
|
|
this.socket.SetSocketOption(global::System.Net.Sockets.SocketOptionLevel.Tcp, global::System.Net.Sockets.SocketOptionName.Debug, (!this.sPoint.UseNagleAlgorithm) ? 1 : 0);
|
|
this.socket.NoDelay = !this.sPoint.UseNagleAlgorithm;
|
|
if (!this.sPoint.CallEndPointDelegate(this.socket, ipendPoint))
|
|
{
|
|
this.socket.Close();
|
|
this.socket = null;
|
|
this.status = WebExceptionStatus.ConnectFailure;
|
|
}
|
|
else
|
|
{
|
|
try
|
|
{
|
|
if (request.Aborted)
|
|
{
|
|
break;
|
|
}
|
|
this.CheckUnityWebSecurity(request);
|
|
this.socket.Connect(ipendPoint, false);
|
|
this.status = WebExceptionStatus.Success;
|
|
break;
|
|
}
|
|
catch (ThreadAbortException)
|
|
{
|
|
global::System.Net.Sockets.Socket socket = this.socket;
|
|
this.socket = null;
|
|
if (socket != null)
|
|
{
|
|
socket.Close();
|
|
}
|
|
break;
|
|
}
|
|
catch (ObjectDisposedException ex)
|
|
{
|
|
break;
|
|
}
|
|
catch (Exception ex2)
|
|
{
|
|
global::System.Net.Sockets.Socket socket2 = this.socket;
|
|
this.socket = null;
|
|
if (socket2 != null)
|
|
{
|
|
socket2.Close();
|
|
}
|
|
if (!request.Aborted)
|
|
{
|
|
this.status = WebExceptionStatus.ConnectFailure;
|
|
}
|
|
this.connect_exception = ex2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001630 RID: 5680 RVA: 0x00048374 File Offset: 0x00046574
|
|
private static void EnsureSSLStreamAvailable()
|
|
{
|
|
object obj = WebConnection.classLock;
|
|
lock (obj)
|
|
{
|
|
if (WebConnection.sslStream == null)
|
|
{
|
|
WebConnection.sslStream = Type.GetType("Mono.Security.Protocol.Tls.HttpsClientStream, Mono.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756", false);
|
|
if (WebConnection.sslStream == null)
|
|
{
|
|
string text = "Missing Mono.Security.dll assembly. Support for SSL/TLS is unavailable.";
|
|
throw new NotSupportedException(text);
|
|
}
|
|
WebConnection.piClient = WebConnection.sslStream.GetProperty("SelectedClientCertificate");
|
|
WebConnection.piServer = WebConnection.sslStream.GetProperty("ServerCertificate");
|
|
WebConnection.piTrustFailure = WebConnection.sslStream.GetProperty("TrustFailure");
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001631 RID: 5681 RVA: 0x00048428 File Offset: 0x00046628
|
|
private bool CreateTunnel(HttpWebRequest request, Stream stream, out byte[] buffer)
|
|
{
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
stringBuilder.Append("CONNECT ");
|
|
stringBuilder.Append(request.Address.Host);
|
|
stringBuilder.Append(':');
|
|
stringBuilder.Append(request.Address.Port);
|
|
stringBuilder.Append(" HTTP/");
|
|
if (request.ServicePoint.ProtocolVersion == HttpVersion.Version11)
|
|
{
|
|
stringBuilder.Append("1.1");
|
|
}
|
|
else
|
|
{
|
|
stringBuilder.Append("1.0");
|
|
}
|
|
stringBuilder.Append("\r\nHost: ");
|
|
stringBuilder.Append(request.Address.Authority);
|
|
string challenge = this.Data.Challenge;
|
|
this.Data.Challenge = null;
|
|
bool flag = request.Headers["Proxy-Authorization"] != null;
|
|
if (flag)
|
|
{
|
|
stringBuilder.Append("\r\nProxy-Authorization: ");
|
|
stringBuilder.Append(request.Headers["Proxy-Authorization"]);
|
|
}
|
|
else if (challenge != null && this.Data.StatusCode == 407)
|
|
{
|
|
flag = true;
|
|
ICredentials credentials = request.Proxy.Credentials;
|
|
Authorization authorization = AuthenticationManager.Authenticate(challenge, request, credentials);
|
|
if (authorization != null)
|
|
{
|
|
stringBuilder.Append("\r\nProxy-Authorization: ");
|
|
stringBuilder.Append(authorization.Message);
|
|
}
|
|
}
|
|
stringBuilder.Append("\r\n\r\n");
|
|
this.Data.StatusCode = 0;
|
|
byte[] bytes = Encoding.Default.GetBytes(stringBuilder.ToString());
|
|
stream.Write(bytes, 0, bytes.Length);
|
|
int num;
|
|
WebHeaderCollection webHeaderCollection = this.ReadHeaders(request, stream, out buffer, out num);
|
|
if (!flag && webHeaderCollection != null && num == 407)
|
|
{
|
|
this.Data.StatusCode = num;
|
|
this.Data.Challenge = webHeaderCollection["Proxy-Authenticate"];
|
|
return false;
|
|
}
|
|
if (num != 200)
|
|
{
|
|
string text = string.Format("The remote server returned a {0} status code.", num);
|
|
this.HandleError(WebExceptionStatus.SecureChannelFailure, null, text);
|
|
return false;
|
|
}
|
|
return webHeaderCollection != null;
|
|
}
|
|
|
|
// Token: 0x06001632 RID: 5682 RVA: 0x00048640 File Offset: 0x00046840
|
|
private WebHeaderCollection ReadHeaders(HttpWebRequest request, Stream stream, out byte[] retBuffer, out int status)
|
|
{
|
|
retBuffer = null;
|
|
status = 200;
|
|
byte[] array = new byte[1024];
|
|
MemoryStream memoryStream = new MemoryStream();
|
|
bool flag = false;
|
|
int num2;
|
|
WebHeaderCollection webHeaderCollection;
|
|
for (;;)
|
|
{
|
|
int num = stream.Read(array, 0, 1024);
|
|
if (num == 0)
|
|
{
|
|
break;
|
|
}
|
|
memoryStream.Write(array, 0, num);
|
|
num2 = 0;
|
|
string text = null;
|
|
webHeaderCollection = new WebHeaderCollection();
|
|
while (WebConnection.ReadLine(memoryStream.GetBuffer(), ref num2, (int)memoryStream.Length, ref text))
|
|
{
|
|
if (text == null)
|
|
{
|
|
goto Block_2;
|
|
}
|
|
if (flag)
|
|
{
|
|
webHeaderCollection.Add(text);
|
|
}
|
|
else
|
|
{
|
|
int num3 = text.IndexOf(' ');
|
|
if (num3 == -1)
|
|
{
|
|
goto Block_5;
|
|
}
|
|
status = (int)uint.Parse(text.Substring(num3 + 1, 3));
|
|
flag = true;
|
|
}
|
|
}
|
|
}
|
|
this.HandleError(WebExceptionStatus.ServerProtocolViolation, null, "ReadHeaders");
|
|
return null;
|
|
Block_2:
|
|
if (memoryStream.Length - (long)num2 > 0L)
|
|
{
|
|
retBuffer = new byte[memoryStream.Length - (long)num2];
|
|
Buffer.BlockCopy(memoryStream.GetBuffer(), num2, retBuffer, 0, retBuffer.Length);
|
|
}
|
|
return webHeaderCollection;
|
|
Block_5:
|
|
this.HandleError(WebExceptionStatus.ServerProtocolViolation, null, "ReadHeaders2");
|
|
return null;
|
|
}
|
|
|
|
// Token: 0x06001633 RID: 5683 RVA: 0x0004875C File Offset: 0x0004695C
|
|
private bool CreateStream(HttpWebRequest request)
|
|
{
|
|
try
|
|
{
|
|
global::System.Net.Sockets.NetworkStream networkStream = new global::System.Net.Sockets.NetworkStream(this.socket, false);
|
|
if (request.Address.Scheme == global::System.Uri.UriSchemeHttps)
|
|
{
|
|
this.ssl = true;
|
|
WebConnection.EnsureSSLStreamAvailable();
|
|
if (!this.reused || this.nstream == null || this.nstream.GetType() != WebConnection.sslStream)
|
|
{
|
|
byte[] array = null;
|
|
if (this.sPoint.UseConnect && !this.CreateTunnel(request, networkStream, out array))
|
|
{
|
|
return false;
|
|
}
|
|
object[] array2 = new object[] { networkStream, request.ClientCertificates, request, array };
|
|
this.nstream = (Stream)Activator.CreateInstance(WebConnection.sslStream, array2);
|
|
SslClientStream sslClientStream = (SslClientStream)this.nstream;
|
|
ServicePointManager.ChainValidationHelper chainValidationHelper = new ServicePointManager.ChainValidationHelper(request);
|
|
sslClientStream.ServerCertValidation2 += chainValidationHelper.ValidateChain;
|
|
this.certsAvailable = false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.ssl = false;
|
|
this.nstream = networkStream;
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
if (!request.Aborted)
|
|
{
|
|
this.status = WebExceptionStatus.ConnectFailure;
|
|
}
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// Token: 0x06001634 RID: 5684 RVA: 0x000488AC File Offset: 0x00046AAC
|
|
private void HandleError(WebExceptionStatus st, Exception e, string where)
|
|
{
|
|
this.status = st;
|
|
lock (this)
|
|
{
|
|
if (st == WebExceptionStatus.RequestCanceled)
|
|
{
|
|
this.Data = new WebConnectionData();
|
|
}
|
|
}
|
|
if (e == null)
|
|
{
|
|
try
|
|
{
|
|
throw new Exception(new StackTrace().ToString());
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
e = ex;
|
|
}
|
|
}
|
|
HttpWebRequest httpWebRequest = null;
|
|
if (this.Data != null && this.Data.request != null)
|
|
{
|
|
httpWebRequest = this.Data.request;
|
|
}
|
|
this.Close(true);
|
|
if (httpWebRequest != null)
|
|
{
|
|
httpWebRequest.FinishedReading = true;
|
|
httpWebRequest.SetResponseError(st, e, where);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001635 RID: 5685 RVA: 0x00048984 File Offset: 0x00046B84
|
|
private static void ReadDone(IAsyncResult result)
|
|
{
|
|
WebConnection webConnection = (WebConnection)result.AsyncState;
|
|
WebConnectionData data = webConnection.Data;
|
|
Stream stream = webConnection.nstream;
|
|
if (stream == null)
|
|
{
|
|
webConnection.Close(true);
|
|
return;
|
|
}
|
|
int num = -1;
|
|
try
|
|
{
|
|
num = stream.EndRead(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
webConnection.HandleError(WebExceptionStatus.ReceiveFailure, ex, "ReadDone1");
|
|
return;
|
|
}
|
|
if (num == 0)
|
|
{
|
|
webConnection.HandleError(WebExceptionStatus.ReceiveFailure, null, "ReadDone2");
|
|
return;
|
|
}
|
|
if (num < 0)
|
|
{
|
|
webConnection.HandleError(WebExceptionStatus.ServerProtocolViolation, null, "ReadDone3");
|
|
return;
|
|
}
|
|
int num2 = -1;
|
|
num += webConnection.position;
|
|
if (webConnection.readState == ReadState.None)
|
|
{
|
|
Exception ex2 = null;
|
|
try
|
|
{
|
|
num2 = webConnection.GetResponse(webConnection.buffer, num);
|
|
}
|
|
catch (Exception ex3)
|
|
{
|
|
ex2 = ex3;
|
|
}
|
|
if (ex2 != null)
|
|
{
|
|
webConnection.HandleError(WebExceptionStatus.ServerProtocolViolation, ex2, "ReadDone4");
|
|
return;
|
|
}
|
|
}
|
|
if (webConnection.readState != ReadState.Content)
|
|
{
|
|
int num3 = num * 2;
|
|
int num4 = ((num3 >= webConnection.buffer.Length) ? num3 : webConnection.buffer.Length);
|
|
byte[] array = new byte[num4];
|
|
Buffer.BlockCopy(webConnection.buffer, 0, array, 0, num);
|
|
webConnection.buffer = array;
|
|
webConnection.position = num;
|
|
webConnection.readState = ReadState.None;
|
|
WebConnection.InitRead(webConnection);
|
|
return;
|
|
}
|
|
webConnection.position = 0;
|
|
WebConnectionStream webConnectionStream = new WebConnectionStream(webConnection);
|
|
string text = data.Headers["Transfer-Encoding"];
|
|
webConnection.chunkedRead = text != null && text.ToLower().IndexOf("chunked") != -1;
|
|
if (!webConnection.chunkedRead)
|
|
{
|
|
webConnectionStream.ReadBuffer = webConnection.buffer;
|
|
webConnectionStream.ReadBufferOffset = num2;
|
|
webConnectionStream.ReadBufferSize = num;
|
|
webConnectionStream.CheckResponseInBuffer();
|
|
}
|
|
else if (webConnection.chunkStream == null)
|
|
{
|
|
try
|
|
{
|
|
webConnection.chunkStream = new ChunkStream(webConnection.buffer, num2, num, data.Headers);
|
|
}
|
|
catch (Exception ex4)
|
|
{
|
|
webConnection.HandleError(WebExceptionStatus.ServerProtocolViolation, ex4, "ReadDone5");
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
webConnection.chunkStream.ResetBuffer();
|
|
try
|
|
{
|
|
webConnection.chunkStream.Write(webConnection.buffer, num2, num);
|
|
}
|
|
catch (Exception ex5)
|
|
{
|
|
webConnection.HandleError(WebExceptionStatus.ServerProtocolViolation, ex5, "ReadDone6");
|
|
return;
|
|
}
|
|
}
|
|
data.stream = webConnectionStream;
|
|
if (!WebConnection.ExpectContent(data.StatusCode) || data.request.Method == "HEAD")
|
|
{
|
|
webConnectionStream.ForceCompletion();
|
|
}
|
|
data.request.SetResponseData(data);
|
|
}
|
|
|
|
// Token: 0x06001636 RID: 5686 RVA: 0x00048C74 File Offset: 0x00046E74
|
|
private static bool ExpectContent(int statusCode)
|
|
{
|
|
return statusCode >= 200 && statusCode != 204 && statusCode != 304;
|
|
}
|
|
|
|
// Token: 0x06001637 RID: 5687 RVA: 0x00048CA8 File Offset: 0x00046EA8
|
|
internal void GetCertificates()
|
|
{
|
|
X509Certificate x509Certificate = (X509Certificate)WebConnection.piClient.GetValue(this.nstream, null);
|
|
X509Certificate x509Certificate2 = (X509Certificate)WebConnection.piServer.GetValue(this.nstream, null);
|
|
this.sPoint.SetCertificates(x509Certificate, x509Certificate2);
|
|
this.certsAvailable = x509Certificate2 != null;
|
|
}
|
|
|
|
// Token: 0x06001638 RID: 5688 RVA: 0x00048D00 File Offset: 0x00046F00
|
|
internal static void InitRead(object state)
|
|
{
|
|
WebConnection webConnection = (WebConnection)state;
|
|
Stream stream = webConnection.nstream;
|
|
try
|
|
{
|
|
int num = webConnection.buffer.Length - webConnection.position;
|
|
stream.BeginRead(webConnection.buffer, webConnection.position, num, WebConnection.readDoneDelegate, webConnection);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
webConnection.HandleError(WebExceptionStatus.ReceiveFailure, ex, "InitRead");
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001639 RID: 5689 RVA: 0x00048D7C File Offset: 0x00046F7C
|
|
private int GetResponse(byte[] buffer, int max)
|
|
{
|
|
int num = 0;
|
|
string text = null;
|
|
bool flag = false;
|
|
bool flag2 = false;
|
|
for (;;)
|
|
{
|
|
if (this.readState != ReadState.None)
|
|
{
|
|
goto IL_114;
|
|
}
|
|
if (!WebConnection.ReadLine(buffer, ref num, max, ref text))
|
|
{
|
|
break;
|
|
}
|
|
if (text == null)
|
|
{
|
|
flag2 = true;
|
|
}
|
|
else
|
|
{
|
|
flag2 = false;
|
|
this.readState = ReadState.Status;
|
|
string[] array = text.Split(new char[] { ' ' });
|
|
if (array.Length < 2)
|
|
{
|
|
return -1;
|
|
}
|
|
if (string.Compare(array[0], "HTTP/1.1", true) == 0)
|
|
{
|
|
this.Data.Version = HttpVersion.Version11;
|
|
this.sPoint.SetVersion(HttpVersion.Version11);
|
|
}
|
|
else
|
|
{
|
|
this.Data.Version = HttpVersion.Version10;
|
|
this.sPoint.SetVersion(HttpVersion.Version10);
|
|
}
|
|
this.Data.StatusCode = (int)uint.Parse(array[1]);
|
|
if (array.Length >= 3)
|
|
{
|
|
this.Data.StatusDescription = string.Join(" ", array, 2, array.Length - 2);
|
|
}
|
|
else
|
|
{
|
|
this.Data.StatusDescription = string.Empty;
|
|
}
|
|
if (num >= max)
|
|
{
|
|
return num;
|
|
}
|
|
goto IL_114;
|
|
}
|
|
IL_2CA:
|
|
if (!flag2 && !flag)
|
|
{
|
|
return -1;
|
|
}
|
|
continue;
|
|
IL_114:
|
|
flag2 = false;
|
|
if (this.readState != ReadState.Status)
|
|
{
|
|
goto IL_2CA;
|
|
}
|
|
this.readState = ReadState.Headers;
|
|
this.Data.Headers = new WebHeaderCollection();
|
|
ArrayList arrayList = new ArrayList();
|
|
bool flag3 = false;
|
|
while (!flag3)
|
|
{
|
|
if (!WebConnection.ReadLine(buffer, ref num, max, ref text))
|
|
{
|
|
break;
|
|
}
|
|
if (text == null)
|
|
{
|
|
flag3 = true;
|
|
}
|
|
else if (text.Length > 0 && (text[0] == ' ' || text[0] == '\t'))
|
|
{
|
|
int num2 = arrayList.Count - 1;
|
|
if (num2 < 0)
|
|
{
|
|
break;
|
|
}
|
|
string text2 = (string)arrayList[num2] + text;
|
|
arrayList[num2] = text2;
|
|
}
|
|
else
|
|
{
|
|
arrayList.Add(text);
|
|
}
|
|
}
|
|
if (!flag3)
|
|
{
|
|
return -1;
|
|
}
|
|
foreach (object obj in arrayList)
|
|
{
|
|
string text3 = (string)obj;
|
|
this.Data.Headers.SetInternal(text3);
|
|
}
|
|
if (this.Data.StatusCode != 100)
|
|
{
|
|
goto IL_2C1;
|
|
}
|
|
this.sPoint.SendContinue = true;
|
|
if (num >= max)
|
|
{
|
|
return num;
|
|
}
|
|
if (this.Data.request.ExpectContinue)
|
|
{
|
|
this.Data.request.DoContinueDelegate(this.Data.StatusCode, this.Data.Headers);
|
|
this.Data.request.ExpectContinue = false;
|
|
}
|
|
this.readState = ReadState.None;
|
|
flag = true;
|
|
goto IL_2CA;
|
|
}
|
|
return -1;
|
|
IL_2C1:
|
|
this.readState = ReadState.Content;
|
|
return num;
|
|
}
|
|
|
|
// Token: 0x0600163A RID: 5690 RVA: 0x00049080 File Offset: 0x00047280
|
|
private void InitConnection(object state)
|
|
{
|
|
HttpWebRequest httpWebRequest = (HttpWebRequest)state;
|
|
httpWebRequest.WebConnection = this;
|
|
if (httpWebRequest.Aborted)
|
|
{
|
|
return;
|
|
}
|
|
this.keepAlive = httpWebRequest.KeepAlive;
|
|
this.Data = new WebConnectionData();
|
|
this.Data.request = httpWebRequest;
|
|
WebExceptionStatus webExceptionStatus;
|
|
for (;;)
|
|
{
|
|
this.Connect(httpWebRequest);
|
|
if (httpWebRequest.Aborted)
|
|
{
|
|
break;
|
|
}
|
|
if (this.status != WebExceptionStatus.Success)
|
|
{
|
|
goto Block_3;
|
|
}
|
|
if (this.CreateStream(httpWebRequest))
|
|
{
|
|
goto IL_D2;
|
|
}
|
|
if (httpWebRequest.Aborted)
|
|
{
|
|
return;
|
|
}
|
|
webExceptionStatus = this.status;
|
|
if (this.Data.Challenge == null)
|
|
{
|
|
goto IL_B4;
|
|
}
|
|
}
|
|
return;
|
|
Block_3:
|
|
if (!httpWebRequest.Aborted)
|
|
{
|
|
httpWebRequest.SetWriteStreamError(this.status, this.connect_exception);
|
|
this.Close(true);
|
|
}
|
|
return;
|
|
IL_B4:
|
|
Exception ex = this.connect_exception;
|
|
this.connect_exception = null;
|
|
httpWebRequest.SetWriteStreamError(webExceptionStatus, ex);
|
|
this.Close(true);
|
|
return;
|
|
IL_D2:
|
|
this.readState = ReadState.None;
|
|
httpWebRequest.SetWriteStream(new WebConnectionStream(this, httpWebRequest));
|
|
}
|
|
|
|
// Token: 0x0600163B RID: 5691 RVA: 0x00049174 File Offset: 0x00047374
|
|
internal EventHandler SendRequest(HttpWebRequest request)
|
|
{
|
|
if (request.Aborted)
|
|
{
|
|
return null;
|
|
}
|
|
lock (this)
|
|
{
|
|
if (!this.busy)
|
|
{
|
|
this.busy = true;
|
|
this.status = WebExceptionStatus.Success;
|
|
ThreadPool.QueueUserWorkItem(this.initConn, request);
|
|
}
|
|
else
|
|
{
|
|
Queue queue = this.queue;
|
|
lock (queue)
|
|
{
|
|
this.queue.Enqueue(request);
|
|
}
|
|
}
|
|
}
|
|
return this.abortHandler;
|
|
}
|
|
|
|
// Token: 0x0600163C RID: 5692 RVA: 0x0004922C File Offset: 0x0004742C
|
|
private void SendNext()
|
|
{
|
|
Queue queue = this.queue;
|
|
lock (queue)
|
|
{
|
|
if (this.queue.Count > 0)
|
|
{
|
|
this.SendRequest((HttpWebRequest)this.queue.Dequeue());
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600163D RID: 5693 RVA: 0x00049298 File Offset: 0x00047498
|
|
internal void NextRead()
|
|
{
|
|
lock (this)
|
|
{
|
|
this.Data.request.FinishedReading = true;
|
|
string text = ((!this.sPoint.UsesProxy) ? "Connection" : "Proxy-Connection");
|
|
string text2 = ((this.Data.Headers == null) ? null : this.Data.Headers[text]);
|
|
bool flag = this.Data.Version == HttpVersion.Version11 && this.keepAlive;
|
|
if (text2 != null)
|
|
{
|
|
text2 = text2.ToLower();
|
|
flag = this.keepAlive && text2.IndexOf("keep-alive") != -1;
|
|
}
|
|
if ((this.socket != null && !this.socket.Connected) || !flag || (text2 != null && text2.IndexOf("close") != -1))
|
|
{
|
|
this.Close(false);
|
|
}
|
|
this.busy = false;
|
|
if (this.priority_request != null)
|
|
{
|
|
this.SendRequest(this.priority_request);
|
|
this.priority_request = null;
|
|
}
|
|
else
|
|
{
|
|
this.SendNext();
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600163E RID: 5694 RVA: 0x000493F0 File Offset: 0x000475F0
|
|
private static bool ReadLine(byte[] buffer, ref int start, int max, ref string output)
|
|
{
|
|
bool flag = false;
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
int num = 0;
|
|
while (start < max)
|
|
{
|
|
num = (int)buffer[start++];
|
|
if (num == 10)
|
|
{
|
|
if (stringBuilder.Length > 0 && stringBuilder[stringBuilder.Length - 1] == '\r')
|
|
{
|
|
stringBuilder.Length--;
|
|
}
|
|
flag = false;
|
|
break;
|
|
}
|
|
if (flag)
|
|
{
|
|
stringBuilder.Length--;
|
|
break;
|
|
}
|
|
if (num == 13)
|
|
{
|
|
flag = true;
|
|
}
|
|
stringBuilder.Append((char)num);
|
|
}
|
|
if (num != 10 && num != 13)
|
|
{
|
|
return false;
|
|
}
|
|
if (stringBuilder.Length == 0)
|
|
{
|
|
output = null;
|
|
return num == 10 || num == 13;
|
|
}
|
|
if (flag)
|
|
{
|
|
stringBuilder.Length--;
|
|
}
|
|
output = stringBuilder.ToString();
|
|
return true;
|
|
}
|
|
|
|
// Token: 0x0600163F RID: 5695 RVA: 0x000494D8 File Offset: 0x000476D8
|
|
internal IAsyncResult BeginRead(HttpWebRequest request, byte[] buffer, int offset, int size, AsyncCallback cb, object state)
|
|
{
|
|
lock (this)
|
|
{
|
|
if (this.Data.request != request)
|
|
{
|
|
throw new ObjectDisposedException(typeof(global::System.Net.Sockets.NetworkStream).FullName);
|
|
}
|
|
if (this.nstream == null)
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
IAsyncResult asyncResult = null;
|
|
if (this.chunkedRead)
|
|
{
|
|
if (!this.chunkStream.WantMore)
|
|
{
|
|
goto IL_9A;
|
|
}
|
|
}
|
|
try
|
|
{
|
|
asyncResult = this.nstream.BeginRead(buffer, offset, size, cb, state);
|
|
cb = null;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
this.HandleError(WebExceptionStatus.ReceiveFailure, null, "chunked BeginRead");
|
|
throw;
|
|
}
|
|
IL_9A:
|
|
if (this.chunkedRead)
|
|
{
|
|
WebAsyncResult webAsyncResult = new WebAsyncResult(cb, state, buffer, offset, size);
|
|
webAsyncResult.InnerAsyncResult = asyncResult;
|
|
if (asyncResult == null)
|
|
{
|
|
webAsyncResult.SetCompleted(true, null);
|
|
webAsyncResult.DoCallback();
|
|
}
|
|
return webAsyncResult;
|
|
}
|
|
return asyncResult;
|
|
}
|
|
|
|
// Token: 0x06001640 RID: 5696 RVA: 0x000495EC File Offset: 0x000477EC
|
|
internal int EndRead(HttpWebRequest request, IAsyncResult result)
|
|
{
|
|
lock (this)
|
|
{
|
|
if (this.Data.request != request)
|
|
{
|
|
throw new ObjectDisposedException(typeof(global::System.Net.Sockets.NetworkStream).FullName);
|
|
}
|
|
if (this.nstream == null)
|
|
{
|
|
throw new ObjectDisposedException(typeof(global::System.Net.Sockets.NetworkStream).FullName);
|
|
}
|
|
}
|
|
int num = 0;
|
|
WebAsyncResult webAsyncResult = null;
|
|
IAsyncResult innerAsyncResult = ((WebAsyncResult)result).InnerAsyncResult;
|
|
if (this.chunkedRead && innerAsyncResult is WebAsyncResult)
|
|
{
|
|
webAsyncResult = (WebAsyncResult)innerAsyncResult;
|
|
IAsyncResult innerAsyncResult2 = webAsyncResult.InnerAsyncResult;
|
|
if (innerAsyncResult2 != null && !(innerAsyncResult2 is WebAsyncResult))
|
|
{
|
|
num = this.nstream.EndRead(innerAsyncResult2);
|
|
}
|
|
}
|
|
else if (!(innerAsyncResult is WebAsyncResult))
|
|
{
|
|
num = this.nstream.EndRead(innerAsyncResult);
|
|
webAsyncResult = (WebAsyncResult)result;
|
|
}
|
|
if (this.chunkedRead)
|
|
{
|
|
bool flag = num == 0;
|
|
try
|
|
{
|
|
this.chunkStream.WriteAndReadBack(webAsyncResult.Buffer, webAsyncResult.Offset, webAsyncResult.Size, ref num);
|
|
if (!flag && num == 0 && this.chunkStream.WantMore)
|
|
{
|
|
num = this.EnsureRead(webAsyncResult.Buffer, webAsyncResult.Offset, webAsyncResult.Size);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
if (ex is WebException)
|
|
{
|
|
throw ex;
|
|
}
|
|
throw new WebException("Invalid chunked data.", ex, WebExceptionStatus.ServerProtocolViolation, null);
|
|
}
|
|
if ((flag || num == 0) && this.chunkStream.ChunkLeft != 0)
|
|
{
|
|
this.HandleError(WebExceptionStatus.ReceiveFailure, null, "chunked EndRead");
|
|
throw new WebException("Read error", null, WebExceptionStatus.ReceiveFailure, null);
|
|
}
|
|
}
|
|
return (num == 0) ? (-1) : num;
|
|
}
|
|
|
|
// Token: 0x06001641 RID: 5697 RVA: 0x000497D8 File Offset: 0x000479D8
|
|
private int EnsureRead(byte[] buffer, int offset, int size)
|
|
{
|
|
byte[] array = null;
|
|
int num = 0;
|
|
while (num == 0 && this.chunkStream.WantMore)
|
|
{
|
|
int num2 = this.chunkStream.ChunkLeft;
|
|
if (num2 <= 0)
|
|
{
|
|
num2 = 1024;
|
|
}
|
|
else if (num2 > 16384)
|
|
{
|
|
num2 = 16384;
|
|
}
|
|
if (array == null || array.Length < num2)
|
|
{
|
|
array = new byte[num2];
|
|
}
|
|
int num3 = this.nstream.Read(array, 0, num2);
|
|
if (num3 <= 0)
|
|
{
|
|
return 0;
|
|
}
|
|
this.chunkStream.Write(array, 0, num3);
|
|
num += this.chunkStream.Read(buffer, offset + num, size - num);
|
|
}
|
|
return num;
|
|
}
|
|
|
|
// Token: 0x06001642 RID: 5698 RVA: 0x00049888 File Offset: 0x00047A88
|
|
private bool CompleteChunkedRead()
|
|
{
|
|
if (!this.chunkedRead || this.chunkStream == null)
|
|
{
|
|
return true;
|
|
}
|
|
while (this.chunkStream.WantMore)
|
|
{
|
|
int num = this.nstream.Read(this.buffer, 0, this.buffer.Length);
|
|
if (num <= 0)
|
|
{
|
|
return false;
|
|
}
|
|
this.chunkStream.Write(this.buffer, 0, num);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// Token: 0x06001643 RID: 5699 RVA: 0x000498FC File Offset: 0x00047AFC
|
|
internal IAsyncResult BeginWrite(HttpWebRequest request, byte[] buffer, int offset, int size, AsyncCallback cb, object state)
|
|
{
|
|
lock (this)
|
|
{
|
|
if (this.Data.request != request)
|
|
{
|
|
throw new ObjectDisposedException(typeof(global::System.Net.Sockets.NetworkStream).FullName);
|
|
}
|
|
if (this.nstream == null)
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
IAsyncResult asyncResult = null;
|
|
try
|
|
{
|
|
asyncResult = this.nstream.BeginWrite(buffer, offset, size, cb, state);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
this.status = WebExceptionStatus.SendFailure;
|
|
throw;
|
|
}
|
|
return asyncResult;
|
|
}
|
|
|
|
// Token: 0x06001644 RID: 5700 RVA: 0x000499B8 File Offset: 0x00047BB8
|
|
internal void EndWrite2(HttpWebRequest request, IAsyncResult result)
|
|
{
|
|
if (request.FinishedReading)
|
|
{
|
|
return;
|
|
}
|
|
lock (this)
|
|
{
|
|
if (this.Data.request != request)
|
|
{
|
|
throw new ObjectDisposedException(typeof(global::System.Net.Sockets.NetworkStream).FullName);
|
|
}
|
|
if (this.nstream == null)
|
|
{
|
|
throw new ObjectDisposedException(typeof(global::System.Net.Sockets.NetworkStream).FullName);
|
|
}
|
|
}
|
|
try
|
|
{
|
|
this.nstream.EndWrite(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
this.status = WebExceptionStatus.SendFailure;
|
|
if (ex.InnerException != null)
|
|
{
|
|
throw ex.InnerException;
|
|
}
|
|
throw;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001645 RID: 5701 RVA: 0x00049A94 File Offset: 0x00047C94
|
|
internal bool EndWrite(HttpWebRequest request, IAsyncResult result)
|
|
{
|
|
if (request.FinishedReading)
|
|
{
|
|
return true;
|
|
}
|
|
lock (this)
|
|
{
|
|
if (this.Data.request != request)
|
|
{
|
|
throw new ObjectDisposedException(typeof(global::System.Net.Sockets.NetworkStream).FullName);
|
|
}
|
|
if (this.nstream == null)
|
|
{
|
|
throw new ObjectDisposedException(typeof(global::System.Net.Sockets.NetworkStream).FullName);
|
|
}
|
|
}
|
|
bool flag;
|
|
try
|
|
{
|
|
this.nstream.EndWrite(result);
|
|
flag = true;
|
|
}
|
|
catch
|
|
{
|
|
this.status = WebExceptionStatus.SendFailure;
|
|
flag = false;
|
|
}
|
|
return flag;
|
|
}
|
|
|
|
// Token: 0x06001646 RID: 5702 RVA: 0x00049B6C File Offset: 0x00047D6C
|
|
internal int Read(HttpWebRequest request, byte[] buffer, int offset, int size)
|
|
{
|
|
lock (this)
|
|
{
|
|
if (this.Data.request != request)
|
|
{
|
|
throw new ObjectDisposedException(typeof(global::System.Net.Sockets.NetworkStream).FullName);
|
|
}
|
|
if (this.nstream == null)
|
|
{
|
|
return 0;
|
|
}
|
|
}
|
|
int num = 0;
|
|
try
|
|
{
|
|
bool flag = false;
|
|
if (!this.chunkedRead)
|
|
{
|
|
num = this.nstream.Read(buffer, offset, size);
|
|
flag = num == 0;
|
|
}
|
|
if (this.chunkedRead)
|
|
{
|
|
try
|
|
{
|
|
this.chunkStream.WriteAndReadBack(buffer, offset, size, ref num);
|
|
if (!flag && num == 0 && this.chunkStream.WantMore)
|
|
{
|
|
num = this.EnsureRead(buffer, offset, size);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
this.HandleError(WebExceptionStatus.ReceiveFailure, ex, "chunked Read1");
|
|
throw;
|
|
}
|
|
if ((flag || num == 0) && this.chunkStream.WantMore)
|
|
{
|
|
this.HandleError(WebExceptionStatus.ReceiveFailure, null, "chunked Read2");
|
|
throw new WebException("Read error", null, WebExceptionStatus.ReceiveFailure, null);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex2)
|
|
{
|
|
this.HandleError(WebExceptionStatus.ReceiveFailure, ex2, "Read");
|
|
}
|
|
return num;
|
|
}
|
|
|
|
// Token: 0x06001647 RID: 5703 RVA: 0x00049CE8 File Offset: 0x00047EE8
|
|
internal bool Write(HttpWebRequest request, byte[] buffer, int offset, int size, ref string err_msg)
|
|
{
|
|
err_msg = null;
|
|
lock (this)
|
|
{
|
|
if (this.Data.request != request)
|
|
{
|
|
throw new ObjectDisposedException(typeof(global::System.Net.Sockets.NetworkStream).FullName);
|
|
}
|
|
if (this.nstream == null)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
try
|
|
{
|
|
this.nstream.Write(buffer, offset, size);
|
|
if (this.ssl && !this.certsAvailable)
|
|
{
|
|
this.GetCertificates();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
err_msg = ex.Message;
|
|
WebExceptionStatus webExceptionStatus = WebExceptionStatus.SendFailure;
|
|
string text = "Write: " + err_msg;
|
|
if (ex is WebException)
|
|
{
|
|
this.HandleError(webExceptionStatus, ex, text);
|
|
return false;
|
|
}
|
|
if (this.ssl && (bool)WebConnection.piTrustFailure.GetValue(this.nstream, null))
|
|
{
|
|
webExceptionStatus = WebExceptionStatus.TrustFailure;
|
|
text = "Trust failure";
|
|
}
|
|
this.HandleError(webExceptionStatus, ex, text);
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// Token: 0x06001648 RID: 5704 RVA: 0x00049E2C File Offset: 0x0004802C
|
|
internal void Close(bool sendNext)
|
|
{
|
|
lock (this)
|
|
{
|
|
if (this.nstream != null)
|
|
{
|
|
try
|
|
{
|
|
this.nstream.Close();
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
this.nstream = null;
|
|
}
|
|
if (this.socket != null)
|
|
{
|
|
try
|
|
{
|
|
this.socket.Close();
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
this.socket = null;
|
|
}
|
|
this.busy = false;
|
|
this.Data = new WebConnectionData();
|
|
if (sendNext)
|
|
{
|
|
this.SendNext();
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001649 RID: 5705 RVA: 0x00049F08 File Offset: 0x00048108
|
|
private void Abort(object sender, EventArgs args)
|
|
{
|
|
lock (this)
|
|
{
|
|
Queue queue = this.queue;
|
|
lock (queue)
|
|
{
|
|
HttpWebRequest httpWebRequest = (HttpWebRequest)sender;
|
|
if (this.Data.request == httpWebRequest)
|
|
{
|
|
if (!httpWebRequest.FinishedReading)
|
|
{
|
|
this.status = WebExceptionStatus.RequestCanceled;
|
|
this.Close(false);
|
|
if (this.queue.Count > 0)
|
|
{
|
|
this.Data.request = (HttpWebRequest)this.queue.Dequeue();
|
|
this.SendRequest(this.Data.request);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
httpWebRequest.FinishedReading = true;
|
|
httpWebRequest.SetResponseError(WebExceptionStatus.RequestCanceled, null, "User aborted");
|
|
if (this.queue.Count > 0 && this.queue.Peek() == sender)
|
|
{
|
|
this.queue.Dequeue();
|
|
}
|
|
else if (this.queue.Count > 0)
|
|
{
|
|
object[] array = this.queue.ToArray();
|
|
this.queue.Clear();
|
|
for (int i = array.Length - 1; i >= 0; i--)
|
|
{
|
|
if (array[i] != sender)
|
|
{
|
|
this.queue.Enqueue(array[i]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600164A RID: 5706 RVA: 0x0004A08C File Offset: 0x0004828C
|
|
internal void ResetNtlm()
|
|
{
|
|
this.ntlm_authenticated = false;
|
|
this.ntlm_credentials = null;
|
|
this.unsafe_sharing = false;
|
|
}
|
|
|
|
// Token: 0x17000726 RID: 1830
|
|
// (get) Token: 0x0600164B RID: 5707 RVA: 0x0004A0A4 File Offset: 0x000482A4
|
|
internal bool Busy
|
|
{
|
|
get
|
|
{
|
|
bool flag;
|
|
lock (this)
|
|
{
|
|
flag = this.busy;
|
|
}
|
|
return flag;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000727 RID: 1831
|
|
// (get) Token: 0x0600164C RID: 5708 RVA: 0x0004A0F0 File Offset: 0x000482F0
|
|
internal bool Connected
|
|
{
|
|
get
|
|
{
|
|
bool flag;
|
|
lock (this)
|
|
{
|
|
flag = this.socket != null && this.socket.Connected;
|
|
}
|
|
return flag;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000728 RID: 1832
|
|
// (set) Token: 0x0600164D RID: 5709 RVA: 0x0004A150 File Offset: 0x00048350
|
|
internal HttpWebRequest PriorityRequest
|
|
{
|
|
set
|
|
{
|
|
this.priority_request = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000729 RID: 1833
|
|
// (get) Token: 0x0600164E RID: 5710 RVA: 0x0004A15C File Offset: 0x0004835C
|
|
// (set) Token: 0x0600164F RID: 5711 RVA: 0x0004A164 File Offset: 0x00048364
|
|
internal bool NtlmAuthenticated
|
|
{
|
|
get
|
|
{
|
|
return this.ntlm_authenticated;
|
|
}
|
|
set
|
|
{
|
|
this.ntlm_authenticated = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700072A RID: 1834
|
|
// (get) Token: 0x06001650 RID: 5712 RVA: 0x0004A170 File Offset: 0x00048370
|
|
// (set) Token: 0x06001651 RID: 5713 RVA: 0x0004A178 File Offset: 0x00048378
|
|
internal NetworkCredential NtlmCredential
|
|
{
|
|
get
|
|
{
|
|
return this.ntlm_credentials;
|
|
}
|
|
set
|
|
{
|
|
this.ntlm_credentials = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700072B RID: 1835
|
|
// (get) Token: 0x06001652 RID: 5714 RVA: 0x0004A184 File Offset: 0x00048384
|
|
// (set) Token: 0x06001653 RID: 5715 RVA: 0x0004A18C File Offset: 0x0004838C
|
|
internal bool UnsafeAuthenticatedConnectionSharing
|
|
{
|
|
get
|
|
{
|
|
return this.unsafe_sharing;
|
|
}
|
|
set
|
|
{
|
|
this.unsafe_sharing = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0400120E RID: 4622
|
|
private ServicePoint sPoint;
|
|
|
|
// Token: 0x0400120F RID: 4623
|
|
private Stream nstream;
|
|
|
|
// Token: 0x04001210 RID: 4624
|
|
private global::System.Net.Sockets.Socket socket;
|
|
|
|
// Token: 0x04001211 RID: 4625
|
|
private object socketLock = new object();
|
|
|
|
// Token: 0x04001212 RID: 4626
|
|
private WebExceptionStatus status;
|
|
|
|
// Token: 0x04001213 RID: 4627
|
|
private WaitCallback initConn;
|
|
|
|
// Token: 0x04001214 RID: 4628
|
|
private bool keepAlive;
|
|
|
|
// Token: 0x04001215 RID: 4629
|
|
private byte[] buffer;
|
|
|
|
// Token: 0x04001216 RID: 4630
|
|
private static AsyncCallback readDoneDelegate = new AsyncCallback(WebConnection.ReadDone);
|
|
|
|
// Token: 0x04001217 RID: 4631
|
|
private EventHandler abortHandler;
|
|
|
|
// Token: 0x04001218 RID: 4632
|
|
private WebConnection.AbortHelper abortHelper;
|
|
|
|
// Token: 0x04001219 RID: 4633
|
|
private ReadState readState;
|
|
|
|
// Token: 0x0400121A RID: 4634
|
|
internal WebConnectionData Data;
|
|
|
|
// Token: 0x0400121B RID: 4635
|
|
private bool chunkedRead;
|
|
|
|
// Token: 0x0400121C RID: 4636
|
|
private ChunkStream chunkStream;
|
|
|
|
// Token: 0x0400121D RID: 4637
|
|
private Queue queue;
|
|
|
|
// Token: 0x0400121E RID: 4638
|
|
private bool reused;
|
|
|
|
// Token: 0x0400121F RID: 4639
|
|
private int position;
|
|
|
|
// Token: 0x04001220 RID: 4640
|
|
private bool busy;
|
|
|
|
// Token: 0x04001221 RID: 4641
|
|
private HttpWebRequest priority_request;
|
|
|
|
// Token: 0x04001222 RID: 4642
|
|
private NetworkCredential ntlm_credentials;
|
|
|
|
// Token: 0x04001223 RID: 4643
|
|
private bool ntlm_authenticated;
|
|
|
|
// Token: 0x04001224 RID: 4644
|
|
private bool unsafe_sharing;
|
|
|
|
// Token: 0x04001225 RID: 4645
|
|
private bool ssl;
|
|
|
|
// Token: 0x04001226 RID: 4646
|
|
private bool certsAvailable;
|
|
|
|
// Token: 0x04001227 RID: 4647
|
|
private Exception connect_exception;
|
|
|
|
// Token: 0x04001228 RID: 4648
|
|
private static object classLock = new object();
|
|
|
|
// Token: 0x04001229 RID: 4649
|
|
private static Type sslStream;
|
|
|
|
// Token: 0x0400122A RID: 4650
|
|
private static PropertyInfo piClient;
|
|
|
|
// Token: 0x0400122B RID: 4651
|
|
private static PropertyInfo piServer;
|
|
|
|
// Token: 0x0400122C RID: 4652
|
|
private static PropertyInfo piTrustFailure;
|
|
|
|
// Token: 0x0400122D RID: 4653
|
|
private static MethodInfo method_GetSecurityPolicyFromNonMainThread;
|
|
|
|
// Token: 0x02000262 RID: 610
|
|
private class AbortHelper
|
|
{
|
|
// Token: 0x06001655 RID: 5717 RVA: 0x0004A1A0 File Offset: 0x000483A0
|
|
public void Abort(object sender, EventArgs args)
|
|
{
|
|
WebConnection webConnection = ((HttpWebRequest)sender).WebConnection;
|
|
if (webConnection == null)
|
|
{
|
|
webConnection = this.Connection;
|
|
}
|
|
webConnection.Abort(sender, args);
|
|
}
|
|
|
|
// Token: 0x0400122E RID: 4654
|
|
public WebConnection Connection;
|
|
}
|
|
}
|
|
}
|