This commit is contained in:
niko
2026-06-04 11:42:34 +02:00
parent f39ba70a9f
commit e720b98cd1
7488 changed files with 2493818 additions and 0 deletions
+286
View File
@@ -0,0 +1,286 @@
using System;
using System.Collections;
using System.Collections.Specialized;
namespace System.Net
{
/// <summary>Manages the authentication modules called during the client authentication process.</summary>
// Token: 0x020001FB RID: 507
public class AuthenticationManager
{
// Token: 0x0600112F RID: 4399 RVA: 0x000321E8 File Offset: 0x000303E8
private AuthenticationManager()
{
}
// Token: 0x06001131 RID: 4401 RVA: 0x00032204 File Offset: 0x00030404
private static void EnsureModules()
{
object obj = AuthenticationManager.locker;
lock (obj)
{
if (AuthenticationManager.modules == null)
{
AuthenticationManager.modules = new ArrayList();
AuthenticationManager.modules.Add(new BasicClient());
AuthenticationManager.modules.Add(new DigestClient());
}
}
}
/// <summary>Gets or sets the credential policy to be used for resource requests made using the <see cref="T:System.Net.HttpWebRequest" /> class.</summary>
/// <returns>An object that implements the <see cref="T:System.Net.ICredentialPolicy" /> interface that determines whether credentials are sent with requests. The default value is null.</returns>
// Token: 0x170005AA RID: 1450
// (get) Token: 0x06001132 RID: 4402 RVA: 0x00032280 File Offset: 0x00030480
// (set) Token: 0x06001133 RID: 4403 RVA: 0x00032288 File Offset: 0x00030488
public static ICredentialPolicy CredentialPolicy
{
get
{
return AuthenticationManager.credential_policy;
}
set
{
AuthenticationManager.credential_policy = value;
}
}
// Token: 0x06001134 RID: 4404 RVA: 0x00032290 File Offset: 0x00030490
private static Exception GetMustImplement()
{
return new NotImplementedException();
}
/// <summary>Gets the dictionary that contains Service Principal Names (SPNs) that are used to identify hosts during Kerberos authentication for requests made using <see cref="T:System.Net.WebRequest" /> and its derived classes.</summary>
/// <returns>A writable <see cref="T:System.Collections.Specialized.StringDictionary" /> that contains the SPN values for keys composed of host information. </returns>
// Token: 0x170005AB RID: 1451
// (get) Token: 0x06001135 RID: 4405 RVA: 0x00032298 File Offset: 0x00030498
[global::System.MonoTODO]
public static global::System.Collections.Specialized.StringDictionary CustomTargetNameDictionary
{
get
{
throw AuthenticationManager.GetMustImplement();
}
}
/// <summary>Gets a list of authentication modules that are registered with the authentication manager.</summary>
/// <returns>An <see cref="T:System.Collections.IEnumerator" /> that enables the registered authentication modules to be read.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
/// </PermissionSet>
// Token: 0x170005AC RID: 1452
// (get) Token: 0x06001136 RID: 4406 RVA: 0x000322A0 File Offset: 0x000304A0
public static IEnumerator RegisteredModules
{
get
{
AuthenticationManager.EnsureModules();
return AuthenticationManager.modules.GetEnumerator();
}
}
// Token: 0x06001137 RID: 4407 RVA: 0x000322B4 File Offset: 0x000304B4
internal static void Clear()
{
AuthenticationManager.EnsureModules();
ArrayList arrayList = AuthenticationManager.modules;
lock (arrayList)
{
AuthenticationManager.modules.Clear();
}
}
/// <summary>Calls each registered authentication module to find the first module that can respond to the authentication request.</summary>
/// <returns>An instance of the <see cref="T:System.Net.Authorization" /> class containing the result of the authorization attempt. If there is no authentication module to respond to the challenge, this method returns null.</returns>
/// <param name="challenge">The challenge returned by the Internet resource. </param>
/// <param name="request">The <see cref="T:System.Net.WebRequest" /> that initiated the authentication challenge. </param>
/// <param name="credentials">The <see cref="T:System.Net.ICredentials" /> associated with this request. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="challenge" /> is null.-or- <paramref name="request" /> is null.-or- <paramref name="credentials" /> is null. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
/// </PermissionSet>
// Token: 0x06001138 RID: 4408 RVA: 0x00032304 File Offset: 0x00030504
public static Authorization Authenticate(string challenge, WebRequest request, ICredentials credentials)
{
if (request == null)
{
throw new ArgumentNullException("request");
}
if (credentials == null)
{
throw new ArgumentNullException("credentials");
}
if (challenge == null)
{
throw new ArgumentNullException("challenge");
}
return AuthenticationManager.DoAuthenticate(challenge, request, credentials);
}
// Token: 0x06001139 RID: 4409 RVA: 0x00032344 File Offset: 0x00030544
private static Authorization DoAuthenticate(string challenge, WebRequest request, ICredentials credentials)
{
AuthenticationManager.EnsureModules();
ArrayList arrayList = AuthenticationManager.modules;
lock (arrayList)
{
foreach (object obj in AuthenticationManager.modules)
{
IAuthenticationModule authenticationModule = (IAuthenticationModule)obj;
Authorization authorization = authenticationModule.Authenticate(challenge, request, credentials);
if (authorization != null)
{
authorization.Module = authenticationModule;
return authorization;
}
}
}
return null;
}
/// <summary>Preauthenticates a request.</summary>
/// <returns>An instance of the <see cref="T:System.Net.Authorization" /> class if the request can be preauthenticated; otherwise, null. If <paramref name="credentials" /> is null, this method returns null.</returns>
/// <param name="request">A <see cref="T:System.Net.WebRequest" /> to an Internet resource. </param>
/// <param name="credentials">The <see cref="T:System.Net.ICredentials" /> associated with the request. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="request" /> is null. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
/// </PermissionSet>
// Token: 0x0600113A RID: 4410 RVA: 0x0003240C File Offset: 0x0003060C
public static Authorization PreAuthenticate(WebRequest request, ICredentials credentials)
{
if (request == null)
{
throw new ArgumentNullException("request");
}
if (credentials == null)
{
return null;
}
AuthenticationManager.EnsureModules();
ArrayList arrayList = AuthenticationManager.modules;
lock (arrayList)
{
foreach (object obj in AuthenticationManager.modules)
{
IAuthenticationModule authenticationModule = (IAuthenticationModule)obj;
Authorization authorization = authenticationModule.PreAuthenticate(request, credentials);
if (authorization != null)
{
authorization.Module = authenticationModule;
return authorization;
}
}
}
return null;
}
/// <summary>Registers an authentication module with the authentication manager.</summary>
/// <param name="authenticationModule">The <see cref="T:System.Net.IAuthenticationModule" /> to register with the authentication manager. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="authenticationModule" /> is null. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x0600113B RID: 4411 RVA: 0x000324EC File Offset: 0x000306EC
public static void Register(IAuthenticationModule authenticationModule)
{
if (authenticationModule == null)
{
throw new ArgumentNullException("authenticationModule");
}
AuthenticationManager.DoUnregister(authenticationModule.AuthenticationType, false);
ArrayList arrayList = AuthenticationManager.modules;
lock (arrayList)
{
AuthenticationManager.modules.Add(authenticationModule);
}
}
/// <summary>Removes the specified authentication module from the list of registered modules.</summary>
/// <param name="authenticationModule">The <see cref="T:System.Net.IAuthenticationModule" /> to remove from the list of registered modules. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="authenticationModule" /> is null. </exception>
/// <exception cref="T:System.InvalidOperationException">The specified <see cref="T:System.Net.IAuthenticationModule" /> is not registered. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x0600113C RID: 4412 RVA: 0x00032558 File Offset: 0x00030758
public static void Unregister(IAuthenticationModule authenticationModule)
{
if (authenticationModule == null)
{
throw new ArgumentNullException("authenticationModule");
}
AuthenticationManager.DoUnregister(authenticationModule.AuthenticationType, true);
}
/// <summary>Removes authentication modules with the specified authentication scheme from the list of registered modules.</summary>
/// <param name="authenticationScheme">The authentication scheme of the module to remove. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="authenticationScheme" /> is null. </exception>
/// <exception cref="T:System.InvalidOperationException">A module for this authentication scheme is not registered. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x0600113D RID: 4413 RVA: 0x00032578 File Offset: 0x00030778
public static void Unregister(string authenticationScheme)
{
if (authenticationScheme == null)
{
throw new ArgumentNullException("authenticationScheme");
}
AuthenticationManager.DoUnregister(authenticationScheme, true);
}
// Token: 0x0600113E RID: 4414 RVA: 0x00032594 File Offset: 0x00030794
private static void DoUnregister(string authenticationScheme, bool throwEx)
{
AuthenticationManager.EnsureModules();
ArrayList arrayList = AuthenticationManager.modules;
lock (arrayList)
{
IAuthenticationModule authenticationModule = null;
foreach (object obj in AuthenticationManager.modules)
{
IAuthenticationModule authenticationModule2 = (IAuthenticationModule)obj;
string authenticationType = authenticationModule2.AuthenticationType;
if (string.Compare(authenticationType, authenticationScheme, true) == 0)
{
authenticationModule = authenticationModule2;
break;
}
}
if (authenticationModule == null)
{
if (throwEx)
{
throw new InvalidOperationException("Scheme not registered.");
}
}
else
{
AuthenticationManager.modules.Remove(authenticationModule);
}
}
}
// Token: 0x04000F4A RID: 3914
private static ArrayList modules;
// Token: 0x04000F4B RID: 3915
private static object locker = new object();
// Token: 0x04000F4C RID: 3916
private static ICredentialPolicy credential_policy = null;
}
}
@@ -0,0 +1,11 @@
using System;
namespace System.Net
{
/// <summary>Selects the authentication scheme for an <see cref="T:System.Net.HttpListener" /> instance.</summary>
/// <returns>One of the <see cref="T:System.Net.AuthenticationSchemes" /> values that indicates the method of authentication to use for the specified client request.</returns>
/// <param name="httpRequest">The <see cref="T:System.Net.HttpListenerRequest" /> instance for which to select an authentication scheme.</param>
// Token: 0x02000333 RID: 819
// (Invoke) Token: 0x06001CA5 RID: 7333
public delegate AuthenticationSchemes AuthenticationSchemeSelector(HttpListenerRequest httpRequest);
}
+32
View File
@@ -0,0 +1,32 @@
using System;
namespace System.Net
{
/// <summary>Specifies protocols for authentication.</summary>
// Token: 0x020001FC RID: 508
[Flags]
public enum AuthenticationSchemes
{
/// <summary>No authentication is allowed. A client requesting an <see cref="T:System.Net.HttpListener" /> object with this flag set will always receive a 403 Forbidden status. Use this flag when a resource should never be served to a client.</summary>
// Token: 0x04000F4E RID: 3918
None = 0,
/// <summary>Specifies digest authentication.</summary>
// Token: 0x04000F4F RID: 3919
Digest = 1,
/// <summary>Negotiates with the client to determine the authentication scheme. If both client and server support Kerberos, it is used; otherwise, NTLM is used.</summary>
// Token: 0x04000F50 RID: 3920
Negotiate = 2,
/// <summary>Specifies NTLM authentication.</summary>
// Token: 0x04000F51 RID: 3921
Ntlm = 4,
/// <summary>Specifies Windows authentication.</summary>
// Token: 0x04000F52 RID: 3922
IntegratedWindowsAuthentication = 6,
/// <summary>Specifies basic authentication. </summary>
// Token: 0x04000F53 RID: 3923
Basic = 8,
/// <summary>Specifies anonymous authentication.</summary>
// Token: 0x04000F54 RID: 3924
Anonymous = 32768
}
}
+145
View File
@@ -0,0 +1,145 @@
using System;
namespace System.Net
{
/// <summary>Contains an authentication message for an Internet server.</summary>
// Token: 0x020001FD RID: 509
public class Authorization
{
/// <summary>Creates a new instance of the <see cref="T:System.Net.Authorization" /> class with the specified authorization message.</summary>
/// <param name="token">The encrypted authorization message expected by the server. </param>
// Token: 0x0600113F RID: 4415 RVA: 0x0003267C File Offset: 0x0003087C
public Authorization(string token)
: this(token, true)
{
}
/// <summary>Creates a new instance of the <see cref="T:System.Net.Authorization" /> class with the specified authorization message and completion status.</summary>
/// <param name="token">The encrypted authorization message expected by the server. </param>
/// <param name="finished">The completion status of the authorization attempt. true if the authorization attempt is complete; otherwise, false. </param>
// Token: 0x06001140 RID: 4416 RVA: 0x00032688 File Offset: 0x00030888
public Authorization(string token, bool complete)
: this(token, complete, null)
{
}
/// <summary>Creates a new instance of the <see cref="T:System.Net.Authorization" /> class with the specified authorization message, completion status, and connection group identifier.</summary>
/// <param name="token">The encrypted authorization message expected by the server. </param>
/// <param name="finished">The completion status of the authorization attempt. true if the authorization attempt is complete; otherwise, false. </param>
/// <param name="connectionGroupId">A unique identifier that can be used to create private client-server connections that are bound only to this authentication scheme. </param>
// Token: 0x06001141 RID: 4417 RVA: 0x00032694 File Offset: 0x00030894
public Authorization(string token, bool complete, string connectionGroupId)
{
this.token = token;
this.complete = complete;
this.connectionGroupId = connectionGroupId;
}
/// <summary>Gets the message returned to the server in response to an authentication challenge.</summary>
/// <returns>The message that will be returned to the server in response to an authentication challenge.</returns>
// Token: 0x170005AD RID: 1453
// (get) Token: 0x06001142 RID: 4418 RVA: 0x000326B4 File Offset: 0x000308B4
public string Message
{
get
{
return this.token;
}
}
/// <summary>Gets the completion status of the authorization.</summary>
/// <returns>true if the authentication process is complete; otherwise, false.</returns>
// Token: 0x170005AE RID: 1454
// (get) Token: 0x06001143 RID: 4419 RVA: 0x000326BC File Offset: 0x000308BC
public bool Complete
{
get
{
return this.complete;
}
}
/// <summary>Gets a unique identifier for user-specific connections.</summary>
/// <returns>A unique string that associates a connection with an authenticating entity.</returns>
// Token: 0x170005AF RID: 1455
// (get) Token: 0x06001144 RID: 4420 RVA: 0x000326C4 File Offset: 0x000308C4
public string ConnectionGroupId
{
get
{
return this.connectionGroupId;
}
}
/// <summary>Gets or sets the prefix for Uniform Resource Identifiers (URIs) that can be authenticated with the <see cref="P:System.Net.Authorization.Message" /> property.</summary>
/// <returns>An array of strings that contains URI prefixes.</returns>
// Token: 0x170005B0 RID: 1456
// (get) Token: 0x06001145 RID: 4421 RVA: 0x000326CC File Offset: 0x000308CC
// (set) Token: 0x06001146 RID: 4422 RVA: 0x000326D4 File Offset: 0x000308D4
public string[] ProtectionRealm
{
get
{
return this.protectionRealm;
}
set
{
this.protectionRealm = value;
}
}
// Token: 0x170005B1 RID: 1457
// (get) Token: 0x06001147 RID: 4423 RVA: 0x000326E0 File Offset: 0x000308E0
// (set) Token: 0x06001148 RID: 4424 RVA: 0x000326E8 File Offset: 0x000308E8
internal IAuthenticationModule Module
{
get
{
return this.module;
}
set
{
this.module = value;
}
}
// Token: 0x06001149 RID: 4425 RVA: 0x000326F4 File Offset: 0x000308F4
private static Exception GetMustImplement()
{
return new NotImplementedException();
}
/// <summary>Gets or sets a <see cref="T:System.Boolean" /> value that indicates whether mutual authentication occurred.</summary>
/// <returns>true if both client and server were authenticated; otherwise, false.</returns>
// Token: 0x170005B2 RID: 1458
// (get) Token: 0x0600114A RID: 4426 RVA: 0x000326FC File Offset: 0x000308FC
// (set) Token: 0x0600114B RID: 4427 RVA: 0x00032704 File Offset: 0x00030904
[global::System.MonoTODO]
public bool MutuallyAuthenticated
{
get
{
throw Authorization.GetMustImplement();
}
set
{
throw Authorization.GetMustImplement();
}
}
// Token: 0x04000F55 RID: 3925
private string token;
// Token: 0x04000F56 RID: 3926
private bool complete;
// Token: 0x04000F57 RID: 3927
private string connectionGroupId;
// Token: 0x04000F58 RID: 3928
private string[] protectionRealm;
// Token: 0x04000F59 RID: 3929
private IAuthenticationModule module;
}
}
+94
View File
@@ -0,0 +1,94 @@
using System;
namespace System.Net
{
// Token: 0x020001FE RID: 510
internal class BasicClient : IAuthenticationModule
{
// Token: 0x0600114D RID: 4429 RVA: 0x00032714 File Offset: 0x00030914
public Authorization Authenticate(string challenge, WebRequest webRequest, ICredentials credentials)
{
if (credentials == null || challenge == null)
{
return null;
}
string text = challenge.Trim();
if (text.ToLower().IndexOf("basic") == -1)
{
return null;
}
return BasicClient.InternalAuthenticate(webRequest, credentials);
}
// Token: 0x0600114E RID: 4430 RVA: 0x00032758 File Offset: 0x00030958
private static byte[] GetBytes(string str)
{
int i = str.Length;
byte[] array = new byte[i];
for (i--; i >= 0; i--)
{
array[i] = (byte)str[i];
}
return array;
}
// Token: 0x0600114F RID: 4431 RVA: 0x00032794 File Offset: 0x00030994
private static Authorization InternalAuthenticate(WebRequest webRequest, ICredentials credentials)
{
HttpWebRequest httpWebRequest = webRequest as HttpWebRequest;
if (httpWebRequest == null || credentials == null)
{
return null;
}
NetworkCredential credential = credentials.GetCredential(httpWebRequest.AuthUri, "basic");
if (credential == null)
{
return null;
}
string userName = credential.UserName;
if (userName == null || userName == string.Empty)
{
return null;
}
string password = credential.Password;
string domain = credential.Domain;
byte[] array;
if (domain == null || domain == string.Empty || domain.Trim() == string.Empty)
{
array = BasicClient.GetBytes(userName + ":" + password);
}
else
{
array = BasicClient.GetBytes(string.Concat(new string[] { domain, "\\", userName, ":", password }));
}
string text = "Basic " + Convert.ToBase64String(array);
return new Authorization(text);
}
// Token: 0x06001150 RID: 4432 RVA: 0x00032890 File Offset: 0x00030A90
public Authorization PreAuthenticate(WebRequest webRequest, ICredentials credentials)
{
return BasicClient.InternalAuthenticate(webRequest, credentials);
}
// Token: 0x170005B3 RID: 1459
// (get) Token: 0x06001151 RID: 4433 RVA: 0x0003289C File Offset: 0x00030A9C
public string AuthenticationType
{
get
{
return "Basic";
}
}
// Token: 0x170005B4 RID: 1460
// (get) Token: 0x06001152 RID: 4434 RVA: 0x000328A4 File Offset: 0x00030AA4
public bool CanPreAuthenticate
{
get
{
return true;
}
}
}
}
+15
View File
@@ -0,0 +1,15 @@
using System;
namespace System.Net
{
/// <summary>Represents the method that specifies a local Internet Protocol address and port number for a <see cref="T:System.Net.ServicePoint" />.</summary>
/// <returns>The local <see cref="T:System.Net.IPEndPoint" /> to which the <see cref="T:System.Net.ServicePoint" /> is bound.</returns>
/// <param name="servicePoint">The <see cref="T:System.Net.ServicePoint" /> associated with the connection to be created.</param>
/// <param name="remoteEndPoint">The remote <see cref="T:System.Net.IPEndPoint" /> that specifies the remote host.</param>
/// <param name="retryCount">The number of times this delegate was called for a specified connection.</param>
/// <exception cref="T:System.OverflowException">
/// <paramref name="retryCount" /> is equal to <see cref="F:System.Int32.MaxValue" /></exception>
// Token: 0x02000334 RID: 820
// (Invoke) Token: 0x06001CA9 RID: 7337
public delegate IPEndPoint BindIPEndPoint(ServicePoint servicePoint, IPEndPoint remoteEndPoint, int retryCount);
}
+30
View File
@@ -0,0 +1,30 @@
using System;
namespace System.Net.Cache
{
/// <summary>Specifies the meaning of time values that control caching behavior for resources obtained using <see cref="T:System.Net.HttpWebRequest" /> objects.</summary>
// Token: 0x02000130 RID: 304
public enum HttpCacheAgeControl
{
/// <summary>For internal use only. The Framework will throw an <see cref="T:System.ArgumentException" /> if you try to use this member.</summary>
// Token: 0x04000AD9 RID: 2777
None,
/// <summary>Content can be taken from the cache if the time remaining before expiration is greater than or equal to the time specified with this value.</summary>
// Token: 0x04000ADA RID: 2778
MinFresh,
/// <summary>Content can be taken from the cache until it is older than the age specified with this value.</summary>
// Token: 0x04000ADB RID: 2779
MaxAge,
/// <summary>
/// <see cref="P:System.Net.Cache.HttpRequestCachePolicy.MaxAge" /> and <see cref="P:System.Net.Cache.HttpRequestCachePolicy.MinFresh" />.</summary>
// Token: 0x04000ADC RID: 2780
MaxAgeAndMinFresh,
/// <summary>Content can be taken from the cache after it has expired, until the time specified with this value elapses.</summary>
// Token: 0x04000ADD RID: 2781
MaxStale,
/// <summary>
/// <see cref="P:System.Net.Cache.HttpRequestCachePolicy.MaxAge" /> and <see cref="P:System.Net.Cache.HttpRequestCachePolicy.MaxStale" />.</summary>
// Token: 0x04000ADE RID: 2782
MaxAgeAndMaxStale = 6
}
}
+37
View File
@@ -0,0 +1,37 @@
using System;
namespace System.Net.Cache
{
/// <summary>Specifies caching behavior for resources obtained using the Hypertext Transfer protocol (HTTP).</summary>
// Token: 0x02000131 RID: 305
public enum HttpRequestCacheLevel
{
/// <summary>Satisfies a request for a resource either by using the cached copy of the resource or by sending a request for the resource to the server. The action taken is determined by the current cache policy and the age of the content in the cache. This is the cache level that should be used by most applications.</summary>
// Token: 0x04000AE0 RID: 2784
Default,
/// <summary>Satisfies a request by using the server. No entries are taken from caches, added to caches, or removed from caches between the client and server. This is the default cache behavior specified in the machine configuration file that ships with the .NET Framework.</summary>
// Token: 0x04000AE1 RID: 2785
BypassCache,
/// <summary>Satisfies a request using the locally cached resource; does not send a request for an item that is not in the cache. When this cache policy level is specified, a <see cref="T:System.Net.WebException" /> exception is thrown if the item is not in the client cache.</summary>
// Token: 0x04000AE2 RID: 2786
CacheOnly,
/// <summary>Satisfies a request for a resource from the cache if the resource is available; otherwise, sends a request for a resource to the server. If the requested item is available in any cache between the client and the server, the request might be satisfied by the intermediate cache.</summary>
// Token: 0x04000AE3 RID: 2787
CacheIfAvailable,
/// <summary>Compares the copy of the resource in the cache with the copy on the server. If the copy on the server is newer, it is used to satisfy the request and replaces the copy in the cache. If the copy in the cache is the same as the server copy, the cached copy is used. In the HTTP caching protocol, this is achieved using a conditional request.</summary>
// Token: 0x04000AE4 RID: 2788
Revalidate,
/// <summary>Satisfies a request by using the server. The response might be saved in the cache. In the HTTP caching protocol, this is achieved using the no-cache cache control directive and the no-cache Pragma header.</summary>
// Token: 0x04000AE5 RID: 2789
Reload,
/// <summary>Never satisfies a request by using resources from the cache and does not cache resources. If the resource is present in the local cache, it is removed. This policy level indicates to intermediate caches that they should remove the resource. In the HTTP caching protocol, this is achieved using the no-cache cache control directive.</summary>
// Token: 0x04000AE6 RID: 2790
NoCacheNoStore,
/// <summary>Satisfies a request for a resource either from the local computer's cache or a remote cache on the local area network. If the request cannot be satisfied, a <see cref="T:System.Net.WebException" /> exception is thrown. In the HTTP caching protocol, this is achieved using the only-if-cached cache control directive.</summary>
// Token: 0x04000AE7 RID: 2791
CacheOrNextCacheOnly,
/// <summary>Satisfies a request by using the server or a cache other than the local cache. Before the request can be satisfied by an intermediate cache, that cache must revalidate its cached entry with the server. In the HTTP caching protocol, this is achieved using the max-age = 0 cache control directive and the no-cache Pragma header.</summary>
// Token: 0x04000AE8 RID: 2792
Refresh
}
}
+170
View File
@@ -0,0 +1,170 @@
using System;
namespace System.Net.Cache
{
/// <summary>Defines an application's caching requirements for resources obtained by using <see cref="T:System.Net.HttpWebRequest" /> objects.</summary>
// Token: 0x02000132 RID: 306
public class HttpRequestCachePolicy : RequestCachePolicy
{
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Cache.HttpRequestCachePolicy" /> class. </summary>
// Token: 0x06000A72 RID: 2674 RVA: 0x0001D918 File Offset: 0x0001BB18
public HttpRequestCachePolicy()
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Cache.HttpRequestCachePolicy" /> class using the specified cache synchronization date.</summary>
/// <param name="cacheSyncDate">A <see cref="T:System.DateTime" /> object that specifies the time when resources stored in the cache must be revalidated.</param>
// Token: 0x06000A73 RID: 2675 RVA: 0x0001D920 File Offset: 0x0001BB20
public HttpRequestCachePolicy(DateTime cacheSyncDate)
{
this.cacheSyncDate = cacheSyncDate;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Cache.HttpRequestCachePolicy" /> class using the specified cache policy.</summary>
/// <param name="level">An <see cref="T:System.Net.Cache.HttpRequestCacheLevel" /> value. </param>
// Token: 0x06000A74 RID: 2676 RVA: 0x0001D930 File Offset: 0x0001BB30
public HttpRequestCachePolicy(HttpRequestCacheLevel level)
{
this.level = level;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Cache.HttpRequestCachePolicy" /> class using the specified age control and time values. </summary>
/// <param name="cacheAgeControl">One of the following <see cref="T:System.Net.Cache.HttpCacheAgeControl" /> enumeration values: <see cref="F:System.Net.Cache.HttpCacheAgeControl.MaxAge" />, <see cref="F:System.Net.Cache.HttpCacheAgeControl.MaxStale" />, or <see cref="F:System.Net.Cache.HttpCacheAgeControl.MinFresh" />.</param>
/// <param name="ageOrFreshOrStale">A <see cref="T:System.TimeSpan" /> value that specifies an amount of time. See the Remarks section for more information. </param>
/// <exception cref="T:System.ArgumentException">The value specified for the <paramref name="cacheAgeControl" /> parameter cannot be used with this constructor.</exception>
// Token: 0x06000A75 RID: 2677 RVA: 0x0001D940 File Offset: 0x0001BB40
public HttpRequestCachePolicy(HttpCacheAgeControl cacheAgeControl, TimeSpan ageOrFreshOrStale)
{
switch (cacheAgeControl)
{
case HttpCacheAgeControl.MinFresh:
this.minFresh = ageOrFreshOrStale;
return;
case HttpCacheAgeControl.MaxAge:
this.maxAge = ageOrFreshOrStale;
return;
case HttpCacheAgeControl.MaxStale:
this.maxStale = ageOrFreshOrStale;
return;
}
throw new ArgumentException("ageOrFreshOrStale");
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Cache.HttpRequestCachePolicy" /> class using the specified maximum age, age control value, and time value.</summary>
/// <param name="cacheAgeControl">An <see cref="T:System.Net.Cache.HttpCacheAgeControl" /> value. </param>
/// <param name="maxAge">A <see cref="T:System.TimeSpan" /> value that specifies the maximum age for resources.</param>
/// <param name="freshOrStale">A <see cref="T:System.TimeSpan" /> value that specifies an amount of time. See the Remarks section for more information.  </param>
/// <exception cref="T:System.ArgumentException">The value specified for the <paramref name="cacheAgeControl" /> parameter is not valid.</exception>
// Token: 0x06000A76 RID: 2678 RVA: 0x0001D9A4 File Offset: 0x0001BBA4
public HttpRequestCachePolicy(HttpCacheAgeControl cacheAgeControl, TimeSpan maxAge, TimeSpan freshOrStale)
{
this.maxAge = maxAge;
switch (cacheAgeControl)
{
case HttpCacheAgeControl.MinFresh:
this.minFresh = freshOrStale;
return;
case HttpCacheAgeControl.MaxStale:
this.maxStale = freshOrStale;
return;
}
throw new ArgumentException("freshOrStale");
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Cache.HttpRequestCachePolicy" /> class using the specified maximum age, age control value, time value, and cache synchronization date.</summary>
/// <param name="cacheAgeControl">An <see cref="T:System.Net.Cache.HttpCacheAgeControl" /> value. </param>
/// <param name="maxAge">A <see cref="T:System.TimeSpan" /> value that specifies the maximum age for resources.</param>
/// <param name="freshOrStale">A <see cref="T:System.TimeSpan" /> value that specifies an amount of time. See the Remarks section for more information.  </param>
/// <param name="cacheSyncDate">A <see cref="T:System.DateTime" /> object that specifies the time when resources stored in the cache must be revalidated.</param>
// Token: 0x06000A77 RID: 2679 RVA: 0x0001DA00 File Offset: 0x0001BC00
public HttpRequestCachePolicy(HttpCacheAgeControl cacheAgeControl, TimeSpan maxAge, TimeSpan freshOrStale, DateTime cacheSyncDate)
: this(cacheAgeControl, maxAge, freshOrStale)
{
this.cacheSyncDate = cacheSyncDate;
}
/// <summary>Gets the cache synchronization date for this instance.</summary>
/// <returns>A <see cref="T:System.DateTime" /> value set to the date specified when this instance was created. If no date was specified, this property's value is <see cref="F:System.DateTime.MinValue" />.</returns>
// Token: 0x170002A5 RID: 677
// (get) Token: 0x06000A78 RID: 2680 RVA: 0x0001DA14 File Offset: 0x0001BC14
public DateTime CacheSyncDate
{
get
{
return this.cacheSyncDate;
}
}
/// <summary>Gets the <see cref="T:System.Net.Cache.HttpRequestCacheLevel" /> value that was specified when this instance was created.</summary>
/// <returns>A <see cref="T:System.Net.Cache.HttpRequestCacheLevel" /> value that specifies the cache behavior for resources that were obtained using <see cref="T:System.Net.HttpWebRequest" /> objects.</returns>
// Token: 0x170002A6 RID: 678
// (get) Token: 0x06000A79 RID: 2681 RVA: 0x0001DA1C File Offset: 0x0001BC1C
public new HttpRequestCacheLevel Level
{
get
{
return this.level;
}
}
/// <summary>Gets the maximum age permitted for a resource returned from the cache.</summary>
/// <returns>A <see cref="T:System.TimeSpan" /> value that is set to the maximum age value specified when this instance was created. If no date was specified, this property's value is <see cref="F:System.DateTime.MinValue" />.</returns>
// Token: 0x170002A7 RID: 679
// (get) Token: 0x06000A7A RID: 2682 RVA: 0x0001DA24 File Offset: 0x0001BC24
public TimeSpan MaxAge
{
get
{
return this.maxAge;
}
}
/// <summary>Gets the maximum staleness value that is permitted for a resource returned from the cache.</summary>
/// <returns>A <see cref="T:System.TimeSpan" /> value that is set to the maximum staleness value specified when this instance was created. If no date was specified, this property's value is <see cref="F:System.DateTime.MinValue" />.</returns>
// Token: 0x170002A8 RID: 680
// (get) Token: 0x06000A7B RID: 2683 RVA: 0x0001DA2C File Offset: 0x0001BC2C
public TimeSpan MaxStale
{
get
{
return this.maxStale;
}
}
/// <summary>Gets the minimum freshness that is permitted for a resource returned from the cache.</summary>
/// <returns>A <see cref="T:System.TimeSpan" /> value that specifies the minimum freshness specified when this instance was created. If no date was specified, this property's value is <see cref="F:System.DateTime.MinValue" />.</returns>
// Token: 0x170002A9 RID: 681
// (get) Token: 0x06000A7C RID: 2684 RVA: 0x0001DA34 File Offset: 0x0001BC34
public TimeSpan MinFresh
{
get
{
return this.minFresh;
}
}
/// <summary>Returns a string representation of this instance.</summary>
/// <returns>A <see cref="T:System.String" /> value that contains the property values for this instance.</returns>
// Token: 0x06000A7D RID: 2685 RVA: 0x0001DA3C File Offset: 0x0001BC3C
[global::System.MonoTODO]
public override string ToString()
{
throw new NotImplementedException();
}
// Token: 0x04000AE9 RID: 2793
private DateTime cacheSyncDate;
// Token: 0x04000AEA RID: 2794
private HttpRequestCacheLevel level;
// Token: 0x04000AEB RID: 2795
private TimeSpan maxAge;
// Token: 0x04000AEC RID: 2796
private TimeSpan maxStale;
// Token: 0x04000AED RID: 2797
private TimeSpan minFresh;
}
}
+31
View File
@@ -0,0 +1,31 @@
using System;
namespace System.Net.Cache
{
/// <summary>Specifies caching behavior for resources obtained using <see cref="T:System.Net.WebRequest" /> and its derived classes.</summary>
// Token: 0x02000133 RID: 307
public enum RequestCacheLevel
{
/// <summary>Satisfies a request for a resource either by using the cached copy of the resource or by sending a request for the resource to the server. The action taken is determined by the current cache policy and the age of the content in the cache. This is the cache level that should be used by most applications.</summary>
// Token: 0x04000AEF RID: 2799
Default,
/// <summary>Satisfies a request by using the server. No entries are taken from caches, added to caches, or removed from caches between the client and server. This is the default cache behavior specified in the machine configuration file that ships with the .NET Framework.</summary>
// Token: 0x04000AF0 RID: 2800
BypassCache,
/// <summary>Satisfies a request using the locally cached resource; does not send a request for an item that is not in the cache. When this cache policy level is specified, a <see cref="T:System.Net.WebException" /> exception is thrown if the item is not in the client cache.</summary>
// Token: 0x04000AF1 RID: 2801
CacheOnly,
/// <summary>Satisfies a request for a resource from the cache, if the resource is available; otherwise, sends a request for a resource to the server. If the requested item is available in any cache between the client and the server, the request might be satisfied by the intermediate cache.</summary>
// Token: 0x04000AF2 RID: 2802
CacheIfAvailable,
/// <summary>Satisfies a request by using the cached copy of the resource if the timestamp is the same as the timestamp of the resource on the server; otherwise, the resource is downloaded from the server, presented to the caller, and stored in the cache.</summary>
// Token: 0x04000AF3 RID: 2803
Revalidate,
/// <summary>Satisfies a request by using the server. The response might be saved in the cache. In the HTTP caching protocol, this is achieved using the no-cache cache control directive and the no-cache Pragma header.</summary>
// Token: 0x04000AF4 RID: 2804
Reload,
/// <summary>Never satisfies a request by using resources from the cache and does not cache resources. If the resource is present in the local cache, it is removed. This policy level indicates to intermediate caches that they should remove the resource. In the HTTP caching protocol, this is achieved using the no-cache cache control directive.</summary>
// Token: 0x04000AF5 RID: 2805
NoCacheNoStore
}
}
+48
View File
@@ -0,0 +1,48 @@
using System;
namespace System.Net.Cache
{
/// <summary>Defines an application's caching requirements for resources obtained by using <see cref="T:System.Net.WebRequest" /> objects.</summary>
// Token: 0x02000134 RID: 308
public class RequestCachePolicy
{
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Cache.RequestCachePolicy" /> class. </summary>
// Token: 0x06000A7E RID: 2686 RVA: 0x0001DA44 File Offset: 0x0001BC44
public RequestCachePolicy()
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Cache.RequestCachePolicy" /> class. using the specified cache policy.</summary>
/// <param name="level">A <see cref="T:System.Net.Cache.RequestCacheLevel" /> that specifies the cache behavior for resources obtained using <see cref="T:System.Net.WebRequest" /> objects. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">level is not a valid <see cref="T:System.Net.Cache.RequestCacheLevel" />.value.</exception>
// Token: 0x06000A7F RID: 2687 RVA: 0x0001DA4C File Offset: 0x0001BC4C
public RequestCachePolicy(RequestCacheLevel level)
{
this.level = level;
}
/// <summary>Gets the <see cref="T:System.Net.Cache.RequestCacheLevel" /> value specified when this instance was constructed.</summary>
/// <returns>A <see cref="T:System.Net.Cache.RequestCacheLevel" /> value that specifies the cache behavior for resources obtained using <see cref="T:System.Net.WebRequest" /> objects.</returns>
// Token: 0x170002AA RID: 682
// (get) Token: 0x06000A80 RID: 2688 RVA: 0x0001DA5C File Offset: 0x0001BC5C
public RequestCacheLevel Level
{
get
{
return this.level;
}
}
/// <summary>Returns a string representation of this instance.</summary>
/// <returns>A <see cref="T:System.String" /> containing the <see cref="P:System.Net.Cache.RequestCachePolicy.Level" /> for this instance.</returns>
// Token: 0x06000A81 RID: 2689 RVA: 0x0001DA64 File Offset: 0x0001BC64
[global::System.MonoTODO]
public override string ToString()
{
throw new NotImplementedException();
}
// Token: 0x04000AF6 RID: 2806
private RequestCacheLevel level;
}
}
+403
View File
@@ -0,0 +1,403 @@
using System;
using System.Collections;
using System.Globalization;
using System.IO;
using System.Text;
namespace System.Net
{
// Token: 0x020001FF RID: 511
internal class ChunkStream
{
// Token: 0x06001153 RID: 4435 RVA: 0x000328A8 File Offset: 0x00030AA8
public ChunkStream(byte[] buffer, int offset, int size, WebHeaderCollection headers)
: this(headers)
{
this.Write(buffer, offset, size);
}
// Token: 0x06001154 RID: 4436 RVA: 0x000328BC File Offset: 0x00030ABC
public ChunkStream(WebHeaderCollection headers)
{
this.headers = headers;
this.saved = new StringBuilder();
this.chunks = new ArrayList();
this.chunkSize = -1;
}
// Token: 0x06001155 RID: 4437 RVA: 0x000328F4 File Offset: 0x00030AF4
public void ResetBuffer()
{
this.chunkSize = -1;
this.chunkRead = 0;
this.chunks.Clear();
}
// Token: 0x06001156 RID: 4438 RVA: 0x00032910 File Offset: 0x00030B10
public void WriteAndReadBack(byte[] buffer, int offset, int size, ref int read)
{
if (offset + read > 0)
{
this.Write(buffer, offset, offset + read);
}
read = this.Read(buffer, offset, size);
}
// Token: 0x06001157 RID: 4439 RVA: 0x00032944 File Offset: 0x00030B44
public int Read(byte[] buffer, int offset, int size)
{
return this.ReadFromChunks(buffer, offset, size);
}
// Token: 0x06001158 RID: 4440 RVA: 0x00032950 File Offset: 0x00030B50
private int ReadFromChunks(byte[] buffer, int offset, int size)
{
int count = this.chunks.Count;
int num = 0;
for (int i = 0; i < count; i++)
{
ChunkStream.Chunk chunk = (ChunkStream.Chunk)this.chunks[i];
if (chunk != null)
{
if (chunk.Offset == chunk.Bytes.Length)
{
this.chunks[i] = null;
}
else
{
num += chunk.Read(buffer, offset + num, size - num);
if (num == size)
{
break;
}
}
}
}
return num;
}
// Token: 0x06001159 RID: 4441 RVA: 0x000329DC File Offset: 0x00030BDC
public void Write(byte[] buffer, int offset, int size)
{
this.InternalWrite(buffer, ref offset, size);
}
// Token: 0x0600115A RID: 4442 RVA: 0x000329E8 File Offset: 0x00030BE8
private void InternalWrite(byte[] buffer, ref int offset, int size)
{
if (this.state == ChunkStream.State.None)
{
this.state = this.GetChunkSize(buffer, ref offset, size);
if (this.state == ChunkStream.State.None)
{
return;
}
this.saved.Length = 0;
this.sawCR = false;
this.gotit = false;
}
if (this.state == ChunkStream.State.Body && offset < size)
{
this.state = this.ReadBody(buffer, ref offset, size);
if (this.state == ChunkStream.State.Body)
{
return;
}
}
if (this.state == ChunkStream.State.BodyFinished && offset < size)
{
this.state = this.ReadCRLF(buffer, ref offset, size);
if (this.state == ChunkStream.State.BodyFinished)
{
return;
}
this.sawCR = false;
}
if (this.state == ChunkStream.State.Trailer && offset < size)
{
this.state = this.ReadTrailer(buffer, ref offset, size);
if (this.state == ChunkStream.State.Trailer)
{
return;
}
this.saved.Length = 0;
this.sawCR = false;
this.gotit = false;
}
if (offset < size)
{
this.InternalWrite(buffer, ref offset, size);
}
}
// Token: 0x170005B5 RID: 1461
// (get) Token: 0x0600115B RID: 4443 RVA: 0x00032AF8 File Offset: 0x00030CF8
public bool WantMore
{
get
{
return this.chunkRead != this.chunkSize || this.chunkSize != 0 || this.state != ChunkStream.State.None;
}
}
// Token: 0x170005B6 RID: 1462
// (get) Token: 0x0600115C RID: 4444 RVA: 0x00032B28 File Offset: 0x00030D28
public int ChunkLeft
{
get
{
return this.chunkSize - this.chunkRead;
}
}
// Token: 0x0600115D RID: 4445 RVA: 0x00032B38 File Offset: 0x00030D38
private ChunkStream.State ReadBody(byte[] buffer, ref int offset, int size)
{
if (this.chunkSize == 0)
{
return ChunkStream.State.BodyFinished;
}
int num = size - offset;
if (num + this.chunkRead > this.chunkSize)
{
num = this.chunkSize - this.chunkRead;
}
byte[] array = new byte[num];
Buffer.BlockCopy(buffer, offset, array, 0, num);
this.chunks.Add(new ChunkStream.Chunk(array));
offset += num;
this.chunkRead += num;
return (this.chunkRead != this.chunkSize) ? ChunkStream.State.Body : ChunkStream.State.BodyFinished;
}
// Token: 0x0600115E RID: 4446 RVA: 0x00032BC8 File Offset: 0x00030DC8
private ChunkStream.State GetChunkSize(byte[] buffer, ref int offset, int size)
{
char c = '\0';
while (offset < size)
{
c = (char)buffer[offset++];
if (c == '\r')
{
if (this.sawCR)
{
ChunkStream.ThrowProtocolViolation("2 CR found");
}
this.sawCR = true;
}
else
{
if (this.sawCR && c == '\n')
{
break;
}
if (c == ' ')
{
this.gotit = true;
}
if (!this.gotit)
{
this.saved.Append(c);
}
if (this.saved.Length > 20)
{
ChunkStream.ThrowProtocolViolation("chunk size too long.");
}
}
}
if (!this.sawCR || c != '\n')
{
if (offset < size)
{
ChunkStream.ThrowProtocolViolation("Missing \\n");
}
try
{
if (this.saved.Length > 0)
{
this.chunkSize = int.Parse(ChunkStream.RemoveChunkExtension(this.saved.ToString()), NumberStyles.HexNumber);
}
}
catch (Exception)
{
ChunkStream.ThrowProtocolViolation("Cannot parse chunk size.");
}
return ChunkStream.State.None;
}
this.chunkRead = 0;
try
{
this.chunkSize = int.Parse(ChunkStream.RemoveChunkExtension(this.saved.ToString()), NumberStyles.HexNumber);
}
catch (Exception)
{
ChunkStream.ThrowProtocolViolation("Cannot parse chunk size.");
}
if (this.chunkSize == 0)
{
this.trailerState = 2;
return ChunkStream.State.Trailer;
}
return ChunkStream.State.Body;
}
// Token: 0x0600115F RID: 4447 RVA: 0x00032D68 File Offset: 0x00030F68
private static string RemoveChunkExtension(string input)
{
int num = input.IndexOf(';');
if (num == -1)
{
return input;
}
return input.Substring(0, num);
}
// Token: 0x06001160 RID: 4448 RVA: 0x00032D90 File Offset: 0x00030F90
private ChunkStream.State ReadCRLF(byte[] buffer, ref int offset, int size)
{
if (!this.sawCR)
{
if ((ushort)buffer[offset++] != 13)
{
ChunkStream.ThrowProtocolViolation("Expecting \\r");
}
this.sawCR = true;
if (offset == size)
{
return ChunkStream.State.BodyFinished;
}
}
if (this.sawCR && (ushort)buffer[offset++] != 10)
{
ChunkStream.ThrowProtocolViolation("Expecting \\n");
}
return ChunkStream.State.None;
}
// Token: 0x06001161 RID: 4449 RVA: 0x00032E00 File Offset: 0x00031000
private ChunkStream.State ReadTrailer(byte[] buffer, ref int offset, int size)
{
if (this.trailerState == 2 && (ushort)buffer[offset] == 13 && this.saved.Length == 0)
{
offset++;
if (offset < size && (ushort)buffer[offset] == 10)
{
offset++;
return ChunkStream.State.None;
}
offset--;
}
int num = this.trailerState;
string text = "\r\n\r";
while (offset < size && num < 4)
{
char c = (char)buffer[offset++];
if ((num == 0 || num == 2) && c == '\r')
{
num++;
}
else if ((num == 1 || num == 3) && c == '\n')
{
num++;
}
else if (num > 0)
{
this.saved.Append(text.Substring(0, (this.saved.Length != 0) ? num : (num - 2)));
num = 0;
if (this.saved.Length > 4196)
{
ChunkStream.ThrowProtocolViolation("Error reading trailer (too long).");
}
}
}
if (num < 4)
{
this.trailerState = num;
if (offset < size)
{
ChunkStream.ThrowProtocolViolation("Error reading trailer.");
}
return ChunkStream.State.Trailer;
}
StringReader stringReader = new StringReader(this.saved.ToString());
string text2;
while ((text2 = stringReader.ReadLine()) != null && text2 != string.Empty)
{
this.headers.Add(text2);
}
return ChunkStream.State.None;
}
// Token: 0x06001162 RID: 4450 RVA: 0x00032F88 File Offset: 0x00031188
private static void ThrowProtocolViolation(string message)
{
WebException ex = new WebException(message, null, WebExceptionStatus.ServerProtocolViolation, null);
throw ex;
}
// Token: 0x04000F5A RID: 3930
internal WebHeaderCollection headers;
// Token: 0x04000F5B RID: 3931
private int chunkSize;
// Token: 0x04000F5C RID: 3932
private int chunkRead;
// Token: 0x04000F5D RID: 3933
private ChunkStream.State state;
// Token: 0x04000F5E RID: 3934
private StringBuilder saved;
// Token: 0x04000F5F RID: 3935
private bool sawCR;
// Token: 0x04000F60 RID: 3936
private bool gotit;
// Token: 0x04000F61 RID: 3937
private int trailerState;
// Token: 0x04000F62 RID: 3938
private ArrayList chunks;
// Token: 0x02000200 RID: 512
private enum State
{
// Token: 0x04000F64 RID: 3940
None,
// Token: 0x04000F65 RID: 3941
Body,
// Token: 0x04000F66 RID: 3942
BodyFinished,
// Token: 0x04000F67 RID: 3943
Trailer
}
// Token: 0x02000201 RID: 513
private class Chunk
{
// Token: 0x06001163 RID: 4451 RVA: 0x00032FA4 File Offset: 0x000311A4
public Chunk(byte[] chunk)
{
this.Bytes = chunk;
}
// Token: 0x06001164 RID: 4452 RVA: 0x00032FB4 File Offset: 0x000311B4
public int Read(byte[] buffer, int offset, int size)
{
int num = ((size <= this.Bytes.Length - this.Offset) ? size : (this.Bytes.Length - this.Offset));
Buffer.BlockCopy(this.Bytes, this.Offset, buffer, offset, num);
this.Offset += num;
return num;
}
// Token: 0x04000F68 RID: 3944
public byte[] Bytes;
// Token: 0x04000F69 RID: 3945
public int Offset;
}
}
}
+200
View File
@@ -0,0 +1,200 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace System.Net
{
// Token: 0x02000202 RID: 514
internal class ChunkedInputStream : RequestStream
{
// Token: 0x06001165 RID: 4453 RVA: 0x00033010 File Offset: 0x00031210
public ChunkedInputStream(HttpListenerContext context, Stream stream, byte[] buffer, int offset, int length)
: base(stream, buffer, offset, length)
{
this.context = context;
WebHeaderCollection webHeaderCollection = (WebHeaderCollection)context.Request.Headers;
this.decoder = new ChunkStream(webHeaderCollection);
}
// Token: 0x170005B7 RID: 1463
// (get) Token: 0x06001166 RID: 4454 RVA: 0x00033050 File Offset: 0x00031250
// (set) Token: 0x06001167 RID: 4455 RVA: 0x00033058 File Offset: 0x00031258
public ChunkStream Decoder
{
get
{
return this.decoder;
}
set
{
this.decoder = value;
}
}
// Token: 0x06001168 RID: 4456 RVA: 0x00033064 File Offset: 0x00031264
public override int Read([In] [Out] byte[] buffer, int offset, int count)
{
IAsyncResult asyncResult = this.BeginRead(buffer, offset, count, null, null);
return this.EndRead(asyncResult);
}
// Token: 0x06001169 RID: 4457 RVA: 0x00033084 File Offset: 0x00031284
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback cback, object state)
{
if (this.disposed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
int num = buffer.Length;
if (offset < 0 || offset > num)
{
throw new ArgumentOutOfRangeException("offset exceeds the size of buffer");
}
if (count < 0 || offset > num - count)
{
throw new ArgumentOutOfRangeException("offset+size exceeds the size of buffer");
}
HttpStreamAsyncResult httpStreamAsyncResult = new HttpStreamAsyncResult();
httpStreamAsyncResult.Callback = cback;
httpStreamAsyncResult.State = state;
if (this.no_more_data)
{
httpStreamAsyncResult.Complete();
return httpStreamAsyncResult;
}
int num2 = this.decoder.Read(buffer, offset, count);
offset += num2;
count -= num2;
if (count == 0)
{
httpStreamAsyncResult.Count = num2;
httpStreamAsyncResult.Complete();
return httpStreamAsyncResult;
}
if (!this.decoder.WantMore)
{
this.no_more_data = num2 == 0;
httpStreamAsyncResult.Count = num2;
httpStreamAsyncResult.Complete();
return httpStreamAsyncResult;
}
httpStreamAsyncResult.Buffer = new byte[8192];
httpStreamAsyncResult.Offset = 0;
httpStreamAsyncResult.Count = 8192;
ChunkedInputStream.ReadBufferState readBufferState = new ChunkedInputStream.ReadBufferState(buffer, offset, count, httpStreamAsyncResult);
readBufferState.InitialCount += num2;
base.BeginRead(httpStreamAsyncResult.Buffer, httpStreamAsyncResult.Offset, httpStreamAsyncResult.Count, new AsyncCallback(this.OnRead), readBufferState);
return httpStreamAsyncResult;
}
// Token: 0x0600116A RID: 4458 RVA: 0x000331D8 File Offset: 0x000313D8
private void OnRead(IAsyncResult base_ares)
{
ChunkedInputStream.ReadBufferState readBufferState = (ChunkedInputStream.ReadBufferState)base_ares.AsyncState;
HttpStreamAsyncResult ares = readBufferState.Ares;
try
{
int num = base.EndRead(base_ares);
this.decoder.Write(ares.Buffer, ares.Offset, num);
num = this.decoder.Read(readBufferState.Buffer, readBufferState.Offset, readBufferState.Count);
readBufferState.Offset += num;
readBufferState.Count -= num;
if (readBufferState.Count == 0 || !this.decoder.WantMore || num == 0)
{
this.no_more_data = !this.decoder.WantMore && num == 0;
ares.Count = readBufferState.InitialCount - readBufferState.Count;
ares.Complete();
}
else
{
ares.Offset = 0;
ares.Count = Math.Min(8192, this.decoder.ChunkLeft + 6);
base.BeginRead(ares.Buffer, ares.Offset, ares.Count, new AsyncCallback(this.OnRead), readBufferState);
}
}
catch (Exception ex)
{
this.context.Connection.SendError(ex.Message, 400);
ares.Complete(ex);
}
}
// Token: 0x0600116B RID: 4459 RVA: 0x00033344 File Offset: 0x00031544
public override int EndRead(IAsyncResult ares)
{
if (this.disposed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
HttpStreamAsyncResult httpStreamAsyncResult = ares as HttpStreamAsyncResult;
if (ares == null)
{
throw new ArgumentException("Invalid IAsyncResult", "ares");
}
if (!ares.IsCompleted)
{
ares.AsyncWaitHandle.WaitOne();
}
if (httpStreamAsyncResult.Error != null)
{
throw new HttpListenerException(400, "I/O operation aborted.");
}
return httpStreamAsyncResult.Count;
}
// Token: 0x0600116C RID: 4460 RVA: 0x000333C4 File Offset: 0x000315C4
public override void Close()
{
if (!this.disposed)
{
this.disposed = true;
base.Close();
}
}
// Token: 0x04000F6A RID: 3946
private bool disposed;
// Token: 0x04000F6B RID: 3947
private ChunkStream decoder;
// Token: 0x04000F6C RID: 3948
private HttpListenerContext context;
// Token: 0x04000F6D RID: 3949
private bool no_more_data;
// Token: 0x02000203 RID: 515
private class ReadBufferState
{
// Token: 0x0600116D RID: 4461 RVA: 0x000333E0 File Offset: 0x000315E0
public ReadBufferState(byte[] buffer, int offset, int count, HttpStreamAsyncResult ares)
{
this.Buffer = buffer;
this.Offset = offset;
this.Count = count;
this.InitialCount = count;
this.Ares = ares;
}
// Token: 0x04000F6E RID: 3950
public byte[] Buffer;
// Token: 0x04000F6F RID: 3951
public int Offset;
// Token: 0x04000F70 RID: 3952
public int Count;
// Token: 0x04000F71 RID: 3953
public int InitialCount;
// Token: 0x04000F72 RID: 3954
public HttpStreamAsyncResult Ares;
}
}
}
+9
View File
@@ -0,0 +1,9 @@
using System;
namespace System.Net.Configuration
{
// Token: 0x0200026E RID: 622
internal class Dummy
{
}
}
+17
View File
@@ -0,0 +1,17 @@
using System;
namespace System.Net
{
// Token: 0x02000204 RID: 516
internal enum ConnectionModes
{
// Token: 0x04000F74 RID: 3956
Single,
// Token: 0x04000F75 RID: 3957
Persistent,
// Token: 0x04000F76 RID: 3958
Pipeline,
// Token: 0x04000F77 RID: 3959
Mux
}
}
+569
View File
@@ -0,0 +1,569 @@
using System;
using System.Collections;
using System.Globalization;
using System.Text;
namespace System.Net
{
/// <summary>Provides a set of properties and methods that are used to manage cookies. This class cannot be inherited.</summary>
// Token: 0x02000205 RID: 517
[Serializable]
public sealed class Cookie
{
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Cookie" /> class.</summary>
// Token: 0x0600116E RID: 4462 RVA: 0x00033418 File Offset: 0x00031618
public Cookie()
{
this.expires = DateTime.MinValue;
this.timestamp = DateTime.Now;
this.domain = string.Empty;
this.name = string.Empty;
this.val = string.Empty;
this.comment = string.Empty;
this.port = string.Empty;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Cookie" /> class with a specified <see cref="P:System.Net.Cookie.Name" /> and <see cref="P:System.Net.Cookie.Value" />.</summary>
/// <param name="name">The name of a <see cref="T:System.Net.Cookie" />. The following characters must not be used inside <paramref name="name" />: equal sign, semicolon, comma, newline (\n), return (\r), tab (\t), and space character. The dollar sign character ("$") cannot be the first character. </param>
/// <param name="value">The value of a <see cref="T:System.Net.Cookie" />. The following characters must not be used inside <paramref name="value" />: semicolon, comma. </param>
/// <exception cref="T:System.Net.CookieException">The <paramref name="name" /> parameter is null. -or- The <paramref name="name" /> parameter is of zero length. -or- The <paramref name="name" /> parameter contains an invalid character.-or- The <paramref name="value" /> parameter is null .-or - The <paramref name="value" /> parameter contains a string not enclosed in quotes that contains an invalid character. </exception>
// Token: 0x0600116F RID: 4463 RVA: 0x00033478 File Offset: 0x00031678
public Cookie(string name, string value)
: this()
{
this.Name = name;
this.Value = value;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Cookie" /> class with a specified <see cref="P:System.Net.Cookie.Name" />, <see cref="P:System.Net.Cookie.Value" />, and <see cref="P:System.Net.Cookie.Path" />.</summary>
/// <param name="name">The name of a <see cref="T:System.Net.Cookie" />. The following characters must not be used inside <paramref name="name" />: equal sign, semicolon, comma, newline (\n), return (\r), tab (\t), and space character. The dollar sign character ("$") cannot be the first character. </param>
/// <param name="value">The value of a <see cref="T:System.Net.Cookie" />. The following characters must not be used inside <paramref name="value" />: semicolon, comma. </param>
/// <param name="path">The subset of URIs on the origin server to which this <see cref="T:System.Net.Cookie" /> applies. The default value is "/". </param>
/// <exception cref="T:System.Net.CookieException">The <paramref name="name" /> parameter is null. -or- The <paramref name="name" /> parameter is of zero length. -or- The <paramref name="name" /> parameter contains an invalid character.-or- The <paramref name="value" /> parameter is null .-or - The <paramref name="value" /> parameter contains a string not enclosed in quotes that contains an invalid character.</exception>
// Token: 0x06001170 RID: 4464 RVA: 0x00033490 File Offset: 0x00031690
public Cookie(string name, string value, string path)
: this(name, value)
{
this.Path = path;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Cookie" /> class with a specified <see cref="P:System.Net.Cookie.Name" />, <see cref="P:System.Net.Cookie.Value" />, <see cref="P:System.Net.Cookie.Path" />, and <see cref="P:System.Net.Cookie.Domain" />.</summary>
/// <param name="name">The name of a <see cref="T:System.Net.Cookie" />. The following characters must not be used inside <paramref name="name" />: equal sign, semicolon, comma, newline (\n), return (\r), tab (\t), and space character. The dollar sign character ("$") cannot be the first character. </param>
/// <param name="value">The value of a <see cref="T:System.Net.Cookie" /> object. The following characters must not be used inside <paramref name="value" />: semicolon, comma. </param>
/// <param name="path">The subset of URIs on the origin server to which this <see cref="T:System.Net.Cookie" /> applies. The default value is "/". </param>
/// <param name="domain">The optional internet domain for which this <see cref="T:System.Net.Cookie" /> is valid. The default value is the host this <see cref="T:System.Net.Cookie" /> has been received from. </param>
/// <exception cref="T:System.Net.CookieException">The <paramref name="name" /> parameter is null. -or- The <paramref name="name" /> parameter is of zero length. -or- The <paramref name="name" /> parameter contains an invalid character.-or- The <paramref name="value" /> parameter is null .-or - The <paramref name="value" /> parameter contains a string not enclosed in quotes that contains an invalid character.</exception>
// Token: 0x06001171 RID: 4465 RVA: 0x000334A4 File Offset: 0x000316A4
public Cookie(string name, string value, string path, string domain)
: this(name, value, path)
{
this.Domain = domain;
}
/// <summary>Gets or sets a comment that the server can add to a <see cref="T:System.Net.Cookie" />.</summary>
/// <returns>An optional comment to document intended usage for this <see cref="T:System.Net.Cookie" />.</returns>
// Token: 0x170005B8 RID: 1464
// (get) Token: 0x06001173 RID: 4467 RVA: 0x000334F0 File Offset: 0x000316F0
// (set) Token: 0x06001174 RID: 4468 RVA: 0x000334F8 File Offset: 0x000316F8
public string Comment
{
get
{
return this.comment;
}
set
{
this.comment = ((value != null) ? value : string.Empty);
}
}
/// <summary>Gets or sets a URI comment that the server can provide with a <see cref="T:System.Net.Cookie" />.</summary>
/// <returns>An optional comment that represents the intended usage of the URI reference for this <see cref="T:System.Net.Cookie" />. The value must conform to URI format.</returns>
// Token: 0x170005B9 RID: 1465
// (get) Token: 0x06001175 RID: 4469 RVA: 0x00033514 File Offset: 0x00031714
// (set) Token: 0x06001176 RID: 4470 RVA: 0x0003351C File Offset: 0x0003171C
public global::System.Uri CommentUri
{
get
{
return this.commentUri;
}
set
{
this.commentUri = value;
}
}
/// <summary>Gets or sets the discard flag set by the server.</summary>
/// <returns>true if the client is to discard the <see cref="T:System.Net.Cookie" /> at the end of the current session; otherwise, false. The default is false.</returns>
// Token: 0x170005BA RID: 1466
// (get) Token: 0x06001177 RID: 4471 RVA: 0x00033528 File Offset: 0x00031728
// (set) Token: 0x06001178 RID: 4472 RVA: 0x00033530 File Offset: 0x00031730
public bool Discard
{
get
{
return this.discard;
}
set
{
this.discard = value;
}
}
/// <summary>Gets or sets the URI for which the <see cref="T:System.Net.Cookie" /> is valid.</summary>
/// <returns>The URI for which the <see cref="T:System.Net.Cookie" /> is valid.</returns>
// Token: 0x170005BB RID: 1467
// (get) Token: 0x06001179 RID: 4473 RVA: 0x0003353C File Offset: 0x0003173C
// (set) Token: 0x0600117A RID: 4474 RVA: 0x00033544 File Offset: 0x00031744
public string Domain
{
get
{
return this.domain;
}
set
{
if (Cookie.IsNullOrEmpty(value))
{
this.domain = string.Empty;
this.ExactDomain = true;
}
else
{
this.domain = value;
this.ExactDomain = value[0] != '.';
}
}
}
// Token: 0x170005BC RID: 1468
// (get) Token: 0x0600117B RID: 4475 RVA: 0x00033590 File Offset: 0x00031790
// (set) Token: 0x0600117C RID: 4476 RVA: 0x00033598 File Offset: 0x00031798
internal bool ExactDomain
{
get
{
return this.exact_domain;
}
set
{
this.exact_domain = value;
}
}
/// <summary>Gets or sets the current state of the <see cref="T:System.Net.Cookie" />.</summary>
/// <returns>true if the <see cref="T:System.Net.Cookie" /> has expired; otherwise, false. The default is false.</returns>
// Token: 0x170005BD RID: 1469
// (get) Token: 0x0600117D RID: 4477 RVA: 0x000335A4 File Offset: 0x000317A4
// (set) Token: 0x0600117E RID: 4478 RVA: 0x000335DC File Offset: 0x000317DC
public bool Expired
{
get
{
return this.expires <= DateTime.Now && this.expires != DateTime.MinValue;
}
set
{
if (value)
{
this.expires = DateTime.Now;
}
}
}
/// <summary>Gets or sets the expiration date and time for the <see cref="T:System.Net.Cookie" /> as a <see cref="T:System.DateTime" />.</summary>
/// <returns>The expiration date and time for the <see cref="T:System.Net.Cookie" /> as a <see cref="T:System.DateTime" /> instance.</returns>
// Token: 0x170005BE RID: 1470
// (get) Token: 0x0600117F RID: 4479 RVA: 0x000335F0 File Offset: 0x000317F0
// (set) Token: 0x06001180 RID: 4480 RVA: 0x000335F8 File Offset: 0x000317F8
public DateTime Expires
{
get
{
return this.expires;
}
set
{
this.expires = value;
}
}
/// <summary>Determines whether a page script or other active content can access this cookie.</summary>
/// <returns>Boolean value that determines whether a page script or other active content can access this cookie.</returns>
// Token: 0x170005BF RID: 1471
// (get) Token: 0x06001181 RID: 4481 RVA: 0x00033604 File Offset: 0x00031804
// (set) Token: 0x06001182 RID: 4482 RVA: 0x0003360C File Offset: 0x0003180C
public bool HttpOnly
{
get
{
return this.httpOnly;
}
set
{
this.httpOnly = value;
}
}
/// <summary>Gets or sets the name for the <see cref="T:System.Net.Cookie" />.</summary>
/// <returns>The name for the <see cref="T:System.Net.Cookie" />.</returns>
/// <exception cref="T:System.Net.CookieException">The value specified for a set operation is null or the empty string- or -The value specified for a set operation contained an illegal character. The following characters must not be used inside the <see cref="P:System.Net.Cookie.Name" /> property: equal sign, semicolon, comma, newline (\n), return (\r), tab (\t), and space character. The dollar sign character ("$") cannot be the first character.</exception>
// Token: 0x170005C0 RID: 1472
// (get) Token: 0x06001183 RID: 4483 RVA: 0x00033618 File Offset: 0x00031818
// (set) Token: 0x06001184 RID: 4484 RVA: 0x00033620 File Offset: 0x00031820
public string Name
{
get
{
return this.name;
}
set
{
if (Cookie.IsNullOrEmpty(value))
{
throw new CookieException("Name cannot be empty");
}
if (value[0] == '$' || value.IndexOfAny(Cookie.reservedCharsName) != -1)
{
this.name = string.Empty;
throw new CookieException("Name contains invalid characters");
}
this.name = value;
}
}
/// <summary>Gets or sets the URIs to which the <see cref="T:System.Net.Cookie" /> applies.</summary>
/// <returns>The URIs to which the <see cref="T:System.Net.Cookie" /> applies.</returns>
// Token: 0x170005C1 RID: 1473
// (get) Token: 0x06001185 RID: 4485 RVA: 0x00033680 File Offset: 0x00031880
// (set) Token: 0x06001186 RID: 4486 RVA: 0x000336A0 File Offset: 0x000318A0
public string Path
{
get
{
return (this.path != null) ? this.path : string.Empty;
}
set
{
this.path = ((value != null) ? value : string.Empty);
}
}
/// <summary>Gets or sets a list of TCP ports that the <see cref="T:System.Net.Cookie" /> applies to.</summary>
/// <returns>The list of TCP ports that the <see cref="T:System.Net.Cookie" /> applies to.</returns>
/// <exception cref="T:System.Net.CookieException">The value specified for a set operation could not be parsed or is not enclosed in double quotes. </exception>
// Token: 0x170005C2 RID: 1474
// (get) Token: 0x06001187 RID: 4487 RVA: 0x000336BC File Offset: 0x000318BC
// (set) Token: 0x06001188 RID: 4488 RVA: 0x000336C4 File Offset: 0x000318C4
public string Port
{
get
{
return this.port;
}
set
{
if (Cookie.IsNullOrEmpty(value))
{
this.port = string.Empty;
return;
}
if (value[0] != '"' || value[value.Length - 1] != '"')
{
throw new CookieException("The 'Port'='" + value + "' part of the cookie is invalid. Port must be enclosed by double quotes.");
}
this.port = value;
string[] array = this.port.Split(Cookie.portSeparators);
this.ports = new int[array.Length];
for (int i = 0; i < this.ports.Length; i++)
{
this.ports[i] = int.MinValue;
if (array[i].Length != 0)
{
try
{
this.ports[i] = int.Parse(array[i]);
}
catch (Exception ex)
{
throw new CookieException("The 'Port'='" + value + "' part of the cookie is invalid. Invalid value: " + array[i], ex);
}
}
}
this.Version = 1;
}
}
// Token: 0x170005C3 RID: 1475
// (get) Token: 0x06001189 RID: 4489 RVA: 0x000337D8 File Offset: 0x000319D8
internal int[] Ports
{
get
{
return this.ports;
}
}
/// <summary>Gets or sets the security level of a <see cref="T:System.Net.Cookie" />.</summary>
/// <returns>true if the client is only to return the cookie in subsequent requests if those requests use Secure Hypertext Transfer Protocol (HTTPS); otherwise, false. The default is false.</returns>
// Token: 0x170005C4 RID: 1476
// (get) Token: 0x0600118A RID: 4490 RVA: 0x000337E0 File Offset: 0x000319E0
// (set) Token: 0x0600118B RID: 4491 RVA: 0x000337E8 File Offset: 0x000319E8
public bool Secure
{
get
{
return this.secure;
}
set
{
this.secure = value;
}
}
/// <summary>Gets the time when the cookie was issued as a <see cref="T:System.DateTime" />.</summary>
/// <returns>The time when the cookie was issued as a <see cref="T:System.DateTime" />.</returns>
// Token: 0x170005C5 RID: 1477
// (get) Token: 0x0600118C RID: 4492 RVA: 0x000337F4 File Offset: 0x000319F4
public DateTime TimeStamp
{
get
{
return this.timestamp;
}
}
/// <summary>Gets or sets the <see cref="P:System.Net.Cookie.Value" /> for the <see cref="T:System.Net.Cookie" />.</summary>
/// <returns>The <see cref="P:System.Net.Cookie.Value" /> for the <see cref="T:System.Net.Cookie" />.</returns>
// Token: 0x170005C6 RID: 1478
// (get) Token: 0x0600118D RID: 4493 RVA: 0x000337FC File Offset: 0x000319FC
// (set) Token: 0x0600118E RID: 4494 RVA: 0x00033804 File Offset: 0x00031A04
public string Value
{
get
{
return this.val;
}
set
{
if (value == null)
{
this.val = string.Empty;
return;
}
this.val = value;
}
}
/// <summary>Gets or sets the version of HTTP state maintenance to which the cookie conforms.</summary>
/// <returns>The version of HTTP state maintenance to which the cookie conforms.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value specified for a version is not allowed. </exception>
// Token: 0x170005C7 RID: 1479
// (get) Token: 0x0600118F RID: 4495 RVA: 0x00033820 File Offset: 0x00031A20
// (set) Token: 0x06001190 RID: 4496 RVA: 0x00033828 File Offset: 0x00031A28
public int Version
{
get
{
return this.version;
}
set
{
if (value < 0 || value > 10)
{
this.version = 0;
}
else
{
this.version = value;
}
}
}
/// <summary>Overrides the <see cref="M:System.Object.Equals(System.Object)" /> method.</summary>
/// <returns>Returns true if the <see cref="T:System.Net.Cookie" /> is equal to <paramref name="comparand" />. Two <see cref="T:System.Net.Cookie" /> instances are equal if their <see cref="P:System.Net.Cookie.Name" />, <see cref="P:System.Net.Cookie.Value" />, <see cref="P:System.Net.Cookie.Path" />, <see cref="P:System.Net.Cookie.Domain" />, and <see cref="P:System.Net.Cookie.Version" /> properties are equal. <see cref="P:System.Net.Cookie.Name" /> and <see cref="P:System.Net.Cookie.Domain" /> string comparisons are case-insensitive.</returns>
/// <param name="comparand">A reference to a <see cref="T:System.Net.Cookie" />. </param>
// Token: 0x06001191 RID: 4497 RVA: 0x00033858 File Offset: 0x00031A58
public override bool Equals(object obj)
{
Cookie cookie = obj as Cookie;
return cookie != null && string.Compare(this.name, cookie.name, true, CultureInfo.InvariantCulture) == 0 && string.Compare(this.val, cookie.val, false, CultureInfo.InvariantCulture) == 0 && string.Compare(this.Path, cookie.Path, false, CultureInfo.InvariantCulture) == 0 && string.Compare(this.domain, cookie.domain, true, CultureInfo.InvariantCulture) == 0 && this.version == cookie.version;
}
/// <summary>Overrides the <see cref="M:System.Object.GetHashCode" /> method.</summary>
/// <returns>The 32-bit signed integer hash code for this instance.</returns>
// Token: 0x06001192 RID: 4498 RVA: 0x000338F4 File Offset: 0x00031AF4
public override int GetHashCode()
{
return Cookie.hash(CaseInsensitiveHashCodeProvider.DefaultInvariant.GetHashCode(this.name), this.val.GetHashCode(), this.Path.GetHashCode(), CaseInsensitiveHashCodeProvider.DefaultInvariant.GetHashCode(this.domain), this.version);
}
// Token: 0x06001193 RID: 4499 RVA: 0x00033944 File Offset: 0x00031B44
private static int hash(int i, int j, int k, int l, int m)
{
return i ^ ((j << 13) | (j >> 19)) ^ ((k << 26) | (k >> 6)) ^ ((l << 7) | (l >> 25)) ^ ((m << 20) | (m >> 12));
}
/// <summary>Overrides the <see cref="M:System.Object.ToString" /> method.</summary>
/// <returns>Returns a string representation of this <see cref="T:System.Net.Cookie" /> object that is suitable for including in a HTTP Cookie: request header.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
/// </PermissionSet>
// Token: 0x06001194 RID: 4500 RVA: 0x00033970 File Offset: 0x00031B70
public override string ToString()
{
return this.ToString(null);
}
// Token: 0x06001195 RID: 4501 RVA: 0x0003397C File Offset: 0x00031B7C
internal string ToString(global::System.Uri uri)
{
if (this.name.Length == 0)
{
return string.Empty;
}
StringBuilder stringBuilder = new StringBuilder(64);
if (this.version > 0)
{
stringBuilder.Append("$Version=").Append(this.version).Append("; ");
}
stringBuilder.Append(this.name).Append("=").Append(this.val);
if (this.version == 0)
{
return stringBuilder.ToString();
}
if (!Cookie.IsNullOrEmpty(this.path))
{
stringBuilder.Append("; $Path=").Append(this.path);
}
else if (uri != null)
{
stringBuilder.Append("; $Path=/").Append(this.path);
}
bool flag = uri == null || uri.Host != this.domain;
if (flag && !Cookie.IsNullOrEmpty(this.domain))
{
stringBuilder.Append("; $Domain=").Append(this.domain);
}
if (this.port != null && this.port.Length != 0)
{
stringBuilder.Append("; $Port=").Append(this.port);
}
return stringBuilder.ToString();
}
// Token: 0x06001196 RID: 4502 RVA: 0x00033AE0 File Offset: 0x00031CE0
internal string ToClientString()
{
if (this.name.Length == 0)
{
return string.Empty;
}
StringBuilder stringBuilder = new StringBuilder(64);
if (this.version > 0)
{
stringBuilder.Append("Version=").Append(this.version).Append(";");
}
stringBuilder.Append(this.name).Append("=").Append(this.val);
if (this.path != null && this.path.Length != 0)
{
stringBuilder.Append(";Path=").Append(this.QuotedString(this.path));
}
if (this.domain != null && this.domain.Length != 0)
{
stringBuilder.Append(";Domain=").Append(this.QuotedString(this.domain));
}
if (this.port != null && this.port.Length != 0)
{
stringBuilder.Append(";Port=").Append(this.port);
}
return stringBuilder.ToString();
}
// Token: 0x06001197 RID: 4503 RVA: 0x00033C04 File Offset: 0x00031E04
private string QuotedString(string value)
{
if (this.version == 0 || this.IsToken(value))
{
return value;
}
return "\"" + value.Replace("\"", "\\\"") + "\"";
}
// Token: 0x06001198 RID: 4504 RVA: 0x00033C4C File Offset: 0x00031E4C
private bool IsToken(string value)
{
int length = value.Length;
for (int i = 0; i < length; i++)
{
char c = value[i];
if (c < ' ' || c >= '\u007f' || Cookie.tspecials.IndexOf(c) != -1)
{
return false;
}
}
return true;
}
// Token: 0x06001199 RID: 4505 RVA: 0x00033CA0 File Offset: 0x00031EA0
private static bool IsNullOrEmpty(string s)
{
return s == null || s.Length == 0;
}
// Token: 0x04000F78 RID: 3960
private string comment;
// Token: 0x04000F79 RID: 3961
private global::System.Uri commentUri;
// Token: 0x04000F7A RID: 3962
private bool discard;
// Token: 0x04000F7B RID: 3963
private string domain;
// Token: 0x04000F7C RID: 3964
private DateTime expires;
// Token: 0x04000F7D RID: 3965
private bool httpOnly;
// Token: 0x04000F7E RID: 3966
private string name;
// Token: 0x04000F7F RID: 3967
private string path;
// Token: 0x04000F80 RID: 3968
private string port;
// Token: 0x04000F81 RID: 3969
private int[] ports;
// Token: 0x04000F82 RID: 3970
private bool secure;
// Token: 0x04000F83 RID: 3971
private DateTime timestamp;
// Token: 0x04000F84 RID: 3972
private string val;
// Token: 0x04000F85 RID: 3973
private int version;
// Token: 0x04000F86 RID: 3974
private static char[] reservedCharsName = new char[] { ' ', '=', ';', ',', '\n', '\r', '\t' };
// Token: 0x04000F87 RID: 3975
private static char[] portSeparators = new char[] { '"', ',' };
// Token: 0x04000F88 RID: 3976
private static string tspecials = "()<>@,;:\\\"/[]?={} \t";
// Token: 0x04000F89 RID: 3977
private bool exact_domain;
}
}
+247
View File
@@ -0,0 +1,247 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
namespace System.Net
{
/// <summary>Provides a collection container for instances of the <see cref="T:System.Net.Cookie" /> class.</summary>
// Token: 0x02000206 RID: 518
[Serializable]
public sealed class CookieCollection : ICollection, IEnumerable
{
// Token: 0x170005C8 RID: 1480
// (get) Token: 0x0600119C RID: 4508 RVA: 0x00033CD4 File Offset: 0x00031ED4
internal IList<Cookie> List
{
get
{
return this.list;
}
}
/// <summary>Gets the number of cookies contained in a <see cref="T:System.Net.CookieCollection" />.</summary>
/// <returns>The number of cookies contained in a <see cref="T:System.Net.CookieCollection" />.</returns>
// Token: 0x170005C9 RID: 1481
// (get) Token: 0x0600119D RID: 4509 RVA: 0x00033CDC File Offset: 0x00031EDC
public int Count
{
get
{
return this.list.Count;
}
}
/// <summary>Gets a value that indicates whether access to a <see cref="T:System.Net.CookieCollection" /> is thread safe.</summary>
/// <returns>true if access to the <see cref="T:System.Net.CookieCollection" /> is thread safe; otherwise, false. The default is false.</returns>
// Token: 0x170005CA RID: 1482
// (get) Token: 0x0600119E RID: 4510 RVA: 0x00033CEC File Offset: 0x00031EEC
public bool IsSynchronized
{
get
{
return false;
}
}
/// <summary>Gets an object that you can use to synchronize access to the <see cref="T:System.Net.CookieCollection" />.</summary>
/// <returns>An object that you can use to synchronize access to the <see cref="T:System.Net.CookieCollection" />.</returns>
// Token: 0x170005CB RID: 1483
// (get) Token: 0x0600119F RID: 4511 RVA: 0x00033CF0 File Offset: 0x00031EF0
public object SyncRoot
{
get
{
return this;
}
}
/// <summary>Copies the elements of a <see cref="T:System.Net.CookieCollection" /> to an instance of the <see cref="T:System.Array" /> class, starting at a particular index.</summary>
/// <param name="array">The target <see cref="T:System.Array" /> to which the <see cref="T:System.Net.CookieCollection" /> will be copied. </param>
/// <param name="index">The zero-based index in the target <see cref="T:System.Array" /> where copying begins. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="array" /> is multidimensional.-or- The number of elements in this <see cref="T:System.Net.CookieCollection" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />. </exception>
/// <exception cref="T:System.InvalidCastException">The elements in this <see cref="T:System.Net.CookieCollection" /> cannot be cast automatically to the type of the destination <paramref name="array" />. </exception>
// Token: 0x060011A0 RID: 4512 RVA: 0x00033CF4 File Offset: 0x00031EF4
public void CopyTo(Array array, int index)
{
((ICollection)this.list).CopyTo(array, index);
}
/// <summary>Copies the elements of this <see cref="T:System.Net.CookieCollection" /> to a <see cref="T:System.Net.Cookie" /> array starting at the specified index of the target array.</summary>
/// <param name="array">The target <see cref="T:System.Net.Cookie" /> array to which the <see cref="T:System.Net.CookieCollection" /> will be copied.</param>
/// <param name="index">The zero-based index in the target <see cref="T:System.Array" /> where copying begins. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="array" /> is multidimensional.-or- The number of elements in this <see cref="T:System.Net.CookieCollection" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />. </exception>
/// <exception cref="T:System.InvalidCastException">The elements in this <see cref="T:System.Net.CookieCollection" /> cannot be cast automatically to the type of the destination <paramref name="array" />. </exception>
// Token: 0x060011A1 RID: 4513 RVA: 0x00033D04 File Offset: 0x00031F04
public void CopyTo(Cookie[] array, int index)
{
this.list.CopyTo(array, index);
}
/// <summary>Gets an enumerator that can iterate through a <see cref="T:System.Net.CookieCollection" />.</summary>
/// <returns>An instance of an implementation of an <see cref="T:System.Collections.IEnumerator" /> interface that can iterate through a <see cref="T:System.Net.CookieCollection" />.</returns>
// Token: 0x060011A2 RID: 4514 RVA: 0x00033D14 File Offset: 0x00031F14
public IEnumerator GetEnumerator()
{
return this.list.GetEnumerator();
}
/// <summary>Gets a value that indicates whether a <see cref="T:System.Net.CookieCollection" /> is read-only.</summary>
/// <returns>true if this is a read-only <see cref="T:System.Net.CookieCollection" />; otherwise, false. The default is true.</returns>
// Token: 0x170005CC RID: 1484
// (get) Token: 0x060011A3 RID: 4515 RVA: 0x00033D28 File Offset: 0x00031F28
public bool IsReadOnly
{
get
{
return true;
}
}
/// <summary>Adds a <see cref="T:System.Net.Cookie" /> to a <see cref="T:System.Net.CookieCollection" />.</summary>
/// <param name="cookie">The <see cref="T:System.Net.Cookie" /> to be added to a <see cref="T:System.Net.CookieCollection" />. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="cookie" /> is null. </exception>
// Token: 0x060011A4 RID: 4516 RVA: 0x00033D2C File Offset: 0x00031F2C
public void Add(Cookie cookie)
{
if (cookie == null)
{
throw new ArgumentNullException("cookie");
}
int num = this.SearchCookie(cookie);
if (num == -1)
{
this.list.Add(cookie);
}
else
{
this.list[num] = cookie;
}
}
// Token: 0x060011A5 RID: 4517 RVA: 0x00033D78 File Offset: 0x00031F78
internal void Sort()
{
if (this.list.Count > 0)
{
this.list.Sort(CookieCollection.Comparer);
}
}
// Token: 0x060011A6 RID: 4518 RVA: 0x00033D9C File Offset: 0x00031F9C
private int SearchCookie(Cookie cookie)
{
string name = cookie.Name;
string domain = cookie.Domain;
string path = cookie.Path;
for (int i = this.list.Count - 1; i >= 0; i--)
{
Cookie cookie2 = this.list[i];
if (cookie2.Version == cookie.Version)
{
if (string.Compare(domain, cookie2.Domain, true, CultureInfo.InvariantCulture) == 0)
{
if (string.Compare(name, cookie2.Name, true, CultureInfo.InvariantCulture) == 0)
{
if (string.Compare(path, cookie2.Path, true, CultureInfo.InvariantCulture) == 0)
{
return i;
}
}
}
}
}
return -1;
}
/// <summary>Adds the contents of a <see cref="T:System.Net.CookieCollection" /> to the current instance.</summary>
/// <param name="cookies">The <see cref="T:System.Net.CookieCollection" /> to be added. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="cookies" /> is null. </exception>
// Token: 0x060011A7 RID: 4519 RVA: 0x00033E5C File Offset: 0x0003205C
public void Add(CookieCollection cookies)
{
if (cookies == null)
{
throw new ArgumentNullException("cookies");
}
foreach (object obj in cookies)
{
Cookie cookie = (Cookie)obj;
this.Add(cookie);
}
}
/// <summary>Gets the <see cref="T:System.Net.Cookie" /> with a specific index from a <see cref="T:System.Net.CookieCollection" />.</summary>
/// <returns>A <see cref="T:System.Net.Cookie" /> with a specific index from a <see cref="T:System.Net.CookieCollection" />.</returns>
/// <param name="index">The zero-based index of the <see cref="T:System.Net.Cookie" /> to be found. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than 0 or <paramref name="index" /> is greater than or equal to <see cref="P:System.Net.CookieCollection.Count" />. </exception>
// Token: 0x170005CD RID: 1485
public Cookie this[int index]
{
get
{
if (index < 0 || index >= this.list.Count)
{
throw new ArgumentOutOfRangeException("index");
}
return this.list[index];
}
}
/// <summary>Gets the <see cref="T:System.Net.Cookie" /> with a specific name from a <see cref="T:System.Net.CookieCollection" />.</summary>
/// <returns>The <see cref="T:System.Net.Cookie" /> with a specific name from a <see cref="T:System.Net.CookieCollection" />.</returns>
/// <param name="name">The name of the <see cref="T:System.Net.Cookie" /> to be found. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="name" /> is null. </exception>
// Token: 0x170005CE RID: 1486
public Cookie this[string name]
{
get
{
foreach (Cookie cookie in this.list)
{
if (string.Compare(cookie.Name, name, true, CultureInfo.InvariantCulture) == 0)
{
return cookie;
}
}
return null;
}
}
// Token: 0x04000F8A RID: 3978
private List<Cookie> list = new List<Cookie>();
// Token: 0x04000F8B RID: 3979
private static CookieCollection.CookieCollectionComparer Comparer = new CookieCollection.CookieCollectionComparer();
// Token: 0x02000207 RID: 519
private sealed class CookieCollectionComparer : IComparer<Cookie>
{
// Token: 0x060011AB RID: 4523 RVA: 0x00033F94 File Offset: 0x00032194
public int Compare(Cookie x, Cookie y)
{
if (x == null || y == null)
{
return 0;
}
int num = x.Name.Length + x.Value.Length;
int num2 = y.Name.Length + y.Value.Length;
return num - num2;
}
}
}
}
+652
View File
@@ -0,0 +1,652 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Text.RegularExpressions;
namespace System.Net
{
/// <summary>Provides a container for a collection of <see cref="T:System.Net.CookieCollection" /> objects.</summary>
// Token: 0x02000208 RID: 520
[Serializable]
public sealed class CookieContainer
{
/// <summary>Initializes a new instance of the <see cref="T:System.Net.CookieContainer" /> class.</summary>
// Token: 0x060011AC RID: 4524 RVA: 0x00033FE4 File Offset: 0x000321E4
public CookieContainer()
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.CookieContainer" /> class with a specified value for the number of <see cref="T:System.Net.Cookie" /> instances that the container can hold.</summary>
/// <param name="capacity">The number of <see cref="T:System.Net.Cookie" /> instances that the <see cref="T:System.Net.CookieContainer" /> can hold. </param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="capacity" /> is less than or equal to zero. </exception>
// Token: 0x060011AD RID: 4525 RVA: 0x00034018 File Offset: 0x00032218
public CookieContainer(int capacity)
{
if (capacity <= 0)
{
throw new ArgumentException("Must be greater than zero", "Capacity");
}
this.capacity = capacity;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.CookieContainer" /> class with specific properties.</summary>
/// <param name="capacity">The number of <see cref="T:System.Net.Cookie" /> instances that the <see cref="T:System.Net.CookieContainer" /> can hold. </param>
/// <param name="perDomainCapacity">The number of <see cref="T:System.Net.Cookie" /> instances per domain. </param>
/// <param name="maxCookieSize">The maximum size in bytes for any single <see cref="T:System.Net.Cookie" /> in a <see cref="T:System.Net.CookieContainer" />. </param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="perDomainCapacity" /> is not equal to <see cref="F:System.Int32.MaxValue" />. and <paramref name="(perDomainCapacity" /> is less than or equal to zero or <paramref name="perDomainCapacity" /> is greater than <paramref name="capacity)" />. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="maxCookieSize" /> is less than or equal to zero. </exception>
// Token: 0x060011AE RID: 4526 RVA: 0x00034068 File Offset: 0x00032268
public CookieContainer(int capacity, int perDomainCapacity, int maxCookieSize)
: this(capacity)
{
if (perDomainCapacity != 2147483647 && (perDomainCapacity <= 0 || perDomainCapacity > capacity))
{
throw new ArgumentOutOfRangeException("perDomainCapacity", string.Format("PerDomainCapacity must be greater than {0} and less than {1}.", 0, capacity));
}
if (maxCookieSize <= 0)
{
throw new ArgumentException("Must be greater than zero", "MaxCookieSize");
}
this.perDomainCapacity = perDomainCapacity;
this.maxCookieSize = maxCookieSize;
}
/// <summary>Gets the number of <see cref="T:System.Net.Cookie" /> instances that a <see cref="T:System.Net.CookieContainer" /> currently holds.</summary>
/// <returns>The number of <see cref="T:System.Net.Cookie" /> instances that a <see cref="T:System.Net.CookieContainer" /> currently holds. This is the total of <see cref="T:System.Net.Cookie" /> instances in all domains.</returns>
// Token: 0x170005CF RID: 1487
// (get) Token: 0x060011AF RID: 4527 RVA: 0x000340DC File Offset: 0x000322DC
public int Count
{
get
{
return (this.cookies != null) ? this.cookies.Count : 0;
}
}
/// <summary>Gets and sets the number of <see cref="T:System.Net.Cookie" /> instances that a <see cref="T:System.Net.CookieContainer" /> can hold.</summary>
/// <returns>The number of <see cref="T:System.Net.Cookie" /> instances that a <see cref="T:System.Net.CookieContainer" /> can hold. This is a hard limit and cannot be exceeded by adding a <see cref="T:System.Net.Cookie" />.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="Capacity" /> is less than or equal to zero or (value is less than <see cref="P:System.Net.CookieContainer.PerDomainCapacity" /> and <see cref="P:System.Net.CookieContainer.PerDomainCapacity" /> is not equal to <see cref="F:System.Int32.MaxValue" />). </exception>
// Token: 0x170005D0 RID: 1488
// (get) Token: 0x060011B0 RID: 4528 RVA: 0x000340FC File Offset: 0x000322FC
// (set) Token: 0x060011B1 RID: 4529 RVA: 0x00034104 File Offset: 0x00032304
public int Capacity
{
get
{
return this.capacity;
}
set
{
if (value < 0 || (value < this.perDomainCapacity && this.perDomainCapacity != 2147483647))
{
throw new ArgumentOutOfRangeException("value", string.Format("Capacity must be greater than {0} and less than {1}.", 0, this.perDomainCapacity));
}
this.capacity = value;
}
}
/// <summary>Represents the maximum allowed length of a <see cref="T:System.Net.Cookie" />.</summary>
/// <returns>The maximum allowed length, in bytes, of a <see cref="T:System.Net.Cookie" />.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="MaxCookieSize" /> is less than or equal to zero. </exception>
// Token: 0x170005D1 RID: 1489
// (get) Token: 0x060011B2 RID: 4530 RVA: 0x00034164 File Offset: 0x00032364
// (set) Token: 0x060011B3 RID: 4531 RVA: 0x0003416C File Offset: 0x0003236C
public int MaxCookieSize
{
get
{
return this.maxCookieSize;
}
set
{
if (value <= 0)
{
throw new ArgumentOutOfRangeException("value");
}
this.maxCookieSize = value;
}
}
/// <summary>Gets and sets the number of <see cref="T:System.Net.Cookie" /> instances that a <see cref="T:System.Net.CookieContainer" /> can hold per domain.</summary>
/// <returns>The number of <see cref="T:System.Net.Cookie" /> instances that are allowed per domain.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="PerDomainCapacity" /> is less than or equal to zero. -or- <paramref name="(PerDomainCapacity" /> is greater than the maximum allowable number of cookies instances, 300, and is not equal to <see cref="F:System.Int32.MaxValue" />). </exception>
// Token: 0x170005D2 RID: 1490
// (get) Token: 0x060011B4 RID: 4532 RVA: 0x00034188 File Offset: 0x00032388
// (set) Token: 0x060011B5 RID: 4533 RVA: 0x00034190 File Offset: 0x00032390
public int PerDomainCapacity
{
get
{
return this.perDomainCapacity;
}
set
{
if (value != 2147483647 && (value <= 0 || value > this.capacity))
{
throw new ArgumentOutOfRangeException("value");
}
this.perDomainCapacity = value;
}
}
/// <summary>Adds a <see cref="T:System.Net.Cookie" /> to a <see cref="T:System.Net.CookieContainer" />. This method uses the domain from the <see cref="T:System.Net.Cookie" /> to determine which domain collection to associate the <see cref="T:System.Net.Cookie" /> with.</summary>
/// <param name="cookie">The <see cref="T:System.Net.Cookie" /> to be added to the <see cref="T:System.Net.CookieContainer" />. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="cookie" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">The domain for <paramref name="cookie" /> is null or the empty string (""). </exception>
/// <exception cref="T:System.Net.CookieException">
/// <paramref name="cookie" /> is larger than <paramref name="maxCookieSize" />. -or- the domain for <paramref name="cookie" /> is not a valid URI. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x060011B6 RID: 4534 RVA: 0x000341D0 File Offset: 0x000323D0
public void Add(Cookie cookie)
{
if (cookie == null)
{
throw new ArgumentNullException("cookie");
}
if (cookie.Domain.Length == 0)
{
throw new ArgumentException("Cookie domain not set.", "cookie.Domain");
}
if (cookie.Value.Length > this.maxCookieSize)
{
throw new CookieException("value is larger than MaxCookieSize.");
}
this.AddCookie(new Cookie(cookie.Name, cookie.Value)
{
Path = ((cookie.Path.Length != 0) ? cookie.Path : "/"),
Domain = cookie.Domain,
ExactDomain = cookie.ExactDomain,
Version = cookie.Version
});
}
// Token: 0x060011B7 RID: 4535 RVA: 0x00034294 File Offset: 0x00032494
private void AddCookie(Cookie cookie)
{
if (this.cookies == null)
{
this.cookies = new CookieCollection();
}
if (this.cookies.Count >= this.capacity)
{
this.RemoveOldest(null);
}
if (this.cookies.Count >= this.perDomainCapacity && this.CountDomain(cookie.Domain) >= this.perDomainCapacity)
{
this.RemoveOldest(cookie.Domain);
}
Cookie cookie2 = new Cookie(cookie.Name, cookie.Value);
cookie2.Path = ((cookie.Path.Length != 0) ? cookie.Path : "/");
cookie2.Domain = cookie.Domain;
cookie2.ExactDomain = cookie.ExactDomain;
cookie2.Version = cookie.Version;
cookie2.Expires = cookie.Expires;
cookie2.CommentUri = cookie.CommentUri;
cookie2.Comment = cookie.Comment;
cookie2.Discard = cookie.Discard;
cookie2.HttpOnly = cookie.HttpOnly;
cookie2.Secure = cookie.Secure;
this.cookies.Add(cookie2);
this.CheckExpiration();
}
// Token: 0x060011B8 RID: 4536 RVA: 0x000343C4 File Offset: 0x000325C4
private int CountDomain(string domain)
{
int num = 0;
foreach (object obj in this.cookies)
{
Cookie cookie = (Cookie)obj;
if (CookieContainer.CheckDomain(domain, cookie.Domain, true))
{
num++;
}
}
return num;
}
// Token: 0x060011B9 RID: 4537 RVA: 0x00034448 File Offset: 0x00032648
private void RemoveOldest(string domain)
{
int num = 0;
DateTime dateTime = DateTime.MaxValue;
for (int i = 0; i < this.cookies.Count; i++)
{
Cookie cookie = this.cookies[i];
if (cookie.TimeStamp < dateTime && (domain == null || domain == cookie.Domain))
{
dateTime = cookie.TimeStamp;
num = i;
}
}
this.cookies.List.RemoveAt(num);
}
// Token: 0x060011BA RID: 4538 RVA: 0x000344C8 File Offset: 0x000326C8
private void CheckExpiration()
{
if (this.cookies == null)
{
return;
}
for (int i = this.cookies.Count - 1; i >= 0; i--)
{
Cookie cookie = this.cookies[i];
if (cookie.Expired)
{
this.cookies.List.RemoveAt(i);
}
}
}
/// <summary>Adds the contents of a <see cref="T:System.Net.CookieCollection" /> to the <see cref="T:System.Net.CookieContainer" />.</summary>
/// <param name="cookies">The <see cref="T:System.Net.CookieCollection" /> to be added to the <see cref="T:System.Net.CookieContainer" />. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="cookies" /> is null. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x060011BB RID: 4539 RVA: 0x00034528 File Offset: 0x00032728
public void Add(CookieCollection cookies)
{
if (cookies == null)
{
throw new ArgumentNullException("cookies");
}
foreach (object obj in cookies)
{
Cookie cookie = (Cookie)obj;
this.Add(cookie);
}
}
// Token: 0x060011BC RID: 4540 RVA: 0x000345A4 File Offset: 0x000327A4
private void Cook(global::System.Uri uri, Cookie cookie)
{
if (CookieContainer.IsNullOrEmpty(cookie.Name))
{
throw new CookieException("Invalid cookie: name");
}
if (cookie.Value == null)
{
throw new CookieException("Invalid cookie: value");
}
if (uri != null && cookie.Domain.Length == 0)
{
cookie.Domain = uri.Host;
}
if (cookie.Version == 0 && CookieContainer.IsNullOrEmpty(cookie.Path))
{
if (uri != null)
{
cookie.Path = uri.AbsolutePath;
}
else
{
cookie.Path = "/";
}
}
if (cookie.Port.Length == 0 && uri != null && !uri.IsDefaultPort)
{
cookie.Port = "\"" + uri.Port.ToString() + "\"";
}
}
/// <summary>Adds a <see cref="T:System.Net.Cookie" /> to the <see cref="T:System.Net.CookieContainer" /> for a particular URI.</summary>
/// <param name="uri">The URI of the <see cref="T:System.Net.Cookie" /> to be added to the <see cref="T:System.Net.CookieContainer" />. </param>
/// <param name="cookie">The <see cref="T:System.Net.Cookie" /> to be added to the <see cref="T:System.Net.CookieContainer" />. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="uri" /> is null or <paramref name="cookie" /> is null. </exception>
/// <exception cref="T:System.Net.CookieException">
/// <paramref name="cookie" /> is larger than <paramref name="maxCookieSize" />. -or- The domain for <paramref name="cookie" /> is not a valid URI. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x060011BD RID: 4541 RVA: 0x00034698 File Offset: 0x00032898
public void Add(global::System.Uri uri, Cookie cookie)
{
if (uri == null)
{
throw new ArgumentNullException("uri");
}
if (cookie == null)
{
throw new ArgumentNullException("cookie");
}
if (!cookie.Expired)
{
this.Cook(uri, cookie);
this.AddCookie(cookie);
}
}
/// <summary>Adds the contents of a <see cref="T:System.Net.CookieCollection" /> to the <see cref="T:System.Net.CookieContainer" /> for a particular URI.</summary>
/// <param name="uri">The URI of the <see cref="T:System.Net.CookieCollection" /> to be added to the <see cref="T:System.Net.CookieContainer" />. </param>
/// <param name="cookies">The <see cref="T:System.Net.CookieCollection" /> to be added to the <see cref="T:System.Net.CookieContainer" />. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="cookies" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">The domain for one of the cookies in <paramref name="cookies" /> is null. </exception>
/// <exception cref="T:System.Net.CookieException">One of the cookies in <paramref name="cookies" /> contains an invalid domain. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x060011BE RID: 4542 RVA: 0x000346E8 File Offset: 0x000328E8
public void Add(global::System.Uri uri, CookieCollection cookies)
{
if (uri == null)
{
throw new ArgumentNullException("uri");
}
if (cookies == null)
{
throw new ArgumentNullException("cookies");
}
foreach (object obj in cookies)
{
Cookie cookie = (Cookie)obj;
if (!cookie.Expired)
{
this.Cook(uri, cookie);
this.AddCookie(cookie);
}
}
}
/// <summary>Gets the HTTP cookie header that contains the HTTP cookies that represent the <see cref="T:System.Net.Cookie" /> instances that are associated with a specific URI.</summary>
/// <returns>An HTTP cookie header, with strings representing <see cref="T:System.Net.Cookie" /> instances delimited by semicolons.</returns>
/// <param name="uri">The URI of the <see cref="T:System.Net.Cookie" /> instances desired. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="uri" /> is null. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x060011BF RID: 4543 RVA: 0x00034790 File Offset: 0x00032990
public string GetCookieHeader(global::System.Uri uri)
{
if (uri == null)
{
throw new ArgumentNullException("uri");
}
CookieCollection cookieCollection = this.GetCookies(uri);
if (cookieCollection.Count == 0)
{
return string.Empty;
}
StringBuilder stringBuilder = new StringBuilder();
foreach (object obj in cookieCollection)
{
Cookie cookie = (Cookie)obj;
stringBuilder.Append(cookie.ToString(uri));
stringBuilder.Append("; ");
}
if (stringBuilder.Length > 0)
{
stringBuilder.Length -= 2;
}
return stringBuilder.ToString();
}
// Token: 0x060011C0 RID: 4544 RVA: 0x00034868 File Offset: 0x00032A68
private static bool CheckDomain(string domain, string host, bool exact)
{
if (domain.Length == 0)
{
return false;
}
if (exact)
{
return string.Compare(host, domain, true, CultureInfo.InvariantCulture) == 0;
}
if (!CultureInfo.InvariantCulture.CompareInfo.IsSuffix(host, domain, CompareOptions.IgnoreCase))
{
return false;
}
if (domain[0] == '.')
{
return true;
}
int num = host.Length - domain.Length - 1;
return num >= 0 && host[num] == '.';
}
/// <summary>Gets a <see cref="T:System.Net.CookieCollection" /> that contains the <see cref="T:System.Net.Cookie" /> instances that are associated with a specific URI.</summary>
/// <returns>A <see cref="T:System.Net.CookieCollection" /> that contains the <see cref="T:System.Net.Cookie" /> instances that are associated with a specific URI.</returns>
/// <param name="uri">The URI of the <see cref="T:System.Net.Cookie" /> instances desired. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="uri" /> is null. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x060011C1 RID: 4545 RVA: 0x000348E8 File Offset: 0x00032AE8
public CookieCollection GetCookies(global::System.Uri uri)
{
if (uri == null)
{
throw new ArgumentNullException("uri");
}
this.CheckExpiration();
CookieCollection cookieCollection = new CookieCollection();
if (this.cookies == null)
{
return cookieCollection;
}
foreach (object obj in this.cookies)
{
Cookie cookie = (Cookie)obj;
string domain = cookie.Domain;
if (CookieContainer.CheckDomain(domain, uri.Host, cookie.ExactDomain))
{
if (cookie.Port.Length <= 0 || cookie.Ports == null || uri.Port == -1 || Array.IndexOf<int>(cookie.Ports, uri.Port) != -1)
{
string path = cookie.Path;
string absolutePath = uri.AbsolutePath;
if (path != string.Empty && path != "/" && absolutePath != path)
{
if (!absolutePath.StartsWith(path))
{
continue;
}
if (path[path.Length - 1] != '/' && absolutePath.Length > path.Length && absolutePath[path.Length] != '/')
{
continue;
}
}
if (!cookie.Secure || !(uri.Scheme != "https"))
{
cookieCollection.Add(cookie);
}
}
}
}
cookieCollection.Sort();
return cookieCollection;
}
/// <summary>Adds <see cref="T:System.Net.Cookie" /> instances for one or more cookies from an HTTP cookie header to the <see cref="T:System.Net.CookieContainer" /> for a specific URI.</summary>
/// <param name="uri">The URI of the <see cref="T:System.Net.CookieCollection" />. </param>
/// <param name="cookieHeader">The contents of an HTTP set-cookie header as returned by a HTTP server, with <see cref="T:System.Net.Cookie" /> instances delimited by commas. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="uri" /> is null. </exception>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="cookieHeader" /> is null. </exception>
/// <exception cref="T:System.Net.CookieException">One of the cookies is invalid. -or- An error occurred while adding one of the cookies to the container. </exception>
// Token: 0x060011C2 RID: 4546 RVA: 0x00034AB4 File Offset: 0x00032CB4
public void SetCookies(global::System.Uri uri, string cookieHeader)
{
if (uri == null)
{
throw new ArgumentNullException("uri");
}
if (cookieHeader == null)
{
throw new ArgumentNullException("cookieHeader");
}
if (cookieHeader.Length == 0)
{
return;
}
string[] array = cookieHeader.Split(new char[] { ',' });
for (int i = 0; i < array.Length; i++)
{
string text = array[i];
if (array.Length > i + 1 && global::System.Text.RegularExpressions.Regex.IsMatch(array[i], ".*expires\\s*=\\s*(Mon|Tue|Wed|Thu|Fri|Sat|Sun)", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase) && global::System.Text.RegularExpressions.Regex.IsMatch(array[i + 1], "\\s\\d{2}-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-\\d{4} \\d{2}:\\d{2}:\\d{2} GMT", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase))
{
text = new StringBuilder(text).Append(",").Append(array[++i]).ToString();
}
try
{
Cookie cookie = CookieContainer.Parse(text);
if (cookie.Path.Length == 0)
{
cookie.Path = uri.AbsolutePath;
}
else if (!uri.AbsolutePath.StartsWith(cookie.Path))
{
string text2 = string.Format("'Path'='{0}' is invalid with URI", cookie.Path);
throw new CookieException(text2);
}
if (cookie.Domain.Length == 0)
{
cookie.Domain = uri.Host;
cookie.ExactDomain = true;
}
this.AddCookie(cookie);
}
catch (Exception ex)
{
string text3 = string.Format("Could not parse cookies for '{0}'.", uri);
throw new CookieException(text3, ex);
}
}
}
// Token: 0x060011C3 RID: 4547 RVA: 0x00034C38 File Offset: 0x00032E38
private static Cookie Parse(string s)
{
string[] array = s.Split(new char[] { ';' });
Cookie cookie = new Cookie();
int i = 0;
while (i < array.Length)
{
int num = array[i].IndexOf('=');
string text;
string text2;
if (num == -1)
{
text = array[i].Trim();
text2 = string.Empty;
}
else
{
text = array[i].Substring(0, num).Trim();
text2 = array[i].Substring(num + 1).Trim();
}
string text3 = text.ToLower(CultureInfo.InvariantCulture);
if (text3 == null)
{
goto IL_1C4;
}
if (CookieContainer.<>f__switch$map4 == null)
{
CookieContainer.<>f__switch$map4 = new Dictionary<string, int>(8)
{
{ "path", 0 },
{ "$path", 0 },
{ "domain", 1 },
{ "$domain", 1 },
{ "expires", 2 },
{ "$expires", 2 },
{ "httponly", 3 },
{ "secure", 4 }
};
}
int num2;
if (!CookieContainer.<>f__switch$map4.TryGetValue(text3, out num2))
{
goto IL_1C4;
}
switch (num2)
{
case 0:
if (cookie.Path.Length == 0)
{
cookie.Path = text2;
}
break;
case 1:
if (cookie.Domain.Length == 0)
{
cookie.Domain = text2;
cookie.ExactDomain = false;
}
break;
case 2:
if (cookie.Expires == DateTime.MinValue)
{
cookie.Expires = DateTime.SpecifyKind(DateTime.ParseExact(text2, "ddd, dd-MMM-yyyy HH:mm:ss G\\MT", CultureInfo.InvariantCulture), DateTimeKind.Utc);
}
break;
case 3:
cookie.HttpOnly = true;
break;
case 4:
cookie.Secure = true;
break;
default:
goto IL_1C4;
}
IL_1E8:
i++;
continue;
IL_1C4:
if (cookie.Name.Length == 0)
{
cookie.Name = text;
cookie.Value = text2;
}
goto IL_1E8;
}
return cookie;
}
// Token: 0x060011C4 RID: 4548 RVA: 0x00034E3C File Offset: 0x0003303C
private static bool IsNullOrEmpty(string s)
{
return s == null || s.Length == 0;
}
/// <summary>Represents the default maximum size, in bytes, of the <see cref="T:System.Net.Cookie" /> instances that the <see cref="T:System.Net.CookieContainer" /> can hold. This field is constant.</summary>
// Token: 0x04000F8C RID: 3980
public const int DefaultCookieLengthLimit = 4096;
/// <summary>Represents the default maximum number of <see cref="T:System.Net.Cookie" /> instances that the <see cref="T:System.Net.CookieContainer" /> can hold. This field is constant.</summary>
// Token: 0x04000F8D RID: 3981
public const int DefaultCookieLimit = 300;
/// <summary>Represents the default maximum number of <see cref="T:System.Net.Cookie" /> instances that the <see cref="T:System.Net.CookieContainer" /> can reference per domain. This field is constant.</summary>
// Token: 0x04000F8E RID: 3982
public const int DefaultPerDomainCookieLimit = 20;
// Token: 0x04000F8F RID: 3983
private int capacity = 300;
// Token: 0x04000F90 RID: 3984
private int perDomainCapacity = 20;
// Token: 0x04000F91 RID: 3985
private int maxCookieSize = 4096;
// Token: 0x04000F92 RID: 3986
private CookieCollection cookies;
}
}
+56
View File
@@ -0,0 +1,56 @@
using System;
using System.Runtime.Serialization;
namespace System.Net
{
/// <summary>The exception that is thrown when an error is made adding a <see cref="T:System.Net.Cookie" /> to a <see cref="T:System.Net.CookieContainer" />.</summary>
// Token: 0x02000209 RID: 521
[Serializable]
public class CookieException : FormatException, ISerializable
{
/// <summary>Initializes a new instance of the <see cref="T:System.Net.CookieException" /> class.</summary>
// Token: 0x060011C5 RID: 4549 RVA: 0x00034E50 File Offset: 0x00033050
public CookieException()
{
}
// Token: 0x060011C6 RID: 4550 RVA: 0x00034E58 File Offset: 0x00033058
internal CookieException(string msg)
: base(msg)
{
}
// Token: 0x060011C7 RID: 4551 RVA: 0x00034E64 File Offset: 0x00033064
internal CookieException(string msg, Exception e)
: base(msg, e)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.CookieException" /> class with specific values of <paramref name="serializationInfo" /> and <paramref name="streamingContext" />.</summary>
/// <param name="serializationInfo">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> to be used. </param>
/// <param name="streamingContext">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> to be used. </param>
// Token: 0x060011C8 RID: 4552 RVA: 0x00034E70 File Offset: 0x00033070
protected CookieException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> instance with the data needed to serialize the <see cref="T:System.Net.CookieException" />.</summary>
/// <param name="serializationInfo">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> to be used. </param>
/// <param name="streamingContext">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> to be used. </param>
// Token: 0x060011C9 RID: 4553 RVA: 0x00034E7C File Offset: 0x0003307C
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
}
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> instance with the data needed to serialize the <see cref="T:System.Net.CookieException" />.</summary>
/// <param name="serializationInfo">The object that holds the serialized object data. The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> to populate with data.</param>
/// <param name="streamingContext">The contextual information about the source or destination. A <see cref="T:System.Runtime.Serialization.StreamingContext" /> that specifies the destination for this serialization.</param>
// Token: 0x060011CA RID: 4554 RVA: 0x00034E88 File Offset: 0x00033088
public override void GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
base.GetObjectData(serializationInfo, streamingContext);
}
}
}
+109
View File
@@ -0,0 +1,109 @@
using System;
namespace System.Net
{
// Token: 0x0200023A RID: 570
internal class CookieParser
{
// Token: 0x06001462 RID: 5218 RVA: 0x00040AD4 File Offset: 0x0003ECD4
public CookieParser(string header)
: this(header, 0)
{
}
// Token: 0x06001463 RID: 5219 RVA: 0x00040AE0 File Offset: 0x0003ECE0
public CookieParser(string header, int position)
{
this.header = header;
this.pos = position;
this.length = header.Length;
}
// Token: 0x06001464 RID: 5220 RVA: 0x00040B10 File Offset: 0x0003ED10
public bool GetNextNameValue(out string name, out string val)
{
name = null;
val = null;
if (this.pos >= this.length)
{
return false;
}
name = this.GetCookieName();
if (this.pos < this.header.Length && this.header[this.pos] == '=')
{
this.pos++;
val = this.GetCookieValue();
}
if (this.pos < this.length && this.header[this.pos] == ';')
{
this.pos++;
}
return true;
}
// Token: 0x06001465 RID: 5221 RVA: 0x00040BBC File Offset: 0x0003EDBC
private string GetCookieName()
{
int num = this.pos;
while (num < this.length && char.IsWhiteSpace(this.header[num]))
{
num++;
}
int num2 = num;
while (num < this.length && this.header[num] != ';' && this.header[num] != '=')
{
num++;
}
this.pos = num;
return this.header.Substring(num2, num - num2).Trim();
}
// Token: 0x06001466 RID: 5222 RVA: 0x00040C54 File Offset: 0x0003EE54
private string GetCookieValue()
{
if (this.pos >= this.length)
{
return null;
}
int num = this.pos;
while (num < this.length && char.IsWhiteSpace(this.header[num]))
{
num++;
}
int num2;
if (this.header[num] == '"')
{
num = (num2 = num + 1);
while (num < this.length && this.header[num] != '"')
{
num++;
}
int num3 = num;
while (num3 < this.length && this.header[num3] != ';')
{
num3++;
}
this.pos = num3;
}
else
{
num2 = num;
while (num < this.length && this.header[num] != ';')
{
num++;
}
this.pos = num;
}
return this.header.Substring(num2, num - num2).Trim();
}
// Token: 0x04001166 RID: 4454
private string header;
// Token: 0x04001167 RID: 4455
private int pos;
// Token: 0x04001168 RID: 4456
private int length;
}
}
+394
View File
@@ -0,0 +1,394 @@
using System;
using System.Collections;
namespace System.Net
{
/// <summary>Provides storage for multiple credentials.</summary>
// Token: 0x0200020A RID: 522
public class CredentialCache : IEnumerable, ICredentials, ICredentialsByHost
{
/// <summary>Creates a new instance of the <see cref="T:System.Net.CredentialCache" /> class.</summary>
// Token: 0x060011CB RID: 4555 RVA: 0x00034E94 File Offset: 0x00033094
public CredentialCache()
{
this.cache = new Hashtable();
this.cacheForHost = new Hashtable();
}
/// <summary>Gets the system credentials of the application.</summary>
/// <returns>An <see cref="T:System.Net.ICredentials" /> that represents the system credentials of the application.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="USERNAME" />
/// </PermissionSet>
// Token: 0x170005D3 RID: 1491
// (get) Token: 0x060011CD RID: 4557 RVA: 0x00034ED0 File Offset: 0x000330D0
[global::System.MonoTODO("Need EnvironmentPermission implementation first")]
public static ICredentials DefaultCredentials
{
get
{
return CredentialCache.empty;
}
}
/// <summary>Gets the network credentials of the current security context.</summary>
/// <returns>An <see cref="T:System.Net.NetworkCredential" /> that represents the network credentials of the current user or application.</returns>
// Token: 0x170005D4 RID: 1492
// (get) Token: 0x060011CE RID: 4558 RVA: 0x00034ED8 File Offset: 0x000330D8
public static NetworkCredential DefaultNetworkCredentials
{
get
{
return CredentialCache.empty;
}
}
/// <summary>Returns the <see cref="T:System.Net.NetworkCredential" /> instance associated with the specified Uniform Resource Identifier (URI) and authentication type.</summary>
/// <returns>A <see cref="T:System.Net.NetworkCredential" /> or, if there is no matching credential in the cache, null.</returns>
/// <param name="uriPrefix">A <see cref="T:System.Uri" /> that specifies the URI prefix of the resources that the credential grants access to. </param>
/// <param name="authType">The authentication scheme used by the resource named in <paramref name="uriPrefix" />. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="uriPrefix" /> or <paramref name="authType" /> is null. </exception>
// Token: 0x060011CF RID: 4559 RVA: 0x00034EE0 File Offset: 0x000330E0
public NetworkCredential GetCredential(global::System.Uri uriPrefix, string authType)
{
int num = -1;
NetworkCredential networkCredential = null;
if (uriPrefix == null || authType == null)
{
return null;
}
string text = uriPrefix.AbsolutePath;
text = text.Substring(0, text.LastIndexOf('/'));
IDictionaryEnumerator enumerator = this.cache.GetEnumerator();
while (enumerator.MoveNext())
{
CredentialCache.CredentialCacheKey credentialCacheKey = enumerator.Key as CredentialCache.CredentialCacheKey;
if (credentialCacheKey.Length > num)
{
if (string.Compare(credentialCacheKey.AuthType, authType, true) == 0)
{
global::System.Uri uriPrefix2 = credentialCacheKey.UriPrefix;
if (!(uriPrefix2.Scheme != uriPrefix.Scheme))
{
if (uriPrefix2.Port == uriPrefix.Port)
{
if (!(uriPrefix2.Host != uriPrefix.Host))
{
if (text.StartsWith(credentialCacheKey.AbsPath))
{
num = credentialCacheKey.Length;
networkCredential = (NetworkCredential)enumerator.Value;
}
}
}
}
}
}
}
return networkCredential;
}
/// <summary>Returns an enumerator that can iterate through the <see cref="T:System.Net.CredentialCache" /> instance.</summary>
/// <returns>An <see cref="T:System.Collections.IEnumerator" /> for the <see cref="T:System.Net.CredentialCache" />.</returns>
// Token: 0x060011D0 RID: 4560 RVA: 0x00034FF4 File Offset: 0x000331F4
public IEnumerator GetEnumerator()
{
return this.cache.Values.GetEnumerator();
}
/// <summary>Adds a <see cref="T:System.Net.NetworkCredential" /> instance to the credential cache for use with protocols other than SMTP and associates it with a Uniform Resource Identifier (URI) prefix and authentication protocol. </summary>
/// <param name="uriPrefix">A <see cref="T:System.Uri" /> that specifies the URI prefix of the resources that the credential grants access to. </param>
/// <param name="authType">The authentication scheme used by the resource named in <paramref name="uriPrefix" />. </param>
/// <param name="cred">The <see cref="T:System.Net.NetworkCredential" /> to add to the credential cache. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="uriPrefix" /> is null. -or- <paramref name="authType" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">The same credentials are added more than once. </exception>
// Token: 0x060011D1 RID: 4561 RVA: 0x00035008 File Offset: 0x00033208
public void Add(global::System.Uri uriPrefix, string authType, NetworkCredential cred)
{
if (uriPrefix == null)
{
throw new ArgumentNullException("uriPrefix");
}
if (authType == null)
{
throw new ArgumentNullException("authType");
}
this.cache.Add(new CredentialCache.CredentialCacheKey(uriPrefix, authType), cred);
}
/// <summary>Deletes a <see cref="T:System.Net.NetworkCredential" /> instance from the cache if it is associated with the specified Uniform Resource Identifier (URI) prefix and authentication protocol.</summary>
/// <param name="uriPrefix">A <see cref="T:System.Uri" /> that specifies the URI prefix of the resources that the credential is used for. </param>
/// <param name="authType">The authentication scheme used by the host named in <paramref name="uriPrefix" />. </param>
// Token: 0x060011D2 RID: 4562 RVA: 0x00035048 File Offset: 0x00033248
public void Remove(global::System.Uri uriPrefix, string authType)
{
if (uriPrefix == null)
{
throw new ArgumentNullException("uriPrefix");
}
if (authType == null)
{
throw new ArgumentNullException("authType");
}
this.cache.Remove(new CredentialCache.CredentialCacheKey(uriPrefix, authType));
}
/// <summary>Returns the <see cref="T:System.Net.NetworkCredential" /> instance associated with the specified host, port, and authentication protocol.</summary>
/// <returns>A <see cref="T:System.Net.NetworkCredential" /> or, if there is no matching credential in the cache, null.</returns>
/// <param name="host">A <see cref="T:System.String" /> that identifies the host computer.</param>
/// <param name="port">A <see cref="T:System.Int32" /> that specifies the port to connect to on <paramref name="host" />.</param>
/// <param name="authenticationType">A <see cref="T:System.String" /> that identifies the authentication scheme used when connecting to <paramref name="host" />. See Remarks.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="host" /> is null. -or- <paramref name="authType" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="authType" /> not an accepted value. See Remarks. -or-<paramref name="host" /> is equal to the empty string ("").</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="port" /> is less than zero.</exception>
// Token: 0x060011D3 RID: 4563 RVA: 0x00035090 File Offset: 0x00033290
public NetworkCredential GetCredential(string host, int port, string authenticationType)
{
NetworkCredential networkCredential = null;
if (host == null || port < 0 || authenticationType == null)
{
return null;
}
IDictionaryEnumerator enumerator = this.cacheForHost.GetEnumerator();
while (enumerator.MoveNext())
{
CredentialCache.CredentialCacheForHostKey credentialCacheForHostKey = enumerator.Key as CredentialCache.CredentialCacheForHostKey;
if (string.Compare(credentialCacheForHostKey.AuthType, authenticationType, true) == 0)
{
if (!(credentialCacheForHostKey.Host != host))
{
if (credentialCacheForHostKey.Port == port)
{
networkCredential = (NetworkCredential)enumerator.Value;
}
}
}
}
return networkCredential;
}
/// <summary>Adds a <see cref="T:System.Net.NetworkCredential" /> instance for use with SMTP to the credential cache and associates it with a host computer, port, and authentication protocol. Credentials added using this method are valid for SMTP only. This method does not work for HTTP or FTP requests.</summary>
/// <param name="host">A <see cref="T:System.String" /> that identifies the host computer.</param>
/// <param name="port">A <see cref="T:System.Int32" /> that specifies the port to connect to on <paramref name="host" />.</param>
/// <param name="authenticationType">A <see cref="T:System.String" /> that identifies the authentication scheme used when connecting to <paramref name="host" /> using <paramref name="cred" />. See Remarks.</param>
/// <param name="credential">The <see cref="T:System.Net.NetworkCredential" /> to add to the credential cache. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="host" /> is null. -or-<paramref name="authType" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="authType" /> not an accepted value. See Remarks. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="port" /> is less than zero.</exception>
// Token: 0x060011D4 RID: 4564 RVA: 0x00035128 File Offset: 0x00033328
public void Add(string host, int port, string authenticationType, NetworkCredential credential)
{
if (host == null)
{
throw new ArgumentNullException("host");
}
if (port < 0)
{
throw new ArgumentOutOfRangeException("port");
}
if (authenticationType == null)
{
throw new ArgumentOutOfRangeException("authenticationType");
}
this.cacheForHost.Add(new CredentialCache.CredentialCacheForHostKey(host, port, authenticationType), credential);
}
/// <summary>Deletes a <see cref="T:System.Net.NetworkCredential" /> instance from the cache if it is associated with the specified host, port, and authentication protocol.</summary>
/// <param name="host">A <see cref="T:System.String" /> that identifies the host computer.</param>
/// <param name="port">A <see cref="T:System.Int32" /> that specifies the port to connect to on <paramref name="host" />.</param>
/// <param name="authenticationType">A <see cref="T:System.String" /> that identifies the authentication scheme used when connecting to <paramref name="host" />. See Remarks.</param>
// Token: 0x060011D5 RID: 4565 RVA: 0x00035180 File Offset: 0x00033380
public void Remove(string host, int port, string authenticationType)
{
if (host == null)
{
return;
}
if (authenticationType == null)
{
return;
}
this.cacheForHost.Remove(new CredentialCache.CredentialCacheForHostKey(host, port, authenticationType));
}
// Token: 0x04000F94 RID: 3988
private static NetworkCredential empty = new NetworkCredential(string.Empty, string.Empty, string.Empty);
// Token: 0x04000F95 RID: 3989
private Hashtable cache;
// Token: 0x04000F96 RID: 3990
private Hashtable cacheForHost;
// Token: 0x0200020B RID: 523
private class CredentialCacheKey
{
// Token: 0x060011D6 RID: 4566 RVA: 0x000351A4 File Offset: 0x000333A4
internal CredentialCacheKey(global::System.Uri uriPrefix, string authType)
{
this.uriPrefix = uriPrefix;
this.authType = authType;
this.absPath = uriPrefix.AbsolutePath;
this.absPath = this.absPath.Substring(0, this.absPath.LastIndexOf('/'));
this.len = uriPrefix.AbsoluteUri.Length;
this.hash = uriPrefix.GetHashCode() + authType.GetHashCode();
}
// Token: 0x170005D5 RID: 1493
// (get) Token: 0x060011D7 RID: 4567 RVA: 0x00035214 File Offset: 0x00033414
public int Length
{
get
{
return this.len;
}
}
// Token: 0x170005D6 RID: 1494
// (get) Token: 0x060011D8 RID: 4568 RVA: 0x0003521C File Offset: 0x0003341C
public string AbsPath
{
get
{
return this.absPath;
}
}
// Token: 0x170005D7 RID: 1495
// (get) Token: 0x060011D9 RID: 4569 RVA: 0x00035224 File Offset: 0x00033424
public global::System.Uri UriPrefix
{
get
{
return this.uriPrefix;
}
}
// Token: 0x170005D8 RID: 1496
// (get) Token: 0x060011DA RID: 4570 RVA: 0x0003522C File Offset: 0x0003342C
public string AuthType
{
get
{
return this.authType;
}
}
// Token: 0x060011DB RID: 4571 RVA: 0x00035234 File Offset: 0x00033434
public override int GetHashCode()
{
return this.hash;
}
// Token: 0x060011DC RID: 4572 RVA: 0x0003523C File Offset: 0x0003343C
public override bool Equals(object obj)
{
CredentialCache.CredentialCacheKey credentialCacheKey = obj as CredentialCache.CredentialCacheKey;
return credentialCacheKey != null && this.hash == credentialCacheKey.hash;
}
// Token: 0x060011DD RID: 4573 RVA: 0x00035268 File Offset: 0x00033468
public override string ToString()
{
return string.Concat(new object[] { this.absPath, " : ", this.authType, " : len=", this.len });
}
// Token: 0x04000F97 RID: 3991
private global::System.Uri uriPrefix;
// Token: 0x04000F98 RID: 3992
private string authType;
// Token: 0x04000F99 RID: 3993
private string absPath;
// Token: 0x04000F9A RID: 3994
private int len;
// Token: 0x04000F9B RID: 3995
private int hash;
}
// Token: 0x0200020C RID: 524
private class CredentialCacheForHostKey
{
// Token: 0x060011DE RID: 4574 RVA: 0x000352A8 File Offset: 0x000334A8
internal CredentialCacheForHostKey(string host, int port, string authType)
{
this.host = host;
this.port = port;
this.authType = authType;
this.hash = host.GetHashCode() + port.GetHashCode() + authType.GetHashCode();
}
// Token: 0x170005D9 RID: 1497
// (get) Token: 0x060011DF RID: 4575 RVA: 0x000352EC File Offset: 0x000334EC
public string Host
{
get
{
return this.host;
}
}
// Token: 0x170005DA RID: 1498
// (get) Token: 0x060011E0 RID: 4576 RVA: 0x000352F4 File Offset: 0x000334F4
public int Port
{
get
{
return this.port;
}
}
// Token: 0x170005DB RID: 1499
// (get) Token: 0x060011E1 RID: 4577 RVA: 0x000352FC File Offset: 0x000334FC
public string AuthType
{
get
{
return this.authType;
}
}
// Token: 0x060011E2 RID: 4578 RVA: 0x00035304 File Offset: 0x00033504
public override int GetHashCode()
{
return this.hash;
}
// Token: 0x060011E3 RID: 4579 RVA: 0x0003530C File Offset: 0x0003350C
public override bool Equals(object obj)
{
CredentialCache.CredentialCacheForHostKey credentialCacheForHostKey = obj as CredentialCache.CredentialCacheForHostKey;
return credentialCacheForHostKey != null && this.hash == credentialCacheForHostKey.hash;
}
// Token: 0x060011E4 RID: 4580 RVA: 0x00035338 File Offset: 0x00033538
public override string ToString()
{
return this.host + " : " + this.authType;
}
// Token: 0x04000F9C RID: 3996
private string host;
// Token: 0x04000F9D RID: 3997
private int port;
// Token: 0x04000F9E RID: 3998
private string authType;
// Token: 0x04000F9F RID: 3999
private int hash;
}
}
}
+20
View File
@@ -0,0 +1,20 @@
using System;
namespace System.Net
{
/// <summary>Represents the file compression and decompression encoding format to be used to compress the data received in response to an <see cref="T:System.Net.HttpWebRequest" />.</summary>
// Token: 0x0200020D RID: 525
[Flags]
public enum DecompressionMethods
{
/// <summary>Do not use compression.</summary>
// Token: 0x04000FA1 RID: 4001
None = 0,
/// <summary>Use the gZip compression-decompression algorithm.</summary>
// Token: 0x04000FA2 RID: 4002
GZip = 1,
/// <summary>Use the deflate compression-decompression algorithm.</summary>
// Token: 0x04000FA3 RID: 4003
Deflate = 2
}
}
+15
View File
@@ -0,0 +1,15 @@
using System;
using System.Security.Cryptography.X509Certificates;
namespace System.Net
{
// Token: 0x0200020E RID: 526
internal class DefaultCertificatePolicy : ICertificatePolicy
{
// Token: 0x060011E6 RID: 4582 RVA: 0x00035358 File Offset: 0x00033558
public bool CheckValidationResult(ServicePoint point, X509Certificate certificate, WebRequest request, int certificateProblem)
{
return ServicePointManager.ServerCertificateValidationCallback != null || certificateProblem == -2146762495 || certificateProblem == 0;
}
}
}
+137
View File
@@ -0,0 +1,137 @@
using System;
using System.Collections;
namespace System.Net
{
// Token: 0x02000211 RID: 529
internal class DigestClient : IAuthenticationModule
{
// Token: 0x170005E8 RID: 1512
// (get) Token: 0x06001203 RID: 4611 RVA: 0x00035C6C File Offset: 0x00033E6C
private static Hashtable Cache
{
get
{
object syncRoot = DigestClient.cache.SyncRoot;
lock (syncRoot)
{
DigestClient.CheckExpired(DigestClient.cache.Count);
}
return DigestClient.cache;
}
}
// Token: 0x06001204 RID: 4612 RVA: 0x00035CC8 File Offset: 0x00033EC8
private static void CheckExpired(int count)
{
if (count < 10)
{
return;
}
DateTime dateTime = DateTime.MaxValue;
DateTime now = DateTime.Now;
ArrayList arrayList = null;
foreach (object obj in DigestClient.cache.Keys)
{
int num = (int)obj;
DigestSession digestSession = (DigestSession)DigestClient.cache[num];
if (digestSession.LastUse < dateTime && (digestSession.LastUse - now).Ticks > 6000000000L)
{
dateTime = digestSession.LastUse;
if (arrayList == null)
{
arrayList = new ArrayList();
}
arrayList.Add(num);
}
}
if (arrayList != null)
{
foreach (object obj2 in arrayList)
{
int num2 = (int)obj2;
DigestClient.cache.Remove(num2);
}
}
}
// Token: 0x06001205 RID: 4613 RVA: 0x00035E34 File Offset: 0x00034034
public Authorization Authenticate(string challenge, WebRequest webRequest, ICredentials credentials)
{
if (credentials == null || challenge == null)
{
return null;
}
string text = challenge.Trim();
if (text.ToLower().IndexOf("digest") == -1)
{
return null;
}
HttpWebRequest httpWebRequest = webRequest as HttpWebRequest;
if (httpWebRequest == null)
{
return null;
}
int num = httpWebRequest.Address.GetHashCode() ^ credentials.GetHashCode();
DigestSession digestSession = (DigestSession)DigestClient.Cache[num];
bool flag = digestSession == null;
if (flag)
{
digestSession = new DigestSession();
}
if (!digestSession.Parse(challenge))
{
return null;
}
if (flag)
{
DigestClient.Cache.Add(num, digestSession);
}
return digestSession.Authenticate(webRequest, credentials);
}
// Token: 0x06001206 RID: 4614 RVA: 0x00035EE8 File Offset: 0x000340E8
public Authorization PreAuthenticate(WebRequest webRequest, ICredentials credentials)
{
HttpWebRequest httpWebRequest = webRequest as HttpWebRequest;
if (httpWebRequest == null)
{
return null;
}
if (credentials == null)
{
return null;
}
int num = httpWebRequest.Address.GetHashCode() ^ credentials.GetHashCode();
DigestSession digestSession = (DigestSession)DigestClient.Cache[num];
if (digestSession == null)
{
return null;
}
return digestSession.Authenticate(webRequest, credentials);
}
// Token: 0x170005E9 RID: 1513
// (get) Token: 0x06001207 RID: 4615 RVA: 0x00035F48 File Offset: 0x00034148
public string AuthenticationType
{
get
{
return "Digest";
}
}
// Token: 0x170005EA RID: 1514
// (get) Token: 0x06001208 RID: 4616 RVA: 0x00035F50 File Offset: 0x00034150
public bool CanPreAuthenticate
{
get
{
return true;
}
}
// Token: 0x04000FAF RID: 4015
private static readonly Hashtable cache = Hashtable.Synchronized(new Hashtable());
}
}
+193
View File
@@ -0,0 +1,193 @@
using System;
namespace System.Net
{
// Token: 0x0200020F RID: 527
internal class DigestHeaderParser
{
// Token: 0x060011E7 RID: 4583 RVA: 0x00035390 File Offset: 0x00033590
public DigestHeaderParser(string header)
{
this.header = header.Trim();
}
// Token: 0x170005DC RID: 1500
// (get) Token: 0x060011E9 RID: 4585 RVA: 0x000353FC File Offset: 0x000335FC
public string Realm
{
get
{
return this.values[0];
}
}
// Token: 0x170005DD RID: 1501
// (get) Token: 0x060011EA RID: 4586 RVA: 0x00035408 File Offset: 0x00033608
public string Opaque
{
get
{
return this.values[1];
}
}
// Token: 0x170005DE RID: 1502
// (get) Token: 0x060011EB RID: 4587 RVA: 0x00035414 File Offset: 0x00033614
public string Nonce
{
get
{
return this.values[2];
}
}
// Token: 0x170005DF RID: 1503
// (get) Token: 0x060011EC RID: 4588 RVA: 0x00035420 File Offset: 0x00033620
public string Algorithm
{
get
{
return this.values[3];
}
}
// Token: 0x170005E0 RID: 1504
// (get) Token: 0x060011ED RID: 4589 RVA: 0x0003542C File Offset: 0x0003362C
public string QOP
{
get
{
return this.values[4];
}
}
// Token: 0x060011EE RID: 4590 RVA: 0x00035438 File Offset: 0x00033638
public bool Parse()
{
if (!this.header.ToLower().StartsWith("digest "))
{
return false;
}
this.pos = 6;
this.length = this.header.Length;
while (this.pos < this.length)
{
string text;
string text2;
if (!this.GetKeywordAndValue(out text, out text2))
{
return false;
}
this.SkipWhitespace();
if (this.pos < this.length && this.header[this.pos] == ',')
{
this.pos++;
}
int num = Array.IndexOf<string>(DigestHeaderParser.keywords, text);
if (num != -1)
{
if (this.values[num] != null)
{
return false;
}
this.values[num] = text2;
}
}
return this.Realm != null && this.Nonce != null;
}
// Token: 0x060011EF RID: 4591 RVA: 0x00035528 File Offset: 0x00033728
private void SkipWhitespace()
{
char c = ' ';
while (this.pos < this.length && (c == ' ' || c == '\t' || c == '\r' || c == '\n'))
{
c = this.header[this.pos++];
}
this.pos--;
}
// Token: 0x060011F0 RID: 4592 RVA: 0x0003559C File Offset: 0x0003379C
private string GetKey()
{
this.SkipWhitespace();
int num = this.pos;
while (this.pos < this.length && this.header[this.pos] != '=')
{
this.pos++;
}
return this.header.Substring(num, this.pos - num).Trim().ToLower();
}
// Token: 0x060011F1 RID: 4593 RVA: 0x00035614 File Offset: 0x00033814
private bool GetKeywordAndValue(out string key, out string value)
{
key = null;
value = null;
key = this.GetKey();
if (this.pos >= this.length)
{
return false;
}
this.SkipWhitespace();
if (this.pos + 1 >= this.length || this.header[this.pos++] != '=')
{
return false;
}
this.SkipWhitespace();
if (this.pos + 1 >= this.length)
{
return false;
}
bool flag = false;
if (this.header[this.pos] == '"')
{
this.pos++;
flag = true;
}
int num = this.pos;
if (flag)
{
this.pos = this.header.IndexOf('"', this.pos);
if (this.pos == -1)
{
return false;
}
}
else
{
do
{
char c = this.header[this.pos];
if (c == ',' || c == ' ' || c == '\t' || c == '\r' || c == '\n')
{
break;
}
}
while (++this.pos < this.length);
if (this.pos >= this.length && num == this.pos)
{
return false;
}
}
value = this.header.Substring(num, this.pos - num);
this.pos += 2;
return true;
}
// Token: 0x04000FA4 RID: 4004
private string header;
// Token: 0x04000FA5 RID: 4005
private int length;
// Token: 0x04000FA6 RID: 4006
private int pos;
// Token: 0x04000FA7 RID: 4007
private static string[] keywords = new string[] { "realm", "opaque", "nonce", "algorithm", "qop" };
// Token: 0x04000FA8 RID: 4008
private string[] values = new string[DigestHeaderParser.keywords.Length];
}
}
+235
View File
@@ -0,0 +1,235 @@
using System;
using System.Security.Cryptography;
using System.Text;
namespace System.Net
{
// Token: 0x02000210 RID: 528
internal class DigestSession
{
// Token: 0x060011F2 RID: 4594 RVA: 0x000357A0 File Offset: 0x000339A0
public DigestSession()
{
this._nc = 1;
this.lastUse = DateTime.Now;
}
// Token: 0x170005E1 RID: 1505
// (get) Token: 0x060011F4 RID: 4596 RVA: 0x000357C8 File Offset: 0x000339C8
public string Algorithm
{
get
{
return this.parser.Algorithm;
}
}
// Token: 0x170005E2 RID: 1506
// (get) Token: 0x060011F5 RID: 4597 RVA: 0x000357D8 File Offset: 0x000339D8
public string Realm
{
get
{
return this.parser.Realm;
}
}
// Token: 0x170005E3 RID: 1507
// (get) Token: 0x060011F6 RID: 4598 RVA: 0x000357E8 File Offset: 0x000339E8
public string Nonce
{
get
{
return this.parser.Nonce;
}
}
// Token: 0x170005E4 RID: 1508
// (get) Token: 0x060011F7 RID: 4599 RVA: 0x000357F8 File Offset: 0x000339F8
public string Opaque
{
get
{
return this.parser.Opaque;
}
}
// Token: 0x170005E5 RID: 1509
// (get) Token: 0x060011F8 RID: 4600 RVA: 0x00035808 File Offset: 0x00033A08
public string QOP
{
get
{
return this.parser.QOP;
}
}
// Token: 0x170005E6 RID: 1510
// (get) Token: 0x060011F9 RID: 4601 RVA: 0x00035818 File Offset: 0x00033A18
public string CNonce
{
get
{
if (this._cnonce == null)
{
byte[] array = new byte[15];
DigestSession.rng.GetBytes(array);
this._cnonce = Convert.ToBase64String(array);
Array.Clear(array, 0, array.Length);
}
return this._cnonce;
}
}
// Token: 0x060011FA RID: 4602 RVA: 0x00035860 File Offset: 0x00033A60
public bool Parse(string challenge)
{
this.parser = new DigestHeaderParser(challenge);
if (!this.parser.Parse())
{
return false;
}
if (this.parser.Algorithm == null || this.parser.Algorithm.ToUpper().StartsWith("MD5"))
{
this.hash = HashAlgorithm.Create("MD5");
}
return true;
}
// Token: 0x060011FB RID: 4603 RVA: 0x000358CC File Offset: 0x00033ACC
private string HashToHexString(string toBeHashed)
{
if (this.hash == null)
{
return null;
}
this.hash.Initialize();
byte[] array = this.hash.ComputeHash(Encoding.ASCII.GetBytes(toBeHashed));
StringBuilder stringBuilder = new StringBuilder();
foreach (byte b in array)
{
stringBuilder.Append(b.ToString("x2"));
}
return stringBuilder.ToString();
}
// Token: 0x060011FC RID: 4604 RVA: 0x00035948 File Offset: 0x00033B48
private string HA1(string username, string password)
{
string text = string.Format("{0}:{1}:{2}", username, this.Realm, password);
if (this.Algorithm != null && this.Algorithm.ToLower() == "md5-sess")
{
text = string.Format("{0}:{1}:{2}", this.HashToHexString(text), this.Nonce, this.CNonce);
}
return this.HashToHexString(text);
}
// Token: 0x060011FD RID: 4605 RVA: 0x000359B4 File Offset: 0x00033BB4
private string HA2(HttpWebRequest webRequest)
{
string text = string.Format("{0}:{1}", webRequest.Method, webRequest.RequestUri.PathAndQuery);
if (this.QOP == "auth-int")
{
}
return this.HashToHexString(text);
}
// Token: 0x060011FE RID: 4606 RVA: 0x000359FC File Offset: 0x00033BFC
private string Response(string username, string password, HttpWebRequest webRequest)
{
string text = string.Format("{0}:{1}:", this.HA1(username, password), this.Nonce);
if (this.QOP != null)
{
text += string.Format("{0}:{1}:{2}:", this._nc.ToString("X8"), this.CNonce, this.QOP);
}
text += this.HA2(webRequest);
return this.HashToHexString(text);
}
// Token: 0x060011FF RID: 4607 RVA: 0x00035A70 File Offset: 0x00033C70
public Authorization Authenticate(WebRequest webRequest, ICredentials credentials)
{
if (this.parser == null)
{
throw new InvalidOperationException();
}
HttpWebRequest httpWebRequest = webRequest as HttpWebRequest;
if (httpWebRequest == null)
{
return null;
}
this.lastUse = DateTime.Now;
NetworkCredential credential = credentials.GetCredential(httpWebRequest.RequestUri, "digest");
if (credential == null)
{
return null;
}
string userName = credential.UserName;
if (userName == null || userName == string.Empty)
{
return null;
}
string password = credential.Password;
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendFormat("Digest username=\"{0}\", ", userName);
stringBuilder.AppendFormat("realm=\"{0}\", ", this.Realm);
stringBuilder.AppendFormat("nonce=\"{0}\", ", this.Nonce);
stringBuilder.AppendFormat("uri=\"{0}\", ", httpWebRequest.Address.PathAndQuery);
if (this.Algorithm != null)
{
stringBuilder.AppendFormat("algorithm=\"{0}\", ", this.Algorithm);
}
stringBuilder.AppendFormat("response=\"{0}\", ", this.Response(userName, password, httpWebRequest));
if (this.QOP != null)
{
stringBuilder.AppendFormat("qop=\"{0}\", ", this.QOP);
}
lock (this)
{
if (this.QOP != null)
{
stringBuilder.AppendFormat("nc={0:X8}, ", this._nc);
this._nc++;
}
}
if (this.CNonce != null)
{
stringBuilder.AppendFormat("cnonce=\"{0}\", ", this.CNonce);
}
if (this.Opaque != null)
{
stringBuilder.AppendFormat("opaque=\"{0}\", ", this.Opaque);
}
stringBuilder.Length -= 2;
return new Authorization(stringBuilder.ToString());
}
// Token: 0x170005E7 RID: 1511
// (get) Token: 0x06001200 RID: 4608 RVA: 0x00035C48 File Offset: 0x00033E48
public DateTime LastUse
{
get
{
return this.lastUse;
}
}
// Token: 0x04000FA9 RID: 4009
private static RandomNumberGenerator rng = RandomNumberGenerator.Create();
// Token: 0x04000FAA RID: 4010
private DateTime lastUse;
// Token: 0x04000FAB RID: 4011
private int _nc;
// Token: 0x04000FAC RID: 4012
private HashAlgorithm hash;
// Token: 0x04000FAD RID: 4013
private DigestHeaderParser parser;
// Token: 0x04000FAE RID: 4014
private string _cnonce;
}
}
+513
View File
@@ -0,0 +1,513 @@
using System;
using System.Collections;
using System.Net.Sockets;
using System.Runtime.CompilerServices;
using System.Runtime.Remoting.Messaging;
namespace System.Net
{
/// <summary>Provides simple domain name resolution functionality.</summary>
// Token: 0x02000212 RID: 530
public static class Dns
{
// Token: 0x06001209 RID: 4617 RVA: 0x00035F54 File Offset: 0x00034154
static Dns()
{
global::System.Net.Sockets.Socket.CheckProtocolSupport();
}
/// <summary>Begins an asynchronous request for <see cref="T:System.Net.IPHostEntry" /> information about the specified DNS host name.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> instance that references the asynchronous request.</returns>
/// <param name="hostName">The DNS name of the host. </param>
/// <param name="requestCallback">An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when the operation is complete.</param>
/// <param name="stateObject">A user-defined object that contains information about the operation. This object is passed to the <paramref name="requestCallback" /> delegate when the operation is complete.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="hostName" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error was encountered executing the DNS query. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Net.DnsPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x0600120A RID: 4618 RVA: 0x00035F5C File Offset: 0x0003415C
[Obsolete("Use BeginGetHostEntry instead")]
public static IAsyncResult BeginGetHostByName(string hostName, AsyncCallback requestCallback, object stateObject)
{
if (hostName == null)
{
throw new ArgumentNullException("hostName");
}
Dns.GetHostByNameCallback getHostByNameCallback = new Dns.GetHostByNameCallback(Dns.GetHostByName);
return getHostByNameCallback.BeginInvoke(hostName, requestCallback, stateObject);
}
/// <summary>Begins an asynchronous request to resolve a DNS host name or IP address to an <see cref="T:System.Net.IPAddress" /> instance.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> instance that references the asynchronous request.</returns>
/// <param name="hostName">The DNS name of the host. </param>
/// <param name="requestCallback">An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when the operation is complete. </param>
/// <param name="stateObject">A user-defined object that contains information about the operation. This object is passed to the <paramref name="requestCallback" /> delegate when the operation is complete.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="hostName" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">The caller does not have permission to access DNS information. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Net.DnsPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x0600120B RID: 4619 RVA: 0x00035F90 File Offset: 0x00034190
[Obsolete("Use BeginGetHostEntry instead")]
public static IAsyncResult BeginResolve(string hostName, AsyncCallback requestCallback, object stateObject)
{
if (hostName == null)
{
throw new ArgumentNullException("hostName");
}
Dns.ResolveCallback resolveCallback = new Dns.ResolveCallback(Dns.Resolve);
return resolveCallback.BeginInvoke(hostName, requestCallback, stateObject);
}
/// <summary>Asynchronously returns the Internet Protocol (IP) addresses for the specified host.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> instance that references the asynchronous request.</returns>
/// <param name="hostNameOrAddress">The host name or IP address to resolve.</param>
/// <param name="requestCallback">An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when the operation is complete. </param>
/// <param name="state">A user-defined object that contains information about the operation. This object is passed to the <paramref name="requestCallback" /> delegate when the operation is complete.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="hostNameOrAddress" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of <paramref name="hostNameOrAddress" /> is greater than 126 characters. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error is encountered when resolving <paramref name="hostNameOrAddress" />. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="hostNameOrAddress" /> is an invalid IP address.</exception>
// Token: 0x0600120C RID: 4620 RVA: 0x00035FC4 File Offset: 0x000341C4
public static IAsyncResult BeginGetHostAddresses(string hostNameOrAddress, AsyncCallback requestCallback, object stateObject)
{
if (hostNameOrAddress == null)
{
throw new ArgumentNullException("hostName");
}
if (hostNameOrAddress == "0.0.0.0" || hostNameOrAddress == "::0")
{
throw new ArgumentException("Addresses 0.0.0.0 (IPv4) and ::0 (IPv6) are unspecified addresses. You cannot use them as target address.", "hostNameOrAddress");
}
Dns.GetHostAddressesCallback getHostAddressesCallback = new Dns.GetHostAddressesCallback(Dns.GetHostAddresses);
return getHostAddressesCallback.BeginInvoke(hostNameOrAddress, requestCallback, stateObject);
}
/// <summary>Asynchronously resolves a host name or IP address to an <see cref="T:System.Net.IPHostEntry" /> instance.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> instance that references the asynchronous request.</returns>
/// <param name="hostNameOrAddress">The host name or IP address to resolve.</param>
/// <param name="requestCallback">An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when the operation is complete. </param>
/// <param name="stateObject">A user-defined object that contains information about the operation. This object is passed to the <paramref name="requestCallback" /> delegate when the operation is complete.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="hostNameOrAddress" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of <paramref name="hostNameOrAddress" /> is greater than 126 characters. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error is encountered when resolving <paramref name="hostNameOrAddress" />. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="hostNameOrAddress" /> is an invalid IP address.</exception>
// Token: 0x0600120D RID: 4621 RVA: 0x00036028 File Offset: 0x00034228
public static IAsyncResult BeginGetHostEntry(string hostNameOrAddress, AsyncCallback requestCallback, object stateObject)
{
if (hostNameOrAddress == null)
{
throw new ArgumentNullException("hostName");
}
if (hostNameOrAddress == "0.0.0.0" || hostNameOrAddress == "::0")
{
throw new ArgumentException("Addresses 0.0.0.0 (IPv4) and ::0 (IPv6) are unspecified addresses. You cannot use them as target address.", "hostNameOrAddress");
}
Dns.GetHostEntryNameCallback getHostEntryNameCallback = new Dns.GetHostEntryNameCallback(Dns.GetHostEntry);
return getHostEntryNameCallback.BeginInvoke(hostNameOrAddress, requestCallback, stateObject);
}
/// <summary>Asynchronously resolves an IP address to an <see cref="T:System.Net.IPHostEntry" /> instance.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> instance that references the asynchronous request.</returns>
/// <param name="address">The IP address to resolve.</param>
/// <param name="requestCallback">An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when the operation is complete. </param>
/// <param name="stateObject">A user-defined object that contains information about the operation. This object is passed to the <paramref name="requestCallback" /> delegate when the operation is complete.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="address" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error is encountered when resolving <paramref name="address" />. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="address" /> is an invalid IP address.</exception>
// Token: 0x0600120E RID: 4622 RVA: 0x0003608C File Offset: 0x0003428C
public static IAsyncResult BeginGetHostEntry(IPAddress address, AsyncCallback requestCallback, object stateObject)
{
if (address == null)
{
throw new ArgumentNullException("address");
}
Dns.GetHostEntryIPCallback getHostEntryIPCallback = new Dns.GetHostEntryIPCallback(Dns.GetHostEntry);
return getHostEntryIPCallback.BeginInvoke(address, requestCallback, stateObject);
}
/// <summary>Ends an asynchronous request for DNS information.</summary>
/// <returns>An <see cref="T:System.Net.IPHostEntry" /> object that contains DNS information about a host.</returns>
/// <param name="asyncResult">An <see cref="T:System.IAsyncResult" /> instance that is returned by a call to the <see cref="M:System.Net.Dns.BeginGetHostByName(System.String,System.AsyncCallback,System.Object)" /> method.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is null. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x0600120F RID: 4623 RVA: 0x000360C0 File Offset: 0x000342C0
[Obsolete("Use EndGetHostEntry instead")]
public static IPHostEntry EndGetHostByName(IAsyncResult asyncResult)
{
if (asyncResult == null)
{
throw new ArgumentNullException("asyncResult");
}
AsyncResult asyncResult2 = (AsyncResult)asyncResult;
Dns.GetHostByNameCallback getHostByNameCallback = (Dns.GetHostByNameCallback)asyncResult2.AsyncDelegate;
return getHostByNameCallback.EndInvoke(asyncResult);
}
/// <summary>Ends an asynchronous request for DNS information.</summary>
/// <returns>An <see cref="T:System.Net.IPHostEntry" /> object that contains DNS information about a host.</returns>
/// <param name="asyncResult">An <see cref="T:System.IAsyncResult" /> instance that is returned by a call to the <see cref="M:System.Net.Dns.BeginResolve(System.String,System.AsyncCallback,System.Object)" /> method.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is null. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06001210 RID: 4624 RVA: 0x000360F8 File Offset: 0x000342F8
[Obsolete("Use EndGetHostEntry instead")]
public static IPHostEntry EndResolve(IAsyncResult asyncResult)
{
if (asyncResult == null)
{
throw new ArgumentNullException("asyncResult");
}
AsyncResult asyncResult2 = (AsyncResult)asyncResult;
Dns.ResolveCallback resolveCallback = (Dns.ResolveCallback)asyncResult2.AsyncDelegate;
return resolveCallback.EndInvoke(asyncResult);
}
/// <summary>Ends an asynchronous request for DNS information.</summary>
/// <returns>An array of type <see cref="T:System.Net.IPAddress" /> that holds the IP addresses for the host specified by the <paramref name="hostNameOrAddress" /> parameter of <see cref="M:System.Net.Dns.BeginGetHostAddresses(System.String,System.AsyncCallback,System.Object)" />.</returns>
/// <param name="asyncResult">An <see cref="T:System.IAsyncResult" /> instance returned by a call to the <see cref="M:System.Net.Dns.BeginGetHostAddresses(System.String,System.AsyncCallback,System.Object)" /> method.</param>
// Token: 0x06001211 RID: 4625 RVA: 0x00036130 File Offset: 0x00034330
public static IPAddress[] EndGetHostAddresses(IAsyncResult asyncResult)
{
if (asyncResult == null)
{
throw new ArgumentNullException("asyncResult");
}
AsyncResult asyncResult2 = (AsyncResult)asyncResult;
Dns.GetHostAddressesCallback getHostAddressesCallback = (Dns.GetHostAddressesCallback)asyncResult2.AsyncDelegate;
return getHostAddressesCallback.EndInvoke(asyncResult);
}
/// <summary>Ends an asynchronous request for DNS information.</summary>
/// <returns>An <see cref="T:System.Net.IPHostEntry" /> instance that contains address information about the host.</returns>
/// <param name="asyncResult">An <see cref="T:System.IAsyncResult" /> instance returned by a call to an <see cref="Overload:System.Net.Dns.BeginGetHostEntry" /> method.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is null. </exception>
// Token: 0x06001212 RID: 4626 RVA: 0x00036168 File Offset: 0x00034368
public static IPHostEntry EndGetHostEntry(IAsyncResult asyncResult)
{
if (asyncResult == null)
{
throw new ArgumentNullException("asyncResult");
}
AsyncResult asyncResult2 = (AsyncResult)asyncResult;
if (asyncResult2.AsyncDelegate is Dns.GetHostEntryIPCallback)
{
return ((Dns.GetHostEntryIPCallback)asyncResult2.AsyncDelegate).EndInvoke(asyncResult);
}
Dns.GetHostEntryNameCallback getHostEntryNameCallback = (Dns.GetHostEntryNameCallback)asyncResult2.AsyncDelegate;
return getHostEntryNameCallback.EndInvoke(asyncResult);
}
// Token: 0x06001213 RID: 4627
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern bool GetHostByName_internal(string host, out string h_name, out string[] h_aliases, out string[] h_addr_list);
// Token: 0x06001214 RID: 4628
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern bool GetHostByAddr_internal(string addr, out string h_name, out string[] h_aliases, out string[] h_addr_list);
// Token: 0x06001215 RID: 4629
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern bool GetHostName_internal(out string h_name);
// Token: 0x06001216 RID: 4630 RVA: 0x000361C4 File Offset: 0x000343C4
private static IPHostEntry hostent_to_IPHostEntry(string h_name, string[] h_aliases, string[] h_addrlist)
{
IPHostEntry iphostEntry = new IPHostEntry();
ArrayList arrayList = new ArrayList();
iphostEntry.HostName = h_name;
iphostEntry.Aliases = h_aliases;
for (int i = 0; i < h_addrlist.Length; i++)
{
try
{
IPAddress ipaddress = IPAddress.Parse(h_addrlist[i]);
if ((global::System.Net.Sockets.Socket.SupportsIPv6 && ipaddress.AddressFamily == global::System.Net.Sockets.AddressFamily.InterNetworkV6) || (global::System.Net.Sockets.Socket.SupportsIPv4 && ipaddress.AddressFamily == global::System.Net.Sockets.AddressFamily.InterNetwork))
{
arrayList.Add(ipaddress);
}
}
catch (ArgumentNullException)
{
}
}
if (arrayList.Count == 0)
{
throw new global::System.Net.Sockets.SocketException(11001);
}
iphostEntry.AddressList = arrayList.ToArray(typeof(IPAddress)) as IPAddress[];
return iphostEntry;
}
/// <summary>Creates an <see cref="T:System.Net.IPHostEntry" /> instance from the specified <see cref="T:System.Net.IPAddress" />.</summary>
/// <returns>An <see cref="T:System.Net.IPHostEntry" />.</returns>
/// <param name="address">An <see cref="T:System.Net.IPAddress" />. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="address" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error is encountered when resolving <paramref name="address" />. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Net.DnsPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06001217 RID: 4631 RVA: 0x00036298 File Offset: 0x00034498
[Obsolete("Use GetHostEntry instead")]
public static IPHostEntry GetHostByAddress(IPAddress address)
{
if (address == null)
{
throw new ArgumentNullException("address");
}
return Dns.GetHostByAddressFromString(address.ToString(), false);
}
/// <summary>Creates an <see cref="T:System.Net.IPHostEntry" /> instance from an IP address.</summary>
/// <returns>An <see cref="T:System.Net.IPHostEntry" /> instance.</returns>
/// <param name="address">An IP address. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="address" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error is encountered when resolving <paramref name="address" />. </exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="address" /> is not a valid IP address. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Net.DnsPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06001218 RID: 4632 RVA: 0x000362B8 File Offset: 0x000344B8
[Obsolete("Use GetHostEntry instead")]
public static IPHostEntry GetHostByAddress(string address)
{
if (address == null)
{
throw new ArgumentNullException("address");
}
return Dns.GetHostByAddressFromString(address, true);
}
// Token: 0x06001219 RID: 4633 RVA: 0x000362D4 File Offset: 0x000344D4
private static IPHostEntry GetHostByAddressFromString(string address, bool parse)
{
if (address.Equals("0.0.0.0"))
{
address = "127.0.0.1";
parse = false;
}
if (parse)
{
IPAddress.Parse(address);
}
string text;
string[] array;
string[] array2;
if (!Dns.GetHostByAddr_internal(address, out text, out array, out array2))
{
throw new global::System.Net.Sockets.SocketException(11001);
}
return Dns.hostent_to_IPHostEntry(text, array, array2);
}
/// <summary>Resolves a host name or IP address to an <see cref="T:System.Net.IPHostEntry" /> instance.</summary>
/// <returns>An <see cref="T:System.Net.IPHostEntry" /> instance that contains address information about the host specified in <paramref name="hostNameOrAddress" />.</returns>
/// <param name="hostNameOrAddress">The host name or IP address to resolve.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="hostNameOrAddress" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of <paramref name="hostNameOrAddress" /> parameter is greater than 126 characters. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error was encountered when resolving the <paramref name="hostNameOrAddress" /> parameter. </exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="hostNameOrAddress" /> parameter is an invalid IP address. </exception>
// Token: 0x0600121A RID: 4634 RVA: 0x00036330 File Offset: 0x00034530
public static IPHostEntry GetHostEntry(string hostNameOrAddress)
{
if (hostNameOrAddress == null)
{
throw new ArgumentNullException("hostNameOrAddress");
}
if (hostNameOrAddress == "0.0.0.0" || hostNameOrAddress == "::0")
{
throw new ArgumentException("Addresses 0.0.0.0 (IPv4) and ::0 (IPv6) are unspecified addresses. You cannot use them as target address.", "hostNameOrAddress");
}
IPAddress ipaddress;
if (hostNameOrAddress.Length > 0 && IPAddress.TryParse(hostNameOrAddress, out ipaddress))
{
return Dns.GetHostEntry(ipaddress);
}
return Dns.GetHostByName(hostNameOrAddress);
}
/// <summary>Resolves an IP address to an <see cref="T:System.Net.IPHostEntry" /> instance.</summary>
/// <returns>An <see cref="T:System.Net.IPHostEntry" /> instance that contains address information about the host specified in <paramref name="address" />.</returns>
/// <param name="address">An IP address.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="address" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error is encountered when resolving <paramref name="address" />. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="address" /> is an invalid IP address.</exception>
// Token: 0x0600121B RID: 4635 RVA: 0x000363A4 File Offset: 0x000345A4
public static IPHostEntry GetHostEntry(IPAddress address)
{
if (address == null)
{
throw new ArgumentNullException("address");
}
return Dns.GetHostByAddressFromString(address.ToString(), false);
}
/// <summary>Returns the Internet Protocol (IP) addresses for the specified host.</summary>
/// <returns>An array of type <see cref="T:System.Net.IPAddress" /> that holds the IP addresses for the host that is specified by the <paramref name="hostNameOrAddress" /> parameter.</returns>
/// <param name="hostNameOrAddress">The host name or IP address to resolve.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="hostNameOrAddress" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of <paramref name="hostNameOrAddress" /> is greater than 126 characters. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error is encountered when resolving <paramref name="hostNameOrAddress" />. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="hostNameOrAddress" /> is an invalid IP address.</exception>
// Token: 0x0600121C RID: 4636 RVA: 0x000363C4 File Offset: 0x000345C4
public static IPAddress[] GetHostAddresses(string hostNameOrAddress)
{
if (hostNameOrAddress == null)
{
throw new ArgumentNullException("hostNameOrAddress");
}
if (hostNameOrAddress == "0.0.0.0" || hostNameOrAddress == "::0")
{
throw new ArgumentException("Addresses 0.0.0.0 (IPv4) and ::0 (IPv6) are unspecified addresses. You cannot use them as target address.", "hostNameOrAddress");
}
IPAddress ipaddress;
if (hostNameOrAddress.Length > 0 && IPAddress.TryParse(hostNameOrAddress, out ipaddress))
{
return new IPAddress[] { ipaddress };
}
return Dns.GetHostEntry(hostNameOrAddress).AddressList;
}
/// <summary>Gets the DNS information for the specified DNS host name.</summary>
/// <returns>An <see cref="T:System.Net.IPHostEntry" /> object that contains host information for the address specified in <paramref name="hostName" />.</returns>
/// <param name="hostName">The DNS name of the host. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="hostName" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of <paramref name="hostName" /> is greater than 126 characters. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error is encountered when resolving <paramref name="hostName" />. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Net.DnsPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x0600121D RID: 4637 RVA: 0x00036444 File Offset: 0x00034644
[Obsolete("Use GetHostEntry instead")]
public static IPHostEntry GetHostByName(string hostName)
{
if (hostName == null)
{
throw new ArgumentNullException("hostName");
}
string text;
string[] array;
string[] array2;
if (!Dns.GetHostByName_internal(hostName, out text, out array, out array2))
{
throw new global::System.Net.Sockets.SocketException(11001);
}
return Dns.hostent_to_IPHostEntry(text, array, array2);
}
/// <summary>Gets the host name of the local computer.</summary>
/// <returns>A string that contains the DNS host name of the local computer.</returns>
/// <exception cref="T:System.Net.Sockets.SocketException">An error is encountered when resolving the local host name. </exception>
/// <PermissionSet>
/// <IPermission class="System.Net.DnsPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x0600121E RID: 4638 RVA: 0x00036488 File Offset: 0x00034688
public static string GetHostName()
{
string text;
if (!Dns.GetHostName_internal(out text))
{
throw new global::System.Net.Sockets.SocketException(11001);
}
return text;
}
/// <summary>Resolves a DNS host name or IP address to an <see cref="T:System.Net.IPHostEntry" /> instance.</summary>
/// <returns>An <see cref="T:System.Net.IPHostEntry" /> instance that contains address information about the host specified in <paramref name="hostName" />.</returns>
/// <param name="hostName">A DNS-style host name or IP address. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="hostName" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of <paramref name="hostName" /> is greater than 126 characters. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error is encountered when resolving <paramref name="hostName" />. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Net.DnsPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x0600121F RID: 4639 RVA: 0x000364B0 File Offset: 0x000346B0
[Obsolete("Use GetHostEntry instead")]
public static IPHostEntry Resolve(string hostName)
{
if (hostName == null)
{
throw new ArgumentNullException("hostName");
}
IPHostEntry iphostEntry = null;
try
{
iphostEntry = Dns.GetHostByAddress(hostName);
}
catch
{
}
if (iphostEntry == null)
{
iphostEntry = Dns.GetHostByName(hostName);
}
return iphostEntry;
}
// Token: 0x02000310 RID: 784
// (Invoke) Token: 0x06001C19 RID: 7193
private delegate IPHostEntry GetHostByNameCallback(string hostName);
// Token: 0x02000311 RID: 785
// (Invoke) Token: 0x06001C1D RID: 7197
private delegate IPHostEntry ResolveCallback(string hostName);
// Token: 0x02000312 RID: 786
// (Invoke) Token: 0x06001C21 RID: 7201
private delegate IPHostEntry GetHostEntryNameCallback(string hostName);
// Token: 0x02000313 RID: 787
// (Invoke) Token: 0x06001C25 RID: 7205
private delegate IPHostEntry GetHostEntryIPCallback(IPAddress hostAddress);
// Token: 0x02000314 RID: 788
// (Invoke) Token: 0x06001C29 RID: 7209
private delegate IPAddress[] GetHostAddressesCallback(string hostName);
}
}
@@ -0,0 +1,35 @@
using System;
using System.ComponentModel;
namespace System.Net
{
/// <summary>Provides data for the <see cref="E:System.Net.WebClient.DownloadDataCompleted" /> event.</summary>
// Token: 0x02000213 RID: 531
public class DownloadDataCompletedEventArgs : global::System.ComponentModel.AsyncCompletedEventArgs
{
// Token: 0x06001220 RID: 4640 RVA: 0x0003650C File Offset: 0x0003470C
internal DownloadDataCompletedEventArgs(byte[] result, Exception error, bool cancelled, object userState)
: base(error, cancelled, userState)
{
this.result = result;
}
/// <summary>Gets the data that is downloaded by a <see cref="Overload:System.Net.WebClient.DownloadDataAsync" /> method.</summary>
/// <returns>A <see cref="T:System.Byte" /> array that contains the downloaded data.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x170005EB RID: 1515
// (get) Token: 0x06001221 RID: 4641 RVA: 0x00036520 File Offset: 0x00034720
public byte[] Result
{
get
{
return this.result;
}
}
// Token: 0x04000FB0 RID: 4016
private byte[] result;
}
}
@@ -0,0 +1,11 @@
using System;
namespace System.Net
{
/// <summary>Represents the method that will handle the <see cref="E:System.Net.WebClient.DownloadDataCompleted" /> event of a <see cref="T:System.Net.WebClient" />.</summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">A <see cref="T:System.Net.DownloadDataCompletedEventArgs" /> containing event data.</param>
// Token: 0x02000335 RID: 821
// (Invoke) Token: 0x06001CAD RID: 7341
public delegate void DownloadDataCompletedEventHandler(object sender, DownloadDataCompletedEventArgs e);
}
@@ -0,0 +1,48 @@
using System;
using System.ComponentModel;
namespace System.Net
{
/// <summary>Provides data for the <see cref="E:System.Net.WebClient.DownloadProgressChanged" /> event of a <see cref="T:System.Net.WebClient" />.</summary>
// Token: 0x02000214 RID: 532
public class DownloadProgressChangedEventArgs : global::System.ComponentModel.ProgressChangedEventArgs
{
// Token: 0x06001222 RID: 4642 RVA: 0x00036528 File Offset: 0x00034728
internal DownloadProgressChangedEventArgs(long bytesReceived, long totalBytesToReceive, object userState)
: base((totalBytesToReceive == -1L) ? 0 : ((int)(bytesReceived * 100L / totalBytesToReceive)), userState)
{
this.received = bytesReceived;
this.total = totalBytesToReceive;
}
/// <summary>Gets the number of bytes received.</summary>
/// <returns>An <see cref="T:System.Int64" /> value that indicates the number of bytes received.</returns>
// Token: 0x170005EC RID: 1516
// (get) Token: 0x06001223 RID: 4643 RVA: 0x00036558 File Offset: 0x00034758
public long BytesReceived
{
get
{
return this.received;
}
}
/// <summary>Gets the total number of bytes in a <see cref="T:System.Net.WebClient" /> data download operation.</summary>
/// <returns>An <see cref="T:System.Int64" /> value that indicates the number of bytes that will be received.</returns>
// Token: 0x170005ED RID: 1517
// (get) Token: 0x06001224 RID: 4644 RVA: 0x00036560 File Offset: 0x00034760
public long TotalBytesToReceive
{
get
{
return this.total;
}
}
// Token: 0x04000FB1 RID: 4017
private long received;
// Token: 0x04000FB2 RID: 4018
private long total;
}
}
@@ -0,0 +1,11 @@
using System;
namespace System.Net
{
/// <summary>Represents the method that will handle the <see cref="E:System.Net.WebClient.DownloadProgressChanged" /> event of a <see cref="T:System.Net.WebClient" />.</summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">A <see cref="T:System.Net.DownloadProgressChangedEventArgs" /> containing event data.</param>
// Token: 0x02000336 RID: 822
// (Invoke) Token: 0x06001CB1 RID: 7345
public delegate void DownloadProgressChangedEventHandler(object sender, DownloadProgressChangedEventArgs e);
}
@@ -0,0 +1,36 @@
using System;
using System.ComponentModel;
namespace System.Net
{
/// <summary>Provides data for the <see cref="E:System.Net.WebClient.DownloadStringCompleted" /> event.</summary>
// Token: 0x02000215 RID: 533
public class DownloadStringCompletedEventArgs : global::System.ComponentModel.AsyncCompletedEventArgs
{
// Token: 0x06001225 RID: 4645 RVA: 0x00036568 File Offset: 0x00034768
internal DownloadStringCompletedEventArgs(string result, Exception error, bool cancelled, object userState)
: base(error, cancelled, userState)
{
this.result = result;
}
/// <summary>Gets the data that is downloaded by a <see cref="Overload:System.Net.WebClient.DownloadStringAsync" /> method.</summary>
/// <returns>A <see cref="T:System.String" /> that contains the downloaded data.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x170005EE RID: 1518
// (get) Token: 0x06001226 RID: 4646 RVA: 0x0003657C File Offset: 0x0003477C
public string Result
{
get
{
base.RaiseExceptionIfNecessary();
return this.result;
}
}
// Token: 0x04000FB3 RID: 4019
private string result;
}
}
@@ -0,0 +1,11 @@
using System;
namespace System.Net
{
/// <summary>Represents the method that will handle the <see cref="E:System.Net.WebClient.DownloadStringCompleted" /> event of a <see cref="T:System.Net.WebClient" />.</summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">A <see cref="T:System.Net.DownloadStringCompletedEventArgs" /> that contains event data.</param>
// Token: 0x02000337 RID: 823
// (Invoke) Token: 0x06001CB5 RID: 7349
public delegate void DownloadStringCompletedEventHandler(object sender, DownloadStringCompletedEventArgs e);
}
+58
View File
@@ -0,0 +1,58 @@
using System;
using System.Net.Sockets;
namespace System.Net
{
/// <summary>Identifies a network address. This is an abstract class.</summary>
// Token: 0x02000216 RID: 534
[Serializable]
public abstract class EndPoint
{
/// <summary>Gets the address family to which the endpoint belongs.</summary>
/// <returns>One of the <see cref="T:System.Net.Sockets.AddressFamily" /> values.</returns>
/// <exception cref="T:System.NotImplementedException">Any attempt is made to get or set the property when the property is not overridden in a descendant class. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x170005EF RID: 1519
// (get) Token: 0x06001228 RID: 4648 RVA: 0x00036594 File Offset: 0x00034794
public virtual global::System.Net.Sockets.AddressFamily AddressFamily
{
get
{
throw EndPoint.NotImplemented();
}
}
/// <summary>Creates an <see cref="T:System.Net.EndPoint" /> instance from a <see cref="T:System.Net.SocketAddress" /> instance.</summary>
/// <returns>A new <see cref="T:System.Net.EndPoint" /> instance that is initialized from the specified <see cref="T:System.Net.SocketAddress" /> instance.</returns>
/// <param name="socketAddress">The socket address that serves as the endpoint for a connection. </param>
/// <exception cref="T:System.NotImplementedException">Any attempt is made to access the method when the method is not overridden in a descendant class. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06001229 RID: 4649 RVA: 0x0003659C File Offset: 0x0003479C
public virtual EndPoint Create(SocketAddress address)
{
throw EndPoint.NotImplemented();
}
/// <summary>Serializes endpoint information into a <see cref="T:System.Net.SocketAddress" /> instance.</summary>
/// <returns>A <see cref="T:System.Net.SocketAddress" /> instance that contains the endpoint information.</returns>
/// <exception cref="T:System.NotImplementedException">Any attempt is made to access the method when the method is not overridden in a descendant class. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x0600122A RID: 4650 RVA: 0x000365A4 File Offset: 0x000347A4
public virtual SocketAddress Serialize()
{
throw EndPoint.NotImplemented();
}
// Token: 0x0600122B RID: 4651 RVA: 0x000365AC File Offset: 0x000347AC
private static Exception NotImplemented()
{
return new NotImplementedException();
}
}
}
+358
View File
@@ -0,0 +1,358 @@
using System;
using System.Collections;
using System.IO;
using System.Net.Sockets;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using Mono.Security.Authenticode;
namespace System.Net
{
// Token: 0x02000217 RID: 535
internal sealed class EndPointListener
{
// Token: 0x0600122C RID: 4652 RVA: 0x000365B4 File Offset: 0x000347B4
public EndPointListener(IPAddress addr, int port, bool secure)
{
if (secure)
{
this.secure = secure;
this.LoadCertificateAndKey(addr, port);
}
this.endpoint = new IPEndPoint(addr, port);
this.sock = new global::System.Net.Sockets.Socket(addr.AddressFamily, global::System.Net.Sockets.SocketType.Stream, global::System.Net.Sockets.ProtocolType.Tcp);
this.sock.Bind(this.endpoint);
this.sock.Listen(500);
this.sock.BeginAccept(new AsyncCallback(EndPointListener.OnAccept), this);
this.prefixes = new Hashtable();
}
// Token: 0x0600122D RID: 4653 RVA: 0x00036644 File Offset: 0x00034844
private void LoadCertificateAndKey(IPAddress addr, int port)
{
try
{
string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
string text = Path.Combine(folderPath, ".mono");
text = Path.Combine(text, "httplistener");
string text2 = Path.Combine(text, string.Format("{0}.cer", port));
string text3 = Path.Combine(text, string.Format("{0}.pvk", port));
this.cert = new global::System.Security.Cryptography.X509Certificates.X509Certificate2(text2);
this.key = PrivateKey.CreateFromFile(text3).RSA;
}
catch
{
}
}
// Token: 0x0600122E RID: 4654 RVA: 0x000366E4 File Offset: 0x000348E4
private static void OnAccept(IAsyncResult ares)
{
EndPointListener endPointListener = (EndPointListener)ares.AsyncState;
global::System.Net.Sockets.Socket socket = null;
try
{
socket = endPointListener.sock.EndAccept(ares);
}
catch
{
}
finally
{
try
{
endPointListener.sock.BeginAccept(new AsyncCallback(EndPointListener.OnAccept), endPointListener);
}
catch
{
if (socket != null)
{
try
{
socket.Close();
}
catch
{
}
socket = null;
}
}
}
if (socket == null)
{
return;
}
if (endPointListener.secure && (endPointListener.cert == null || endPointListener.key == null))
{
socket.Close();
return;
}
HttpConnection httpConnection = new HttpConnection(socket, endPointListener, endPointListener.secure, endPointListener.cert, endPointListener.key);
httpConnection.BeginReadRequest();
}
// Token: 0x0600122F RID: 4655 RVA: 0x00036808 File Offset: 0x00034A08
public bool BindContext(HttpListenerContext context)
{
HttpListenerRequest request = context.Request;
ListenerPrefix listenerPrefix;
HttpListener httpListener = this.SearchListener(request.UserHostName, request.Url, out listenerPrefix);
if (httpListener == null)
{
return false;
}
context.Listener = httpListener;
context.Connection.Prefix = listenerPrefix;
httpListener.RegisterContext(context);
return true;
}
// Token: 0x06001230 RID: 4656 RVA: 0x00036854 File Offset: 0x00034A54
public void UnbindContext(HttpListenerContext context)
{
if (context == null || context.Request == null)
{
return;
}
HttpListenerRequest request = context.Request;
ListenerPrefix listenerPrefix;
HttpListener httpListener = this.SearchListener(request.UserHostName, request.Url, out listenerPrefix);
if (httpListener != null)
{
httpListener.UnregisterContext(context);
}
}
// Token: 0x06001231 RID: 4657 RVA: 0x0003689C File Offset: 0x00034A9C
private HttpListener SearchListener(string host, global::System.Uri uri, out ListenerPrefix prefix)
{
prefix = null;
if (uri == null)
{
return null;
}
if (host != null)
{
int num = host.IndexOf(':');
if (num >= 0)
{
host = host.Substring(0, num);
}
}
string text = HttpUtility.UrlDecode(uri.AbsolutePath);
string text2 = ((text[text.Length - 1] != '/') ? (text + "/") : text);
HttpListener httpListener = null;
int num2 = -1;
Hashtable hashtable = this.prefixes;
lock (hashtable)
{
if (host != null && host != string.Empty)
{
foreach (object obj in this.prefixes.Keys)
{
ListenerPrefix listenerPrefix = (ListenerPrefix)obj;
string path = listenerPrefix.Path;
if (path.Length >= num2)
{
if (listenerPrefix.Host == host && (text.StartsWith(path) || text2.StartsWith(path)))
{
num2 = path.Length;
httpListener = (HttpListener)this.prefixes[listenerPrefix];
prefix = listenerPrefix;
}
}
}
if (num2 != -1)
{
return httpListener;
}
}
httpListener = this.MatchFromList(host, text, this.unhandled, out prefix);
if (httpListener != null)
{
return httpListener;
}
httpListener = this.MatchFromList(host, text, this.all, out prefix);
if (httpListener != null)
{
return httpListener;
}
}
return null;
}
// Token: 0x06001232 RID: 4658 RVA: 0x00036A7C File Offset: 0x00034C7C
private HttpListener MatchFromList(string host, string path, ArrayList list, out ListenerPrefix prefix)
{
prefix = null;
if (list == null)
{
return null;
}
HttpListener httpListener = null;
int num = -1;
foreach (object obj in list)
{
ListenerPrefix listenerPrefix = (ListenerPrefix)obj;
string path2 = listenerPrefix.Path;
if (path2.Length >= num)
{
if (path.StartsWith(path2))
{
num = path2.Length;
httpListener = listenerPrefix.Listener;
prefix = listenerPrefix;
}
}
}
return httpListener;
}
// Token: 0x06001233 RID: 4659 RVA: 0x00036B30 File Offset: 0x00034D30
private void AddSpecial(ArrayList coll, ListenerPrefix prefix)
{
if (coll == null)
{
return;
}
foreach (object obj in coll)
{
ListenerPrefix listenerPrefix = (ListenerPrefix)obj;
if (listenerPrefix.Path == prefix.Path)
{
throw new HttpListenerException(400, "Prefix already in use.");
}
}
coll.Add(prefix);
}
// Token: 0x06001234 RID: 4660 RVA: 0x00036BC8 File Offset: 0x00034DC8
private void RemoveSpecial(ArrayList coll, ListenerPrefix prefix)
{
if (coll == null)
{
return;
}
int count = coll.Count;
for (int i = 0; i < count; i++)
{
ListenerPrefix listenerPrefix = (ListenerPrefix)coll[i];
if (listenerPrefix.Path == prefix.Path)
{
coll.RemoveAt(i);
this.CheckIfRemove();
return;
}
}
}
// Token: 0x06001235 RID: 4661 RVA: 0x00036C28 File Offset: 0x00034E28
private void CheckIfRemove()
{
if (this.prefixes.Count > 0)
{
return;
}
if (this.unhandled != null && this.unhandled.Count > 0)
{
return;
}
if (this.all != null && this.all.Count > 0)
{
return;
}
EndPointManager.RemoveEndPoint(this, this.endpoint);
}
// Token: 0x06001236 RID: 4662 RVA: 0x00036C90 File Offset: 0x00034E90
public void Close()
{
this.sock.Close();
}
// Token: 0x06001237 RID: 4663 RVA: 0x00036CA0 File Offset: 0x00034EA0
public void AddPrefix(ListenerPrefix prefix, HttpListener listener)
{
Hashtable hashtable = this.prefixes;
lock (hashtable)
{
if (prefix.Host == "*")
{
if (this.unhandled == null)
{
this.unhandled = new ArrayList();
}
prefix.Listener = listener;
this.AddSpecial(this.unhandled, prefix);
}
else if (prefix.Host == "+")
{
if (this.all == null)
{
this.all = new ArrayList();
}
prefix.Listener = listener;
this.AddSpecial(this.all, prefix);
}
else if (this.prefixes.ContainsKey(prefix))
{
HttpListener httpListener = (HttpListener)this.prefixes[prefix];
if (httpListener != listener)
{
throw new HttpListenerException(400, "There's another listener for " + prefix);
}
}
else
{
this.prefixes[prefix] = listener;
}
}
}
// Token: 0x06001238 RID: 4664 RVA: 0x00036DBC File Offset: 0x00034FBC
public void RemovePrefix(ListenerPrefix prefix, HttpListener listener)
{
Hashtable hashtable = this.prefixes;
lock (hashtable)
{
if (prefix.Host == "*")
{
this.RemoveSpecial(this.unhandled, prefix);
}
else if (prefix.Host == "+")
{
this.RemoveSpecial(this.all, prefix);
}
else if (this.prefixes.ContainsKey(prefix))
{
this.prefixes.Remove(prefix);
this.CheckIfRemove();
}
}
}
// Token: 0x04000FB4 RID: 4020
private IPEndPoint endpoint;
// Token: 0x04000FB5 RID: 4021
private global::System.Net.Sockets.Socket sock;
// Token: 0x04000FB6 RID: 4022
private Hashtable prefixes;
// Token: 0x04000FB7 RID: 4023
private ArrayList unhandled;
// Token: 0x04000FB8 RID: 4024
private ArrayList all;
// Token: 0x04000FB9 RID: 4025
private global::System.Security.Cryptography.X509Certificates.X509Certificate2 cert;
// Token: 0x04000FBA RID: 4026
private AsymmetricAlgorithm key;
// Token: 0x04000FBB RID: 4027
private bool secure;
}
}
+151
View File
@@ -0,0 +1,151 @@
using System;
using System.Collections;
namespace System.Net
{
// Token: 0x02000218 RID: 536
internal sealed class EndPointManager
{
// Token: 0x06001239 RID: 4665 RVA: 0x00036E70 File Offset: 0x00035070
private EndPointManager()
{
}
// Token: 0x0600123B RID: 4667 RVA: 0x00036E84 File Offset: 0x00035084
public static void AddListener(HttpListener listener)
{
ArrayList arrayList = new ArrayList();
try
{
Hashtable hashtable = EndPointManager.ip_to_endpoints;
lock (hashtable)
{
foreach (string text in listener.Prefixes)
{
EndPointManager.AddPrefixInternal(text, listener);
arrayList.Add(text);
}
}
}
catch
{
foreach (object obj in arrayList)
{
string text2 = (string)obj;
EndPointManager.RemovePrefix(text2, listener);
}
throw;
}
}
// Token: 0x0600123C RID: 4668 RVA: 0x00036FAC File Offset: 0x000351AC
public static void AddPrefix(string prefix, HttpListener listener)
{
Hashtable hashtable = EndPointManager.ip_to_endpoints;
lock (hashtable)
{
EndPointManager.AddPrefixInternal(prefix, listener);
}
}
// Token: 0x0600123D RID: 4669 RVA: 0x00036FF4 File Offset: 0x000351F4
private static void AddPrefixInternal(string p, HttpListener listener)
{
ListenerPrefix listenerPrefix = new ListenerPrefix(p);
if (listenerPrefix.Path.IndexOf('%') != -1)
{
throw new HttpListenerException(400, "Invalid path.");
}
if (listenerPrefix.Path.IndexOf("//") != -1)
{
throw new HttpListenerException(400, "Invalid path.");
}
EndPointListener eplistener = EndPointManager.GetEPListener(IPAddress.Any, listenerPrefix.Port, listener, listenerPrefix.Secure);
eplistener.AddPrefix(listenerPrefix, listener);
}
// Token: 0x0600123E RID: 4670 RVA: 0x00037074 File Offset: 0x00035274
private static EndPointListener GetEPListener(IPAddress addr, int port, HttpListener listener, bool secure)
{
Hashtable hashtable;
if (EndPointManager.ip_to_endpoints.ContainsKey(addr))
{
hashtable = (Hashtable)EndPointManager.ip_to_endpoints[addr];
}
else
{
hashtable = new Hashtable();
EndPointManager.ip_to_endpoints[addr] = hashtable;
}
EndPointListener endPointListener;
if (hashtable.ContainsKey(port))
{
endPointListener = (EndPointListener)hashtable[port];
}
else
{
endPointListener = new EndPointListener(addr, port, secure);
hashtable[port] = endPointListener;
}
return endPointListener;
}
// Token: 0x0600123F RID: 4671 RVA: 0x000370FC File Offset: 0x000352FC
public static void RemoveEndPoint(EndPointListener epl, IPEndPoint ep)
{
Hashtable hashtable = EndPointManager.ip_to_endpoints;
lock (hashtable)
{
Hashtable hashtable2 = (Hashtable)EndPointManager.ip_to_endpoints[ep.Address];
hashtable2.Remove(ep.Port);
if (hashtable2.Count == 0)
{
EndPointManager.ip_to_endpoints.Remove(ep.Address);
}
epl.Close();
}
}
// Token: 0x06001240 RID: 4672 RVA: 0x00037188 File Offset: 0x00035388
public static void RemoveListener(HttpListener listener)
{
Hashtable hashtable = EndPointManager.ip_to_endpoints;
lock (hashtable)
{
foreach (string text in listener.Prefixes)
{
EndPointManager.RemovePrefixInternal(text, listener);
}
}
}
// Token: 0x06001241 RID: 4673 RVA: 0x0003721C File Offset: 0x0003541C
public static void RemovePrefix(string prefix, HttpListener listener)
{
Hashtable hashtable = EndPointManager.ip_to_endpoints;
lock (hashtable)
{
EndPointManager.RemovePrefixInternal(prefix, listener);
}
}
// Token: 0x06001242 RID: 4674 RVA: 0x00037264 File Offset: 0x00035464
private static void RemovePrefixInternal(string prefix, HttpListener listener)
{
ListenerPrefix listenerPrefix = new ListenerPrefix(prefix);
if (listenerPrefix.Path.IndexOf('%') != -1)
{
return;
}
if (listenerPrefix.Path.IndexOf("//") != -1)
{
return;
}
EndPointListener eplistener = EndPointManager.GetEPListener(IPAddress.Any, listenerPrefix.Port, listener, listenerPrefix.Secure);
eplistener.RemovePrefix(listenerPrefix, listener);
}
// Token: 0x04000FBC RID: 4028
private static Hashtable ip_to_endpoints = new Hashtable();
}
}
+536
View File
@@ -0,0 +1,536 @@
using System;
using System.IO;
using System.Runtime.Remoting.Messaging;
using System.Runtime.Serialization;
using System.Threading;
namespace System.Net
{
/// <summary>Provides a file system implementation of the <see cref="T:System.Net.WebRequest" /> class.</summary>
// Token: 0x02000219 RID: 537
[Serializable]
public class FileWebRequest : WebRequest, ISerializable
{
// Token: 0x06001243 RID: 4675 RVA: 0x000372C4 File Offset: 0x000354C4
internal FileWebRequest(global::System.Uri uri)
{
this.uri = uri;
this.webHeaders = new WebHeaderCollection();
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.FileWebRequest" /> class from the specified instances of the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> and <see cref="T:System.Runtime.Serialization.StreamingContext" /> classes.</summary>
/// <param name="serializationInfo">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object that contains the information that is required to serialize the new <see cref="T:System.Net.FileWebRequest" /> object. </param>
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> object that contains the source of the serialized stream that is associated with the new <see cref="T:System.Net.FileWebRequest" /> object. </param>
// Token: 0x06001244 RID: 4676 RVA: 0x000372FC File Offset: 0x000354FC
[Obsolete("Serialization is obsoleted for this type", false)]
protected FileWebRequest(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
this.webHeaders = (WebHeaderCollection)serializationInfo.GetValue("headers", typeof(WebHeaderCollection));
this.proxy = (IWebProxy)serializationInfo.GetValue("proxy", typeof(IWebProxy));
this.uri = (global::System.Uri)serializationInfo.GetValue("uri", typeof(global::System.Uri));
this.connectionGroup = serializationInfo.GetString("connectionGroupName");
this.method = serializationInfo.GetString("method");
this.contentLength = serializationInfo.GetInt64("contentLength");
this.timeout = serializationInfo.GetInt32("timeout");
this.fileAccess = (FileAccess)((int)serializationInfo.GetValue("fileAccess", typeof(FileAccess)));
this.preAuthenticate = serializationInfo.GetBoolean("preauthenticate");
}
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object with the required data to serialize the <see cref="T:System.Net.FileWebRequest" />.</summary>
/// <param name="serializationInfo">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized data for the <see cref="T:System.Net.FileWebRequest" />. </param>
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains the destination of the serialized stream that is associated with the new <see cref="T:System.Net.FileWebRequest" />. </param>
// Token: 0x06001245 RID: 4677 RVA: 0x00037404 File Offset: 0x00035604
void ISerializable.GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
this.GetObjectData(serializationInfo, streamingContext);
}
/// <summary>Gets or sets the name of the connection group for the request. This property is reserved for future use.</summary>
/// <returns>The name of the connection group for the request.</returns>
// Token: 0x170005F0 RID: 1520
// (get) Token: 0x06001246 RID: 4678 RVA: 0x00037410 File Offset: 0x00035610
// (set) Token: 0x06001247 RID: 4679 RVA: 0x00037418 File Offset: 0x00035618
public override string ConnectionGroupName
{
get
{
return this.connectionGroup;
}
set
{
this.connectionGroup = value;
}
}
/// <summary>Gets or sets the content length of the data being sent.</summary>
/// <returns>The number of bytes of request data being sent.</returns>
/// <exception cref="T:System.ArgumentException">
/// <see cref="P:System.Net.FileWebRequest.ContentLength" /> is less than 0. </exception>
// Token: 0x170005F1 RID: 1521
// (get) Token: 0x06001248 RID: 4680 RVA: 0x00037424 File Offset: 0x00035624
// (set) Token: 0x06001249 RID: 4681 RVA: 0x0003742C File Offset: 0x0003562C
public override long ContentLength
{
get
{
return this.contentLength;
}
set
{
if (value < 0L)
{
throw new ArgumentException("The Content-Length value must be greater than or equal to zero.", "value");
}
this.contentLength = value;
}
}
/// <summary>Gets or sets the content type of the data being sent. This property is reserved for future use.</summary>
/// <returns>The content type of the data being sent.</returns>
// Token: 0x170005F2 RID: 1522
// (get) Token: 0x0600124A RID: 4682 RVA: 0x00037450 File Offset: 0x00035650
// (set) Token: 0x0600124B RID: 4683 RVA: 0x00037464 File Offset: 0x00035664
public override string ContentType
{
get
{
return this.webHeaders["Content-Type"];
}
set
{
this.webHeaders["Content-Type"] = value;
}
}
/// <summary>Gets or sets the credentials that are associated with this request. This property is reserved for future use.</summary>
/// <returns>An <see cref="T:System.Net.ICredentials" /> that contains the authentication credentials that are associated with this request. The default is null.</returns>
// Token: 0x170005F3 RID: 1523
// (get) Token: 0x0600124C RID: 4684 RVA: 0x00037478 File Offset: 0x00035678
// (set) Token: 0x0600124D RID: 4685 RVA: 0x00037480 File Offset: 0x00035680
public override ICredentials Credentials
{
get
{
return this.credentials;
}
set
{
this.credentials = value;
}
}
/// <summary>Gets a collection of the name/value pairs that are associated with the request. This property is reserved for future use.</summary>
/// <returns>A <see cref="T:System.Net.WebHeaderCollection" /> that contains header name/value pairs associated with this request.</returns>
// Token: 0x170005F4 RID: 1524
// (get) Token: 0x0600124E RID: 4686 RVA: 0x0003748C File Offset: 0x0003568C
public override WebHeaderCollection Headers
{
get
{
return this.webHeaders;
}
}
/// <summary>Gets or sets the protocol method used for the request. This property is reserved for future use.</summary>
/// <returns>The protocol method to use in this request.</returns>
// Token: 0x170005F5 RID: 1525
// (get) Token: 0x0600124F RID: 4687 RVA: 0x00037494 File Offset: 0x00035694
// (set) Token: 0x06001250 RID: 4688 RVA: 0x0003749C File Offset: 0x0003569C
public override string Method
{
get
{
return this.method;
}
set
{
if (value == null || value.Length == 0)
{
throw new ArgumentException("Cannot set null or blank methods on request.", "value");
}
this.method = value;
}
}
/// <summary>Gets or sets a value that indicates whether to preauthenticate a request. This property is reserved for future use.</summary>
/// <returns>true to preauthenticate; otherwise, false.</returns>
// Token: 0x170005F6 RID: 1526
// (get) Token: 0x06001251 RID: 4689 RVA: 0x000374D4 File Offset: 0x000356D4
// (set) Token: 0x06001252 RID: 4690 RVA: 0x000374DC File Offset: 0x000356DC
public override bool PreAuthenticate
{
get
{
return this.preAuthenticate;
}
set
{
this.preAuthenticate = value;
}
}
/// <summary>Gets or sets the network proxy to use for this request. This property is reserved for future use.</summary>
/// <returns>An <see cref="T:System.Net.IWebProxy" /> that indicates the network proxy to use for this request.</returns>
// Token: 0x170005F7 RID: 1527
// (get) Token: 0x06001253 RID: 4691 RVA: 0x000374E8 File Offset: 0x000356E8
// (set) Token: 0x06001254 RID: 4692 RVA: 0x000374F0 File Offset: 0x000356F0
public override IWebProxy Proxy
{
get
{
return this.proxy;
}
set
{
this.proxy = value;
}
}
/// <summary>Gets the Uniform Resource Identifier (URI) of the request.</summary>
/// <returns>A <see cref="T:System.Uri" /> that contains the URI of the request.</returns>
// Token: 0x170005F8 RID: 1528
// (get) Token: 0x06001255 RID: 4693 RVA: 0x000374FC File Offset: 0x000356FC
public override global::System.Uri RequestUri
{
get
{
return this.uri;
}
}
/// <summary>Gets or sets the length of time until the request times out.</summary>
/// <returns>The time, in milliseconds, until the request times out, or the value <see cref="F:System.Threading.Timeout.Infinite" /> to indicate that the request does not time out.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value specified is less than or equal to zero and is not <see cref="F:System.Threading.Timeout.Infinite" />.</exception>
// Token: 0x170005F9 RID: 1529
// (get) Token: 0x06001256 RID: 4694 RVA: 0x00037504 File Offset: 0x00035704
// (set) Token: 0x06001257 RID: 4695 RVA: 0x0003750C File Offset: 0x0003570C
public override int Timeout
{
get
{
return this.timeout;
}
set
{
if (value < -1)
{
throw new ArgumentOutOfRangeException("Timeout can be only set to 'System.Threading.Timeout.Infinite' or a value >= 0.");
}
this.timeout = value;
}
}
/// <summary>Always throws a <see cref="T:System.NotSupportedException" />.</summary>
/// <returns>Always throws a <see cref="T:System.NotSupportedException" />.</returns>
/// <exception cref="T:System.NotSupportedException">Default credentials are not supported for file Uniform Resource Identifiers (URIs).</exception>
// Token: 0x170005FA RID: 1530
// (get) Token: 0x06001258 RID: 4696 RVA: 0x00037528 File Offset: 0x00035728
// (set) Token: 0x06001259 RID: 4697 RVA: 0x00037530 File Offset: 0x00035730
public override bool UseDefaultCredentials
{
get
{
throw new NotSupportedException();
}
set
{
throw new NotSupportedException();
}
}
// Token: 0x0600125A RID: 4698 RVA: 0x00037538 File Offset: 0x00035738
private static Exception GetMustImplement()
{
return new NotImplementedException();
}
/// <summary>Cancels a request to an Internet resource.</summary>
// Token: 0x0600125B RID: 4699 RVA: 0x00037540 File Offset: 0x00035740
[global::System.MonoTODO]
public override void Abort()
{
throw FileWebRequest.GetMustImplement();
}
/// <summary>Begins an asynchronous request for a <see cref="T:System.IO.Stream" /> object to use to write data.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> that references the asynchronous request.</returns>
/// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate. </param>
/// <param name="state">An object that contains state information for this request. </param>
/// <exception cref="T:System.Net.ProtocolViolationException">The <see cref="P:System.Net.FileWebRequest.Method" /> property is GET and the application writes to the stream. </exception>
/// <exception cref="T:System.InvalidOperationException">The stream is being used by a previous call to <see cref="M:System.Net.FileWebRequest.BeginGetRequestStream(System.AsyncCallback,System.Object)" />. </exception>
/// <exception cref="T:System.ApplicationException">No write stream is available. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x0600125C RID: 4700 RVA: 0x00037548 File Offset: 0x00035748
public override IAsyncResult BeginGetRequestStream(AsyncCallback callback, object state)
{
if (string.Compare("GET", this.method, true) == 0 || string.Compare("HEAD", this.method, true) == 0 || string.Compare("CONNECT", this.method, true) == 0)
{
throw new ProtocolViolationException("Cannot send a content-body with this verb-type.");
}
lock (this)
{
if (this.asyncResponding || this.webResponse != null)
{
throw new InvalidOperationException("This operation cannot be performed after the request has been submitted.");
}
if (this.requesting)
{
throw new InvalidOperationException("Cannot re-call start of asynchronous method while a previous call is still in progress.");
}
this.requesting = true;
}
FileWebRequest.GetRequestStreamCallback getRequestStreamCallback = new FileWebRequest.GetRequestStreamCallback(this.GetRequestStreamInternal);
return getRequestStreamCallback.BeginInvoke(callback, state);
}
/// <summary>Ends an asynchronous request for a <see cref="T:System.IO.Stream" /> instance that the application uses to write data.</summary>
/// <returns>A <see cref="T:System.IO.Stream" /> object that the application uses to write data.</returns>
/// <param name="asyncResult">An <see cref="T:System.IAsyncResult" /> that references the pending request for a stream. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is null. </exception>
// Token: 0x0600125D RID: 4701 RVA: 0x00037628 File Offset: 0x00035828
public override Stream EndGetRequestStream(IAsyncResult asyncResult)
{
if (asyncResult == null)
{
throw new ArgumentNullException("asyncResult");
}
if (!asyncResult.IsCompleted)
{
asyncResult.AsyncWaitHandle.WaitOne();
}
AsyncResult asyncResult2 = (AsyncResult)asyncResult;
FileWebRequest.GetRequestStreamCallback getRequestStreamCallback = (FileWebRequest.GetRequestStreamCallback)asyncResult2.AsyncDelegate;
return getRequestStreamCallback.EndInvoke(asyncResult);
}
/// <summary>Returns a <see cref="T:System.IO.Stream" /> object for writing data to the file system resource.</summary>
/// <returns>A <see cref="T:System.IO.Stream" /> for writing data to the file system resource.</returns>
/// <exception cref="T:System.Net.WebException">The request times out. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x0600125E RID: 4702 RVA: 0x00037678 File Offset: 0x00035878
public override Stream GetRequestStream()
{
IAsyncResult asyncResult = this.BeginGetRequestStream(null, null);
if (!asyncResult.AsyncWaitHandle.WaitOne(this.timeout, false))
{
throw new WebException("The request timed out", WebExceptionStatus.Timeout);
}
return this.EndGetRequestStream(asyncResult);
}
// Token: 0x0600125F RID: 4703 RVA: 0x000376BC File Offset: 0x000358BC
internal Stream GetRequestStreamInternal()
{
this.requestStream = new FileWebRequest.FileWebStream(this, FileMode.Create, FileAccess.Write, FileShare.Read);
return this.requestStream;
}
/// <summary>Begins an asynchronous request for a file system resource.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> that references the asynchronous request.</returns>
/// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate. </param>
/// <param name="state">An object that contains state information for this request. </param>
/// <exception cref="T:System.InvalidOperationException">The stream is already in use by a previous call to <see cref="M:System.Net.FileWebRequest.BeginGetResponse(System.AsyncCallback,System.Object)" />. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06001260 RID: 4704 RVA: 0x000376D4 File Offset: 0x000358D4
public override IAsyncResult BeginGetResponse(AsyncCallback callback, object state)
{
lock (this)
{
if (this.asyncResponding)
{
throw new InvalidOperationException("Cannot re-call start of asynchronous method while a previous call is still in progress.");
}
this.asyncResponding = true;
}
FileWebRequest.GetResponseCallback getResponseCallback = new FileWebRequest.GetResponseCallback(this.GetResponseInternal);
return getResponseCallback.BeginInvoke(callback, state);
}
/// <summary>Ends an asynchronous request for a file system resource.</summary>
/// <returns>A <see cref="T:System.Net.WebResponse" /> that contains the response from the file system resource.</returns>
/// <param name="asyncResult">An <see cref="T:System.IAsyncResult" /> that references the pending request for a response. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is null. </exception>
// Token: 0x06001261 RID: 4705 RVA: 0x00037744 File Offset: 0x00035944
public override WebResponse EndGetResponse(IAsyncResult asyncResult)
{
if (asyncResult == null)
{
throw new ArgumentNullException("asyncResult");
}
if (!asyncResult.IsCompleted)
{
asyncResult.AsyncWaitHandle.WaitOne();
}
AsyncResult asyncResult2 = (AsyncResult)asyncResult;
FileWebRequest.GetResponseCallback getResponseCallback = (FileWebRequest.GetResponseCallback)asyncResult2.AsyncDelegate;
WebResponse webResponse = getResponseCallback.EndInvoke(asyncResult);
this.asyncResponding = false;
return webResponse;
}
/// <summary>Returns a response to a file system request.</summary>
/// <returns>A <see cref="T:System.Net.WebResponse" /> that contains the response from the file system resource.</returns>
/// <exception cref="T:System.Net.WebException">The request timed out. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06001262 RID: 4706 RVA: 0x0003779C File Offset: 0x0003599C
public override WebResponse GetResponse()
{
IAsyncResult asyncResult = this.BeginGetResponse(null, null);
if (!asyncResult.AsyncWaitHandle.WaitOne(this.timeout, false))
{
throw new WebException("The request timed out", WebExceptionStatus.Timeout);
}
return this.EndGetResponse(asyncResult);
}
// Token: 0x06001263 RID: 4707 RVA: 0x000377E0 File Offset: 0x000359E0
private WebResponse GetResponseInternal()
{
if (this.webResponse != null)
{
return this.webResponse;
}
lock (this)
{
if (this.requesting)
{
this.requestEndEvent = new AutoResetEvent(false);
}
}
if (this.requestEndEvent != null)
{
this.requestEndEvent.WaitOne();
}
FileStream fileStream = null;
try
{
fileStream = new FileWebRequest.FileWebStream(this, FileMode.Open, FileAccess.Read, FileShare.Read);
}
catch (Exception ex)
{
throw new WebException(ex.Message, ex);
}
this.webResponse = new FileWebResponse(this.uri, fileStream);
return this.webResponse;
}
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with the data needed to serialize the target object.</summary>
/// <param name="serializationInfo">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> to populate with data. </param>
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> that specifies the destination for this serialization. </param>
// Token: 0x06001264 RID: 4708 RVA: 0x000378B4 File Offset: 0x00035AB4
protected override void GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
serializationInfo.AddValue("headers", this.webHeaders, typeof(WebHeaderCollection));
serializationInfo.AddValue("proxy", this.proxy, typeof(IWebProxy));
serializationInfo.AddValue("uri", this.uri, typeof(global::System.Uri));
serializationInfo.AddValue("connectionGroupName", this.connectionGroup);
serializationInfo.AddValue("method", this.method);
serializationInfo.AddValue("contentLength", this.contentLength);
serializationInfo.AddValue("timeout", this.timeout);
serializationInfo.AddValue("fileAccess", this.fileAccess);
serializationInfo.AddValue("preauthenticate", false);
}
// Token: 0x06001265 RID: 4709 RVA: 0x0003797C File Offset: 0x00035B7C
internal void Close()
{
lock (this)
{
this.requesting = false;
if (this.requestEndEvent != null)
{
this.requestEndEvent.Set();
}
}
}
// Token: 0x04000FBD RID: 4029
private global::System.Uri uri;
// Token: 0x04000FBE RID: 4030
private WebHeaderCollection webHeaders;
// Token: 0x04000FBF RID: 4031
private ICredentials credentials;
// Token: 0x04000FC0 RID: 4032
private string connectionGroup;
// Token: 0x04000FC1 RID: 4033
private long contentLength;
// Token: 0x04000FC2 RID: 4034
private FileAccess fileAccess = FileAccess.Read;
// Token: 0x04000FC3 RID: 4035
private string method = "GET";
// Token: 0x04000FC4 RID: 4036
private IWebProxy proxy;
// Token: 0x04000FC5 RID: 4037
private bool preAuthenticate;
// Token: 0x04000FC6 RID: 4038
private int timeout = 100000;
// Token: 0x04000FC7 RID: 4039
private Stream requestStream;
// Token: 0x04000FC8 RID: 4040
private FileWebResponse webResponse;
// Token: 0x04000FC9 RID: 4041
private AutoResetEvent requestEndEvent;
// Token: 0x04000FCA RID: 4042
private bool requesting;
// Token: 0x04000FCB RID: 4043
private bool asyncResponding;
// Token: 0x0200021A RID: 538
internal class FileWebStream : FileStream
{
// Token: 0x06001266 RID: 4710 RVA: 0x000379D8 File Offset: 0x00035BD8
internal FileWebStream(FileWebRequest webRequest, FileMode mode, FileAccess access, FileShare share)
: base(webRequest.RequestUri.LocalPath, mode, access, share)
{
this.webRequest = webRequest;
}
// Token: 0x06001267 RID: 4711 RVA: 0x00037A04 File Offset: 0x00035C04
public override void Close()
{
base.Close();
FileWebRequest fileWebRequest = this.webRequest;
this.webRequest = null;
if (fileWebRequest != null)
{
fileWebRequest.Close();
}
}
// Token: 0x04000FCC RID: 4044
private FileWebRequest webRequest;
}
// Token: 0x02000315 RID: 789
// (Invoke) Token: 0x06001C2D RID: 7213
private delegate Stream GetRequestStreamCallback();
// Token: 0x02000316 RID: 790
// (Invoke) Token: 0x06001C31 RID: 7217
private delegate WebResponse GetResponseCallback();
}
}
+19
View File
@@ -0,0 +1,19 @@
using System;
namespace System.Net
{
// Token: 0x0200021B RID: 539
internal class FileWebRequestCreator : IWebRequestCreate
{
// Token: 0x06001268 RID: 4712 RVA: 0x00037A34 File Offset: 0x00035C34
internal FileWebRequestCreator()
{
}
// Token: 0x06001269 RID: 4713 RVA: 0x00037A3C File Offset: 0x00035C3C
public WebRequest Create(global::System.Uri uri)
{
return new FileWebRequest(uri);
}
}
}
+191
View File
@@ -0,0 +1,191 @@
using System;
using System.IO;
using System.Runtime.Serialization;
namespace System.Net
{
/// <summary>Provides a file system implementation of the <see cref="T:System.Net.WebResponse" /> class.</summary>
// Token: 0x0200021C RID: 540
[Serializable]
public class FileWebResponse : WebResponse, IDisposable, ISerializable
{
// Token: 0x0600126A RID: 4714 RVA: 0x00037A44 File Offset: 0x00035C44
internal FileWebResponse(global::System.Uri responseUri, FileStream fileStream)
{
try
{
this.responseUri = responseUri;
this.fileStream = fileStream;
this.contentLength = fileStream.Length;
this.webHeaders = new WebHeaderCollection();
this.webHeaders.Add("Content-Length", Convert.ToString(this.contentLength));
this.webHeaders.Add("Content-Type", "application/octet-stream");
}
catch (Exception ex)
{
throw new WebException(ex.Message, ex);
}
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.FileWebResponse" /> class from the specified instances of the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> and <see cref="T:System.Runtime.Serialization.StreamingContext" /> classes.</summary>
/// <param name="serializationInfo">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> instance that contains the information required to serialize the new <see cref="T:System.Net.FileWebResponse" /> instance. </param>
/// <param name="streamingContext">An instance of the <see cref="T:System.Runtime.Serialization.StreamingContext" /> class that contains the source of the serialized stream associated with the new <see cref="T:System.Net.FileWebResponse" /> instance. </param>
// Token: 0x0600126B RID: 4715 RVA: 0x00037AE0 File Offset: 0x00035CE0
[Obsolete("Serialization is obsoleted for this type", false)]
protected FileWebResponse(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
this.responseUri = (global::System.Uri)serializationInfo.GetValue("responseUri", typeof(global::System.Uri));
this.contentLength = serializationInfo.GetInt64("contentLength");
this.webHeaders = (WebHeaderCollection)serializationInfo.GetValue("webHeaders", typeof(WebHeaderCollection));
}
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> instance with the data needed to serialize the <see cref="T:System.Net.FileWebResponse" />.</summary>
/// <param name="serializationInfo">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> , which will hold the serialized data for the <see cref="T:System.Net.FileWebResponse" />. </param>
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> containing the destination of the serialized stream associated with the new <see cref="T:System.Net.FileWebResponse" />. </param>
// Token: 0x0600126C RID: 4716 RVA: 0x00037B48 File Offset: 0x00035D48
void ISerializable.GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
this.GetObjectData(serializationInfo, streamingContext);
}
/// <summary>Releases all resources used by the <see cref="T:System.Net.FileWebResponse" />.</summary>
// Token: 0x0600126D RID: 4717 RVA: 0x00037B54 File Offset: 0x00035D54
void IDisposable.Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>Gets the length of the content in the file system resource.</summary>
/// <returns>The number of bytes returned from the file system resource.</returns>
// Token: 0x170005FB RID: 1531
// (get) Token: 0x0600126E RID: 4718 RVA: 0x00037B64 File Offset: 0x00035D64
public override long ContentLength
{
get
{
this.CheckDisposed();
return this.contentLength;
}
}
/// <summary>Gets the content type of the file system resource.</summary>
/// <returns>The value "binary/octet-stream".</returns>
// Token: 0x170005FC RID: 1532
// (get) Token: 0x0600126F RID: 4719 RVA: 0x00037B74 File Offset: 0x00035D74
public override string ContentType
{
get
{
this.CheckDisposed();
return "application/octet-stream";
}
}
/// <summary>Gets a collection of header name/value pairs associated with the response.</summary>
/// <returns>A <see cref="T:System.Net.WebHeaderCollection" /> that contains the header name/value pairs associated with the response.</returns>
// Token: 0x170005FD RID: 1533
// (get) Token: 0x06001270 RID: 4720 RVA: 0x00037B84 File Offset: 0x00035D84
public override WebHeaderCollection Headers
{
get
{
this.CheckDisposed();
return this.webHeaders;
}
}
/// <summary>Gets the URI of the file system resource that provided the response.</summary>
/// <returns>A <see cref="T:System.Uri" /> that contains the URI of the file system resource that provided the response.</returns>
// Token: 0x170005FE RID: 1534
// (get) Token: 0x06001271 RID: 4721 RVA: 0x00037B94 File Offset: 0x00035D94
public override global::System.Uri ResponseUri
{
get
{
this.CheckDisposed();
return this.responseUri;
}
}
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with the data needed to serialize the target object.</summary>
/// <param name="serializationInfo">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> to populate with data. </param>
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> that specifies the destination for this serialization.</param>
// Token: 0x06001272 RID: 4722 RVA: 0x00037BA4 File Offset: 0x00035DA4
protected override void GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
serializationInfo.AddValue("responseUri", this.responseUri, typeof(global::System.Uri));
serializationInfo.AddValue("contentLength", this.contentLength);
serializationInfo.AddValue("webHeaders", this.webHeaders, typeof(WebHeaderCollection));
}
/// <summary>Returns the data stream from the file system resource.</summary>
/// <returns>A <see cref="T:System.IO.Stream" /> for reading data from the file system resource.</returns>
// Token: 0x06001273 RID: 4723 RVA: 0x00037BFC File Offset: 0x00035DFC
public override Stream GetResponseStream()
{
this.CheckDisposed();
return this.fileStream;
}
// Token: 0x06001274 RID: 4724 RVA: 0x00037C0C File Offset: 0x00035E0C
~FileWebResponse()
{
this.Dispose(false);
}
/// <summary>Closes the response stream.</summary>
// Token: 0x06001275 RID: 4725 RVA: 0x00037C48 File Offset: 0x00035E48
public override void Close()
{
((IDisposable)this).Dispose();
}
/// <summary>Releases the unmanaged resources used by the <see cref="T:System.Net.FileWebResponse" /> and optionally releases the managed resources.</summary>
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources. </param>
// Token: 0x06001276 RID: 4726 RVA: 0x00037C50 File Offset: 0x00035E50
private void Dispose(bool disposing)
{
if (this.disposed)
{
return;
}
this.disposed = true;
if (disposing)
{
this.responseUri = null;
this.webHeaders = null;
}
FileStream fileStream = this.fileStream;
this.fileStream = null;
if (fileStream != null)
{
fileStream.Close();
}
}
// Token: 0x06001277 RID: 4727 RVA: 0x00037CA0 File Offset: 0x00035EA0
private void CheckDisposed()
{
if (this.disposed)
{
throw new ObjectDisposedException(base.GetType().FullName);
}
}
// Token: 0x04000FCD RID: 4045
private global::System.Uri responseUri;
// Token: 0x04000FCE RID: 4046
private FileStream fileStream;
// Token: 0x04000FCF RID: 4047
private long contentLength;
// Token: 0x04000FD0 RID: 4048
private WebHeaderCollection webHeaders;
// Token: 0x04000FD1 RID: 4049
private bool disposed;
}
}
+227
View File
@@ -0,0 +1,227 @@
using System;
using System.IO;
using System.Threading;
namespace System.Net
{
// Token: 0x0200021D RID: 541
internal class FtpAsyncResult : IAsyncResult
{
// Token: 0x06001278 RID: 4728 RVA: 0x00037CC0 File Offset: 0x00035EC0
public FtpAsyncResult(AsyncCallback callback, object state)
{
this.callback = callback;
this.state = state;
}
// Token: 0x170005FF RID: 1535
// (get) Token: 0x06001279 RID: 4729 RVA: 0x00037CE4 File Offset: 0x00035EE4
public object AsyncState
{
get
{
return this.state;
}
}
// Token: 0x17000600 RID: 1536
// (get) Token: 0x0600127A RID: 4730 RVA: 0x00037CEC File Offset: 0x00035EEC
public WaitHandle AsyncWaitHandle
{
get
{
object obj = this.locker;
lock (obj)
{
if (this.waitHandle == null)
{
this.waitHandle = new ManualResetEvent(false);
}
}
return this.waitHandle;
}
}
// Token: 0x17000601 RID: 1537
// (get) Token: 0x0600127B RID: 4731 RVA: 0x00037D4C File Offset: 0x00035F4C
public bool CompletedSynchronously
{
get
{
return this.synch;
}
}
// Token: 0x17000602 RID: 1538
// (get) Token: 0x0600127C RID: 4732 RVA: 0x00037D54 File Offset: 0x00035F54
public bool IsCompleted
{
get
{
object obj = this.locker;
bool flag;
lock (obj)
{
flag = this.completed;
}
return flag;
}
}
// Token: 0x17000603 RID: 1539
// (get) Token: 0x0600127D RID: 4733 RVA: 0x00037DA4 File Offset: 0x00035FA4
internal bool GotException
{
get
{
return this.exception != null;
}
}
// Token: 0x17000604 RID: 1540
// (get) Token: 0x0600127E RID: 4734 RVA: 0x00037DB4 File Offset: 0x00035FB4
internal Exception Exception
{
get
{
return this.exception;
}
}
// Token: 0x17000605 RID: 1541
// (get) Token: 0x0600127F RID: 4735 RVA: 0x00037DBC File Offset: 0x00035FBC
// (set) Token: 0x06001280 RID: 4736 RVA: 0x00037DC4 File Offset: 0x00035FC4
internal FtpWebResponse Response
{
get
{
return this.response;
}
set
{
this.response = value;
}
}
// Token: 0x17000606 RID: 1542
// (get) Token: 0x06001281 RID: 4737 RVA: 0x00037DD0 File Offset: 0x00035FD0
// (set) Token: 0x06001282 RID: 4738 RVA: 0x00037DD8 File Offset: 0x00035FD8
internal Stream Stream
{
get
{
return this.stream;
}
set
{
this.stream = value;
}
}
// Token: 0x06001283 RID: 4739 RVA: 0x00037DE4 File Offset: 0x00035FE4
internal void WaitUntilComplete()
{
if (this.IsCompleted)
{
return;
}
this.AsyncWaitHandle.WaitOne();
}
// Token: 0x06001284 RID: 4740 RVA: 0x00037E00 File Offset: 0x00036000
internal bool WaitUntilComplete(int timeout, bool exitContext)
{
return this.IsCompleted || this.AsyncWaitHandle.WaitOne(timeout, exitContext);
}
// Token: 0x06001285 RID: 4741 RVA: 0x00037E28 File Offset: 0x00036028
internal void SetCompleted(bool synch, Exception exc, FtpWebResponse response)
{
this.synch = synch;
this.exception = exc;
this.response = response;
object obj = this.locker;
lock (obj)
{
this.completed = true;
if (this.waitHandle != null)
{
this.waitHandle.Set();
}
}
this.DoCallback();
}
// Token: 0x06001286 RID: 4742 RVA: 0x00037EA4 File Offset: 0x000360A4
internal void SetCompleted(bool synch, FtpWebResponse response)
{
this.SetCompleted(synch, null, response);
}
// Token: 0x06001287 RID: 4743 RVA: 0x00037EB0 File Offset: 0x000360B0
internal void SetCompleted(bool synch, Exception exc)
{
this.SetCompleted(synch, exc, null);
}
// Token: 0x06001288 RID: 4744 RVA: 0x00037EBC File Offset: 0x000360BC
internal void DoCallback()
{
if (this.callback != null)
{
try
{
this.callback(this);
}
catch (Exception)
{
}
}
}
// Token: 0x06001289 RID: 4745 RVA: 0x00037F08 File Offset: 0x00036108
internal void Reset()
{
this.exception = null;
this.synch = false;
this.response = null;
this.state = null;
object obj = this.locker;
lock (obj)
{
this.completed = false;
if (this.waitHandle != null)
{
this.waitHandle.Reset();
}
}
}
// Token: 0x04000FD2 RID: 4050
private FtpWebResponse response;
// Token: 0x04000FD3 RID: 4051
private ManualResetEvent waitHandle;
// Token: 0x04000FD4 RID: 4052
private Exception exception;
// Token: 0x04000FD5 RID: 4053
private AsyncCallback callback;
// Token: 0x04000FD6 RID: 4054
private Stream stream;
// Token: 0x04000FD7 RID: 4055
private object state;
// Token: 0x04000FD8 RID: 4056
private bool completed;
// Token: 0x04000FD9 RID: 4057
private bool synch;
// Token: 0x04000FDA RID: 4058
private object locker = new object();
}
}
+322
View File
@@ -0,0 +1,322 @@
using System;
using System.IO;
using System.Runtime.Remoting.Messaging;
namespace System.Net
{
// Token: 0x0200021E RID: 542
internal class FtpDataStream : Stream, IDisposable
{
// Token: 0x0600128A RID: 4746 RVA: 0x00037F84 File Offset: 0x00036184
internal FtpDataStream(FtpWebRequest request, Stream stream, bool isRead)
{
if (request == null)
{
throw new ArgumentNullException("request");
}
this.request = request;
this.networkStream = stream;
this.isRead = isRead;
}
// Token: 0x0600128B RID: 4747 RVA: 0x00037FC0 File Offset: 0x000361C0
void IDisposable.Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
// Token: 0x17000607 RID: 1543
// (get) Token: 0x0600128C RID: 4748 RVA: 0x00037FD0 File Offset: 0x000361D0
public override bool CanRead
{
get
{
return this.isRead;
}
}
// Token: 0x17000608 RID: 1544
// (get) Token: 0x0600128D RID: 4749 RVA: 0x00037FD8 File Offset: 0x000361D8
public override bool CanWrite
{
get
{
return !this.isRead;
}
}
// Token: 0x17000609 RID: 1545
// (get) Token: 0x0600128E RID: 4750 RVA: 0x00037FE4 File Offset: 0x000361E4
public override bool CanSeek
{
get
{
return false;
}
}
// Token: 0x1700060A RID: 1546
// (get) Token: 0x0600128F RID: 4751 RVA: 0x00037FE8 File Offset: 0x000361E8
public override long Length
{
get
{
throw new NotSupportedException();
}
}
// Token: 0x1700060B RID: 1547
// (get) Token: 0x06001290 RID: 4752 RVA: 0x00037FF0 File Offset: 0x000361F0
// (set) Token: 0x06001291 RID: 4753 RVA: 0x00037FF8 File Offset: 0x000361F8
public override long Position
{
get
{
throw new NotSupportedException();
}
set
{
throw new NotSupportedException();
}
}
// Token: 0x1700060C RID: 1548
// (get) Token: 0x06001292 RID: 4754 RVA: 0x00038000 File Offset: 0x00036200
internal Stream NetworkStream
{
get
{
this.CheckDisposed();
return this.networkStream;
}
}
// Token: 0x06001293 RID: 4755 RVA: 0x00038010 File Offset: 0x00036210
public override void Close()
{
this.Dispose(true);
}
// Token: 0x06001294 RID: 4756 RVA: 0x0003801C File Offset: 0x0003621C
public override void Flush()
{
}
// Token: 0x06001295 RID: 4757 RVA: 0x00038020 File Offset: 0x00036220
public override long Seek(long offset, SeekOrigin origin)
{
throw new NotSupportedException();
}
// Token: 0x06001296 RID: 4758 RVA: 0x00038028 File Offset: 0x00036228
public override void SetLength(long value)
{
throw new NotSupportedException();
}
// Token: 0x06001297 RID: 4759 RVA: 0x00038030 File Offset: 0x00036230
private int ReadInternal(byte[] buffer, int offset, int size)
{
int num = 0;
this.request.CheckIfAborted();
try
{
num = this.networkStream.Read(buffer, offset, size);
}
catch (IOException)
{
throw new ProtocolViolationException("Server commited a protocol violation");
}
this.totalRead += num;
if (num == 0)
{
this.networkStream = null;
this.request.CloseDataConnection();
this.request.SetTransferCompleted();
}
return num;
}
// Token: 0x06001298 RID: 4760 RVA: 0x000380C0 File Offset: 0x000362C0
public override IAsyncResult BeginRead(byte[] buffer, int offset, int size, AsyncCallback cb, object state)
{
this.CheckDisposed();
if (!this.isRead)
{
throw new NotSupportedException();
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
if (offset < 0 || offset > buffer.Length)
{
throw new ArgumentOutOfRangeException("offset");
}
if (size < 0 || size > buffer.Length - offset)
{
throw new ArgumentOutOfRangeException("offset+size");
}
FtpDataStream.ReadDelegate readDelegate = new FtpDataStream.ReadDelegate(this.ReadInternal);
return readDelegate.BeginInvoke(buffer, offset, size, cb, state);
}
// Token: 0x06001299 RID: 4761 RVA: 0x00038148 File Offset: 0x00036348
public override int EndRead(IAsyncResult asyncResult)
{
if (asyncResult == null)
{
throw new ArgumentNullException("asyncResult");
}
AsyncResult asyncResult2 = asyncResult as AsyncResult;
if (asyncResult2 == null)
{
throw new ArgumentException("Invalid asyncResult", "asyncResult");
}
FtpDataStream.ReadDelegate readDelegate = asyncResult2.AsyncDelegate as FtpDataStream.ReadDelegate;
if (readDelegate == null)
{
throw new ArgumentException("Invalid asyncResult", "asyncResult");
}
return readDelegate.EndInvoke(asyncResult);
}
// Token: 0x0600129A RID: 4762 RVA: 0x000381AC File Offset: 0x000363AC
public override int Read(byte[] buffer, int offset, int size)
{
this.request.CheckIfAborted();
IAsyncResult asyncResult = this.BeginRead(buffer, offset, size, null, null);
if (!asyncResult.IsCompleted && !asyncResult.AsyncWaitHandle.WaitOne(this.request.ReadWriteTimeout, false))
{
throw new WebException("Read timed out.", WebExceptionStatus.Timeout);
}
return this.EndRead(asyncResult);
}
// Token: 0x0600129B RID: 4763 RVA: 0x0003820C File Offset: 0x0003640C
private void WriteInternal(byte[] buffer, int offset, int size)
{
this.request.CheckIfAborted();
try
{
this.networkStream.Write(buffer, offset, size);
}
catch (IOException)
{
throw new ProtocolViolationException();
}
}
// Token: 0x0600129C RID: 4764 RVA: 0x00038260 File Offset: 0x00036460
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int size, AsyncCallback cb, object state)
{
this.CheckDisposed();
if (this.isRead)
{
throw new NotSupportedException();
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
if (offset < 0 || offset > buffer.Length)
{
throw new ArgumentOutOfRangeException("offset");
}
if (size < 0 || size > buffer.Length - offset)
{
throw new ArgumentOutOfRangeException("offset+size");
}
FtpDataStream.WriteDelegate writeDelegate = new FtpDataStream.WriteDelegate(this.WriteInternal);
return writeDelegate.BeginInvoke(buffer, offset, size, cb, state);
}
// Token: 0x0600129D RID: 4765 RVA: 0x000382E8 File Offset: 0x000364E8
public override void EndWrite(IAsyncResult asyncResult)
{
if (asyncResult == null)
{
throw new ArgumentNullException("asyncResult");
}
AsyncResult asyncResult2 = asyncResult as AsyncResult;
if (asyncResult2 == null)
{
throw new ArgumentException("Invalid asyncResult.", "asyncResult");
}
FtpDataStream.WriteDelegate writeDelegate = asyncResult2.AsyncDelegate as FtpDataStream.WriteDelegate;
if (writeDelegate == null)
{
throw new ArgumentException("Invalid asyncResult.", "asyncResult");
}
writeDelegate.EndInvoke(asyncResult);
}
// Token: 0x0600129E RID: 4766 RVA: 0x0003834C File Offset: 0x0003654C
public override void Write(byte[] buffer, int offset, int size)
{
this.request.CheckIfAborted();
IAsyncResult asyncResult = this.BeginWrite(buffer, offset, size, null, null);
if (!asyncResult.IsCompleted && !asyncResult.AsyncWaitHandle.WaitOne(this.request.ReadWriteTimeout, false))
{
throw new WebException("Read timed out.", WebExceptionStatus.Timeout);
}
this.EndWrite(asyncResult);
}
// Token: 0x0600129F RID: 4767 RVA: 0x000383AC File Offset: 0x000365AC
~FtpDataStream()
{
this.Dispose(false);
}
// Token: 0x060012A0 RID: 4768 RVA: 0x000383E8 File Offset: 0x000365E8
protected override void Dispose(bool disposing)
{
if (this.disposed)
{
return;
}
this.disposed = true;
if (this.networkStream != null)
{
this.request.CloseDataConnection();
this.request.SetTransferCompleted();
this.request = null;
this.networkStream = null;
}
}
// Token: 0x060012A1 RID: 4769 RVA: 0x00038438 File Offset: 0x00036638
private void CheckDisposed()
{
if (this.disposed)
{
throw new ObjectDisposedException(base.GetType().FullName);
}
}
// Token: 0x04000FDB RID: 4059
private FtpWebRequest request;
// Token: 0x04000FDC RID: 4060
private Stream networkStream;
// Token: 0x04000FDD RID: 4061
private bool disposed;
// Token: 0x04000FDE RID: 4062
private bool isRead;
// Token: 0x04000FDF RID: 4063
private int totalRead;
// Token: 0x02000317 RID: 791
// (Invoke) Token: 0x06001C35 RID: 7221
private delegate void WriteDelegate(byte[] buffer, int offset, int size);
// Token: 0x02000318 RID: 792
// (Invoke) Token: 0x06001C39 RID: 7225
private delegate int ReadDelegate(byte[] buffer, int offset, int size);
}
}
+14
View File
@@ -0,0 +1,14 @@
using System;
namespace System.Net
{
// Token: 0x0200021F RID: 543
internal class FtpRequestCreator : IWebRequestCreate
{
// Token: 0x060012A3 RID: 4771 RVA: 0x00038460 File Offset: 0x00036660
public WebRequest Create(global::System.Uri uri)
{
return new FtpWebRequest(uri);
}
}
}
+41
View File
@@ -0,0 +1,41 @@
using System;
namespace System.Net
{
// Token: 0x02000220 RID: 544
internal class FtpStatus
{
// Token: 0x060012A4 RID: 4772 RVA: 0x00038468 File Offset: 0x00036668
public FtpStatus(FtpStatusCode statusCode, string statusDescription)
{
this.statusCode = statusCode;
this.statusDescription = statusDescription;
}
// Token: 0x1700060D RID: 1549
// (get) Token: 0x060012A5 RID: 4773 RVA: 0x00038480 File Offset: 0x00036680
public FtpStatusCode StatusCode
{
get
{
return this.statusCode;
}
}
// Token: 0x1700060E RID: 1550
// (get) Token: 0x060012A6 RID: 4774 RVA: 0x00038488 File Offset: 0x00036688
public string StatusDescription
{
get
{
return this.statusDescription;
}
}
// Token: 0x04000FE0 RID: 4064
private readonly FtpStatusCode statusCode;
// Token: 0x04000FE1 RID: 4065
private readonly string statusDescription;
}
}
+121
View File
@@ -0,0 +1,121 @@
using System;
namespace System.Net
{
/// <summary>Specifies the status codes returned for a File Transfer Protocol (FTP) operation.</summary>
// Token: 0x02000221 RID: 545
public enum FtpStatusCode
{
/// <summary>Included for completeness, this value is never returned by servers.</summary>
// Token: 0x04000FE3 RID: 4067
Undefined,
/// <summary>Specifies that the response contains a restart marker reply. The text of the description that accompanies this status contains the user data stream marker and the server marker.</summary>
// Token: 0x04000FE4 RID: 4068
RestartMarker = 110,
/// <summary>Specifies that the service is not available now; try your request later.</summary>
// Token: 0x04000FE5 RID: 4069
ServiceTemporarilyNotAvailable = 120,
/// <summary>Specifies that the data connection is already open and the requested transfer is starting.</summary>
// Token: 0x04000FE6 RID: 4070
DataAlreadyOpen = 125,
/// <summary>Specifies that the server is opening the data connection.</summary>
// Token: 0x04000FE7 RID: 4071
OpeningData = 150,
/// <summary>Specifies that the command completed successfully.</summary>
// Token: 0x04000FE8 RID: 4072
CommandOK = 200,
/// <summary>Specifies that the command is not implemented by the server because it is not needed.</summary>
// Token: 0x04000FE9 RID: 4073
CommandExtraneous = 202,
/// <summary>Specifies the status of a directory.</summary>
// Token: 0x04000FEA RID: 4074
DirectoryStatus = 212,
/// <summary>Specifies the status of a file.</summary>
// Token: 0x04000FEB RID: 4075
FileStatus,
/// <summary>Specifies the system type name using the system names published in the Assigned Numbers document published by the Internet Assigned Numbers Authority.</summary>
// Token: 0x04000FEC RID: 4076
SystemType = 215,
/// <summary>Specifies that the server is ready for a user login operation.</summary>
// Token: 0x04000FED RID: 4077
SendUserCommand = 220,
/// <summary>Specifies that the server is closing the control connection.</summary>
// Token: 0x04000FEE RID: 4078
ClosingControl,
/// <summary>Specifies that the server is closing the data connection and that the requested file action was successful.</summary>
// Token: 0x04000FEF RID: 4079
ClosingData = 226,
/// <summary>Specifies that the server is entering passive mode.</summary>
// Token: 0x04000FF0 RID: 4080
EnteringPassive,
/// <summary>Specifies that the user is logged in and can send commands.</summary>
// Token: 0x04000FF1 RID: 4081
LoggedInProceed = 230,
/// <summary>Specifies that the server accepts the authentication mechanism specified by the client, and the exchange of security data is complete.</summary>
// Token: 0x04000FF2 RID: 4082
ServerWantsSecureSession = 234,
/// <summary>Specifies that the requested file action completed successfully.</summary>
// Token: 0x04000FF3 RID: 4083
FileActionOK = 250,
/// <summary>Specifies that the requested path name was created.</summary>
// Token: 0x04000FF4 RID: 4084
PathnameCreated = 257,
/// <summary>Specifies that the server expects a password to be supplied.</summary>
// Token: 0x04000FF5 RID: 4085
SendPasswordCommand = 331,
/// <summary>Specifies that the server requires a login account to be supplied.</summary>
// Token: 0x04000FF6 RID: 4086
NeedLoginAccount,
/// <summary>Specifies that the requested file action requires additional information.</summary>
// Token: 0x04000FF7 RID: 4087
FileCommandPending = 350,
/// <summary>Specifies that the service is not available.</summary>
// Token: 0x04000FF8 RID: 4088
ServiceNotAvailable = 421,
/// <summary>Specifies that the data connection cannot be opened.</summary>
// Token: 0x04000FF9 RID: 4089
CantOpenData = 425,
/// <summary>Specifies that the connection has been closed.</summary>
// Token: 0x04000FFA RID: 4090
ConnectionClosed,
/// <summary>Specifies that the requested action cannot be performed on the specified file because the file is not available or is being used.</summary>
// Token: 0x04000FFB RID: 4091
ActionNotTakenFileUnavailableOrBusy = 450,
/// <summary>Specifies that an error occurred that prevented the request action from completing.</summary>
// Token: 0x04000FFC RID: 4092
ActionAbortedLocalProcessingError,
/// <summary>Specifies that the requested action cannot be performed because there is not enough space on the server.</summary>
// Token: 0x04000FFD RID: 4093
ActionNotTakenInsufficientSpace,
/// <summary>Specifies that the command has a syntax error or is not a command recognized by the server.</summary>
// Token: 0x04000FFE RID: 4094
CommandSyntaxError = 500,
/// <summary>Specifies that one or more command arguments has a syntax error.</summary>
// Token: 0x04000FFF RID: 4095
ArgumentSyntaxError,
/// <summary>Specifies that the command is not implemented by the FTP server.</summary>
// Token: 0x04001000 RID: 4096
CommandNotImplemented,
/// <summary>Specifies that the sequence of commands is not in the correct order.</summary>
// Token: 0x04001001 RID: 4097
BadCommandSequence,
/// <summary>Specifies that login information must be sent to the server.</summary>
// Token: 0x04001002 RID: 4098
NotLoggedIn = 530,
/// <summary>Specifies that a user account on the server is required.</summary>
// Token: 0x04001003 RID: 4099
AccountNeeded = 532,
/// <summary>Specifies that the requested action cannot be performed on the specified file because the file is not available.</summary>
// Token: 0x04001004 RID: 4100
ActionNotTakenFileUnavailable = 550,
/// <summary>Specifies that the requested action cannot be taken because the specified page type is unknown. Page types are described in RFC 959 Section 3.1.2.3</summary>
// Token: 0x04001005 RID: 4101
ActionAbortedUnknownPageType,
/// <summary>Specifies that the requested action cannot be performed.</summary>
// Token: 0x04001006 RID: 4102
FileActionAborted,
/// <summary>Specifies that the requested action cannot be performed on the specified file.</summary>
// Token: 0x04001007 RID: 4103
ActionNotTakenFilenameNotAllowed
}
}
+1694
View File
@@ -0,0 +1,1694 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Cache;
using System.Net.Security;
using System.Net.Sockets;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading;
namespace System.Net
{
/// <summary>Implements a File Transfer Protocol (FTP) client.</summary>
// Token: 0x02000222 RID: 546
public sealed class FtpWebRequest : WebRequest
{
// Token: 0x060012A7 RID: 4775 RVA: 0x00038490 File Offset: 0x00036690
internal FtpWebRequest(global::System.Uri uri)
{
this.requestUri = uri;
this.proxy = GlobalProxySelection.Select;
}
// Token: 0x060012A9 RID: 4777 RVA: 0x0003859C File Offset: 0x0003679C
private static Exception GetMustImplement()
{
return new NotImplementedException();
}
/// <summary>Gets the certificates used for establishing an encrypted connection to the FTP server.</summary>
/// <returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" /> object that contains the client certificates.</returns>
// Token: 0x1700060F RID: 1551
// (get) Token: 0x060012AA RID: 4778 RVA: 0x000385A4 File Offset: 0x000367A4
// (set) Token: 0x060012AB RID: 4779 RVA: 0x000385AC File Offset: 0x000367AC
[global::System.MonoTODO]
public global::System.Security.Cryptography.X509Certificates.X509CertificateCollection ClientCertificates
{
get
{
throw FtpWebRequest.GetMustImplement();
}
set
{
throw FtpWebRequest.GetMustImplement();
}
}
/// <summary>Gets or sets the name of the connection group that contains the service point used to send the current request.</summary>
/// <returns>A <see cref="T:System.String" /> value that contains a connection group name.</returns>
/// <exception cref="T:System.InvalidOperationException">A new value was specified for this property for a request that is already in progress. </exception>
// Token: 0x17000610 RID: 1552
// (get) Token: 0x060012AC RID: 4780 RVA: 0x000385B4 File Offset: 0x000367B4
// (set) Token: 0x060012AD RID: 4781 RVA: 0x000385BC File Offset: 0x000367BC
[global::System.MonoTODO]
public override string ConnectionGroupName
{
get
{
throw FtpWebRequest.GetMustImplement();
}
set
{
throw FtpWebRequest.GetMustImplement();
}
}
/// <summary>Always throws a <see cref="T:System.NotSupportedException" />.</summary>
/// <returns>Always throws a <see cref="T:System.NotSupportedException" />.</returns>
/// <exception cref="T:System.NotSupportedException">Content type information is not supported for FTP.</exception>
// Token: 0x17000611 RID: 1553
// (get) Token: 0x060012AE RID: 4782 RVA: 0x000385C4 File Offset: 0x000367C4
// (set) Token: 0x060012AF RID: 4783 RVA: 0x000385CC File Offset: 0x000367CC
public override string ContentType
{
get
{
throw new NotSupportedException();
}
set
{
throw new NotSupportedException();
}
}
/// <summary>Gets or sets a value that is ignored by the <see cref="T:System.Net.FtpWebRequest" /> class.</summary>
/// <returns>An <see cref="T:System.Int64" /> value that should be ignored.</returns>
// Token: 0x17000612 RID: 1554
// (get) Token: 0x060012B0 RID: 4784 RVA: 0x000385D4 File Offset: 0x000367D4
// (set) Token: 0x060012B1 RID: 4785 RVA: 0x000385D8 File Offset: 0x000367D8
public override long ContentLength
{
get
{
return 0L;
}
set
{
}
}
/// <summary>Gets or sets a byte offset into the file being downloaded by this request.</summary>
/// <returns>An <see cref="T:System.Int64" /> instance that specifies the file offset, in bytes. The default value is zero.</returns>
/// <exception cref="T:System.InvalidOperationException">A new value was specified for this property for a request that is already in progress. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value specified for this property is less than zero. </exception>
// Token: 0x17000613 RID: 1555
// (get) Token: 0x060012B2 RID: 4786 RVA: 0x000385DC File Offset: 0x000367DC
// (set) Token: 0x060012B3 RID: 4787 RVA: 0x000385E4 File Offset: 0x000367E4
public long ContentOffset
{
get
{
return this.offset;
}
set
{
this.CheckRequestStarted();
if (value < 0L)
{
throw new ArgumentOutOfRangeException();
}
this.offset = value;
}
}
/// <summary>Gets or sets the credentials used to communicate with the FTP server.</summary>
/// <returns>An <see cref="T:System.Net.ICredentials" /> instance; otherwise, null if the property has not been set.</returns>
/// <exception cref="T:System.ArgumentNullException">The value specified for a set operation is null.</exception>
/// <exception cref="T:System.ArgumentException">An <see cref="T:System.Net.ICredentials" /> of a type other than <see cref="T:System.Net.NetworkCredential" /> was specified for a set operation.</exception>
/// <exception cref="T:System.InvalidOperationException">A new value was specified for this property for a request that is already in progress. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
/// </PermissionSet>
// Token: 0x17000614 RID: 1556
// (get) Token: 0x060012B4 RID: 4788 RVA: 0x00038604 File Offset: 0x00036804
// (set) Token: 0x060012B5 RID: 4789 RVA: 0x0003860C File Offset: 0x0003680C
public override ICredentials Credentials
{
get
{
return this.credentials;
}
set
{
this.CheckRequestStarted();
if (value == null)
{
throw new ArgumentNullException();
}
if (!(value is NetworkCredential))
{
throw new ArgumentException();
}
this.credentials = value as NetworkCredential;
}
}
/// <summary>Defines the default cache policy for all FTP requests.</summary>
/// <returns>A <see cref="T:System.Net.Cache.RequestCachePolicy" /> that defines the cache policy for FTP requests.</returns>
/// <exception cref="T:System.ArgumentNullException">The caller tried to set this property to null.</exception>
// Token: 0x17000615 RID: 1557
// (get) Token: 0x060012B6 RID: 4790 RVA: 0x00038640 File Offset: 0x00036840
// (set) Token: 0x060012B7 RID: 4791 RVA: 0x00038648 File Offset: 0x00036848
[global::System.MonoTODO]
public new static global::System.Net.Cache.RequestCachePolicy DefaultCachePolicy
{
get
{
throw FtpWebRequest.GetMustImplement();
}
set
{
throw FtpWebRequest.GetMustImplement();
}
}
/// <summary>Gets or sets a <see cref="T:System.Boolean" /> that specifies that an SSL connection should be used.</summary>
/// <returns>true if control and data transmissions are encrypted; otherwise, false. The default value is false.</returns>
/// <exception cref="T:System.InvalidOperationException">The connection to the FTP server has already been established.</exception>
// Token: 0x17000616 RID: 1558
// (get) Token: 0x060012B8 RID: 4792 RVA: 0x00038650 File Offset: 0x00036850
// (set) Token: 0x060012B9 RID: 4793 RVA: 0x00038658 File Offset: 0x00036858
public bool EnableSsl
{
get
{
return this.enableSsl;
}
set
{
this.CheckRequestStarted();
this.enableSsl = value;
}
}
/// <summary>Gets an empty <see cref="T:System.Net.WebHeaderCollection" /> object.</summary>
/// <returns>An empty <see cref="T:System.Net.WebHeaderCollection" /> object.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Net.WebPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x17000617 RID: 1559
// (get) Token: 0x060012BA RID: 4794 RVA: 0x00038668 File Offset: 0x00036868
// (set) Token: 0x060012BB RID: 4795 RVA: 0x00038670 File Offset: 0x00036870
[global::System.MonoTODO]
public override WebHeaderCollection Headers
{
get
{
throw FtpWebRequest.GetMustImplement();
}
set
{
throw FtpWebRequest.GetMustImplement();
}
}
/// <summary>Gets or sets a <see cref="T:System.Boolean" /> value that specifies whether the control connection to the FTP server is closed after the request completes.</summary>
/// <returns>true if the connection to the server should not be destroyed; otherwise, false. The default value is true.</returns>
/// <exception cref="T:System.InvalidOperationException">A new value was specified for this property for a request that is already in progress. </exception>
// Token: 0x17000618 RID: 1560
// (get) Token: 0x060012BC RID: 4796 RVA: 0x00038678 File Offset: 0x00036878
// (set) Token: 0x060012BD RID: 4797 RVA: 0x00038680 File Offset: 0x00036880
[global::System.MonoTODO("We don't support KeepAlive = true")]
public bool KeepAlive
{
get
{
return this.keepAlive;
}
set
{
this.CheckRequestStarted();
}
}
/// <summary>Gets or sets the command to send to the FTP server.</summary>
/// <returns>A <see cref="T:System.String" /> value that contains the FTP command to send to the server. The default value is <see cref="F:System.Net.WebRequestMethods.Ftp.DownloadFile" />.</returns>
/// <exception cref="T:System.InvalidOperationException">A new value was specified for this property for a request that is already in progress. </exception>
/// <exception cref="T:System.ArgumentException">The method is invalid.- or -The method is not supported.- or -Multiple methods were specified.</exception>
// Token: 0x17000619 RID: 1561
// (get) Token: 0x060012BE RID: 4798 RVA: 0x00038688 File Offset: 0x00036888
// (set) Token: 0x060012BF RID: 4799 RVA: 0x00038690 File Offset: 0x00036890
public override string Method
{
get
{
return this.method;
}
set
{
this.CheckRequestStarted();
if (value == null)
{
throw new ArgumentNullException("Method string cannot be null");
}
if (value.Length == 0 || Array.BinarySearch<string>(FtpWebRequest.supportedCommands, value) < 0)
{
throw new ArgumentException("Method not supported", "value");
}
this.method = value;
}
}
/// <summary>Always throws a <see cref="T:System.NotSupportedException" />.</summary>
/// <returns>Always throws a <see cref="T:System.NotSupportedException" />.</returns>
/// <exception cref="T:System.NotSupportedException">Preauthentication is not supported for FTP.</exception>
// Token: 0x1700061A RID: 1562
// (get) Token: 0x060012C0 RID: 4800 RVA: 0x000386E8 File Offset: 0x000368E8
// (set) Token: 0x060012C1 RID: 4801 RVA: 0x000386F0 File Offset: 0x000368F0
public override bool PreAuthenticate
{
get
{
throw new NotSupportedException();
}
set
{
throw new NotSupportedException();
}
}
/// <summary>Gets or sets the proxy used to communicate with the FTP server.</summary>
/// <returns>An <see cref="T:System.Net.IWebProxy" /> instance responsible for communicating with the FTP server.</returns>
/// <exception cref="T:System.ArgumentNullException">This property cannot be set to null.</exception>
/// <exception cref="T:System.InvalidOperationException">A new value was specified for this property for a request that is already in progress. </exception>
/// <PermissionSet>
/// <IPermission class="System.Net.WebPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x1700061B RID: 1563
// (get) Token: 0x060012C2 RID: 4802 RVA: 0x000386F8 File Offset: 0x000368F8
// (set) Token: 0x060012C3 RID: 4803 RVA: 0x00038700 File Offset: 0x00036900
public override IWebProxy Proxy
{
get
{
return this.proxy;
}
set
{
this.CheckRequestStarted();
if (value == null)
{
throw new ArgumentNullException();
}
this.proxy = value;
}
}
/// <summary>Gets or sets a time-out when reading from or writing to a stream.</summary>
/// <returns>The number of milliseconds before the reading or writing times out. The default value is 300,000 milliseconds (5 minutes).</returns>
/// <exception cref="T:System.InvalidOperationException">The request has already been sent. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value specified for a set operation is less than or equal to zero and is not equal to <see cref="F:System.Threading.Timeout.Infinite" />. </exception>
// Token: 0x1700061C RID: 1564
// (get) Token: 0x060012C4 RID: 4804 RVA: 0x0003871C File Offset: 0x0003691C
// (set) Token: 0x060012C5 RID: 4805 RVA: 0x00038724 File Offset: 0x00036924
public int ReadWriteTimeout
{
get
{
return this.rwTimeout;
}
set
{
this.CheckRequestStarted();
if (value < -1)
{
throw new ArgumentOutOfRangeException();
}
this.rwTimeout = value;
}
}
/// <summary>Gets or sets the new name of a file being renamed.</summary>
/// <returns>The new name of the file being renamed.</returns>
// Token: 0x1700061D RID: 1565
// (get) Token: 0x060012C6 RID: 4806 RVA: 0x00038740 File Offset: 0x00036940
// (set) Token: 0x060012C7 RID: 4807 RVA: 0x00038748 File Offset: 0x00036948
public string RenameTo
{
get
{
return this.renameTo;
}
set
{
this.CheckRequestStarted();
if (value == null || value.Length == 0)
{
throw new ArgumentException("RenameTo value can't be null or empty", "RenameTo");
}
this.renameTo = value;
}
}
/// <summary>Gets the URI requested by this instance.</summary>
/// <returns>A <see cref="T:System.Uri" /> instance that identifies a resource that is accessed using the File Transfer Protocol.</returns>
// Token: 0x1700061E RID: 1566
// (get) Token: 0x060012C8 RID: 4808 RVA: 0x00038784 File Offset: 0x00036984
public override global::System.Uri RequestUri
{
get
{
return this.requestUri;
}
}
/// <summary>Gets the <see cref="T:System.Net.ServicePoint" /> object used to connect to the FTP server.</summary>
/// <returns>A <see cref="T:System.Net.ServicePoint" /> object that can be used to customize connection behavior.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
/// </PermissionSet>
// Token: 0x1700061F RID: 1567
// (get) Token: 0x060012C9 RID: 4809 RVA: 0x0003878C File Offset: 0x0003698C
public ServicePoint ServicePoint
{
get
{
return this.GetServicePoint();
}
}
/// <summary>Gets or sets the behavior of a client application's data transfer process.</summary>
/// <returns>false if the client application's data transfer process listens for a connection on the data port; otherwise, true if the client should initiate a connection on the data port. The default value is true.</returns>
/// <exception cref="T:System.InvalidOperationException">A new value was specified for this property for a request that is already in progress. </exception>
// Token: 0x17000620 RID: 1568
// (get) Token: 0x060012CA RID: 4810 RVA: 0x00038794 File Offset: 0x00036994
// (set) Token: 0x060012CB RID: 4811 RVA: 0x0003879C File Offset: 0x0003699C
public bool UsePassive
{
get
{
return this.usePassive;
}
set
{
this.CheckRequestStarted();
this.usePassive = value;
}
}
/// <summary>Always throws a <see cref="T:System.NotSupportedException" />.</summary>
/// <returns>Always throws a <see cref="T:System.NotSupportedException" />.</returns>
/// <exception cref="T:System.NotSupportedException">Default credentials are not supported for FTP.</exception>
// Token: 0x17000621 RID: 1569
// (get) Token: 0x060012CC RID: 4812 RVA: 0x000387AC File Offset: 0x000369AC
// (set) Token: 0x060012CD RID: 4813 RVA: 0x000387B4 File Offset: 0x000369B4
[global::System.MonoTODO]
public override bool UseDefaultCredentials
{
get
{
throw FtpWebRequest.GetMustImplement();
}
set
{
throw FtpWebRequest.GetMustImplement();
}
}
/// <summary>Gets or sets a <see cref="T:System.Boolean" /> value that specifies the data type for file transfers.</summary>
/// <returns>true to indicate to the server that the data to be transferred is binary; false to indicate that the data is text. The default value is true.</returns>
/// <exception cref="T:System.InvalidOperationException">A new value was specified for this property for a request that is already in progress.</exception>
// Token: 0x17000622 RID: 1570
// (get) Token: 0x060012CE RID: 4814 RVA: 0x000387BC File Offset: 0x000369BC
// (set) Token: 0x060012CF RID: 4815 RVA: 0x000387C4 File Offset: 0x000369C4
public bool UseBinary
{
get
{
return this.binary;
}
set
{
this.CheckRequestStarted();
this.binary = value;
}
}
/// <summary>Gets or sets the number of milliseconds to wait for a request.</summary>
/// <returns>An <see cref="T:System.Int32" /> value that contains the number of milliseconds to wait before a request times out. The default value is <see cref="F:System.Threading.Timeout.Infinite" />.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value specified is less than zero and is not <see cref="F:System.Threading.Timeout.Infinite" />. </exception>
/// <exception cref="T:System.InvalidOperationException">A new value was specified for this property for a request that is already in progress. </exception>
// Token: 0x17000623 RID: 1571
// (get) Token: 0x060012D0 RID: 4816 RVA: 0x000387D4 File Offset: 0x000369D4
// (set) Token: 0x060012D1 RID: 4817 RVA: 0x000387DC File Offset: 0x000369DC
public override int Timeout
{
get
{
return this.timeout;
}
set
{
this.CheckRequestStarted();
if (value < -1)
{
throw new ArgumentOutOfRangeException();
}
this.timeout = value;
}
}
// Token: 0x17000624 RID: 1572
// (get) Token: 0x060012D2 RID: 4818 RVA: 0x000387F8 File Offset: 0x000369F8
private string DataType
{
get
{
return (!this.binary) ? "A" : "I";
}
}
// Token: 0x17000625 RID: 1573
// (get) Token: 0x060012D3 RID: 4819 RVA: 0x00038814 File Offset: 0x00036A14
// (set) Token: 0x060012D4 RID: 4820 RVA: 0x00038864 File Offset: 0x00036A64
private FtpWebRequest.RequestState State
{
get
{
object obj = this.locker;
FtpWebRequest.RequestState requestState;
lock (obj)
{
requestState = this.requestState;
}
return requestState;
}
set
{
object obj = this.locker;
lock (obj)
{
this.CheckIfAborted();
this.CheckFinalState();
this.requestState = value;
}
}
}
/// <summary>Terminates an asynchronous FTP operation.</summary>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Net.WebPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x060012D5 RID: 4821 RVA: 0x000388BC File Offset: 0x00036ABC
public override void Abort()
{
object obj = this.locker;
lock (obj)
{
if (this.State == FtpWebRequest.RequestState.TransferInProgress)
{
this.SendCommand(false, "ABOR", new string[0]);
}
if (!this.InFinalState())
{
this.State = FtpWebRequest.RequestState.Aborted;
this.ftpResponse = new FtpWebResponse(this, this.requestUri, this.method, FtpStatusCode.FileActionAborted, "Aborted by request");
}
}
}
/// <summary>Begins sending a request and receiving a response from an FTP server asynchronously.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> instance that indicates the status of the operation.</returns>
/// <param name="callback">An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when the operation is complete. </param>
/// <param name="state">A user-defined object that contains information about the operation. This object is passed to the <paramref name="callback" /> delegate when the operation completes. </param>
/// <exception cref="T:System.InvalidOperationException">
/// <see cref="M:System.Net.FtpWebRequest.GetResponse" /> or <see cref="M:System.Net.FtpWebRequest.BeginGetResponse(System.AsyncCallback,System.Object)" /> has already been called for this instance. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.DnsPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.WebPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x060012D6 RID: 4822 RVA: 0x00038954 File Offset: 0x00036B54
public override IAsyncResult BeginGetResponse(AsyncCallback callback, object state)
{
if (this.asyncResult != null && !this.asyncResult.IsCompleted)
{
throw new InvalidOperationException("Cannot re-call BeginGetRequestStream/BeginGetResponse while a previous call is still in progress");
}
this.CheckIfAborted();
this.asyncResult = new FtpAsyncResult(callback, state);
object obj = this.locker;
lock (obj)
{
if (this.InFinalState())
{
this.asyncResult.SetCompleted(true, this.ftpResponse);
}
else
{
if (this.State == FtpWebRequest.RequestState.Before)
{
this.State = FtpWebRequest.RequestState.Scheduled;
}
Thread thread = new Thread(new ThreadStart(this.ProcessRequest));
thread.Start();
}
}
return this.asyncResult;
}
/// <summary>Ends a pending asynchronous operation started with <see cref="M:System.Net.FtpWebRequest.BeginGetResponse(System.AsyncCallback,System.Object)" />.</summary>
/// <returns>A <see cref="T:System.Net.WebResponse" /> reference that contains an <see cref="T:System.Net.FtpWebResponse" /> instance. This object contains the FTP server's response to the request.</returns>
/// <param name="asyncResult">The <see cref="T:System.IAsyncResult" /> that was returned when the operation started. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="asyncResult" /> was not obtained by calling <see cref="M:System.Net.FtpWebRequest.BeginGetResponse(System.AsyncCallback,System.Object)" />. </exception>
/// <exception cref="T:System.InvalidOperationException">This method was already called for the operation identified by <paramref name="asyncResult" />. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Net.WebPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x060012D7 RID: 4823 RVA: 0x00038A24 File Offset: 0x00036C24
public override WebResponse EndGetResponse(IAsyncResult asyncResult)
{
if (asyncResult == null)
{
throw new ArgumentNullException("AsyncResult cannot be null!");
}
if (!(asyncResult is FtpAsyncResult) || asyncResult != this.asyncResult)
{
throw new ArgumentException("AsyncResult is from another request!");
}
FtpAsyncResult ftpAsyncResult = (FtpAsyncResult)asyncResult;
if (!ftpAsyncResult.WaitUntilComplete(this.timeout, false))
{
this.Abort();
throw new WebException("Transfer timed out.", WebExceptionStatus.Timeout);
}
this.CheckIfAborted();
asyncResult = null;
if (ftpAsyncResult.GotException)
{
throw ftpAsyncResult.Exception;
}
return ftpAsyncResult.Response;
}
/// <summary>Returns the FTP server response.</summary>
/// <returns>A <see cref="T:System.Net.WebResponse" /> reference that contains an <see cref="T:System.Net.FtpWebResponse" /> instance. This object contains the FTP server's response to the request.</returns>
/// <exception cref="T:System.InvalidOperationException">
/// <see cref="M:System.Net.FtpWebRequest.GetResponse" /> or <see cref="M:System.Net.FtpWebRequest.BeginGetResponse(System.AsyncCallback,System.Object)" /> has already been called for this instance.- or -An HTTP proxy is enabled, and you attempted to use an FTP command other than <see cref="F:System.Net.WebRequestMethods.Ftp.DownloadFile" />, <see cref="F:System.Net.WebRequestMethods.Ftp.ListDirectory" />, or <see cref="F:System.Net.WebRequestMethods.Ftp.ListDirectoryDetails" />.</exception>
/// <exception cref="T:System.Net.WebException">
/// <see cref="P:System.Net.FtpWebRequest.EnableSsl" /> is set to true, but the server does not support this feature.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.DnsPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.WebPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x060012D8 RID: 4824 RVA: 0x00038AB4 File Offset: 0x00036CB4
public override WebResponse GetResponse()
{
IAsyncResult asyncResult = this.BeginGetResponse(null, null);
return this.EndGetResponse(asyncResult);
}
/// <summary>Begins asynchronously opening a request's content stream for writing.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> instance that indicates the status of the operation.</returns>
/// <param name="callback">An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when the operation is complete. </param>
/// <param name="state">A user-defined object that contains information about the operation. This object is passed to the <paramref name="callback" /> delegate when the operation completes. </param>
/// <exception cref="T:System.InvalidOperationException">A previous call to this method or <see cref="M:System.Net.FtpWebRequest.GetRequestStream" /> has not yet completed. </exception>
/// <exception cref="T:System.Net.WebException">A connection to the FTP server could not be established. </exception>
/// <exception cref="T:System.Net.ProtocolViolationException">The <see cref="P:System.Net.FtpWebRequest.Method" /> property is not set to <see cref="F:System.Net.WebRequestMethods.Ftp.UploadFile" />. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.DnsPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.WebPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x060012D9 RID: 4825 RVA: 0x00038AD4 File Offset: 0x00036CD4
public override IAsyncResult BeginGetRequestStream(AsyncCallback callback, object state)
{
if (this.method != "STOR" && this.method != "STOU" && this.method != "APPE")
{
throw new ProtocolViolationException();
}
object obj = this.locker;
lock (obj)
{
this.CheckIfAborted();
if (this.State != FtpWebRequest.RequestState.Before)
{
throw new InvalidOperationException("Cannot re-call BeginGetRequestStream/BeginGetResponse while a previous call is still in progress");
}
this.State = FtpWebRequest.RequestState.Scheduled;
}
this.asyncResult = new FtpAsyncResult(callback, state);
Thread thread = new Thread(new ThreadStart(this.ProcessRequest));
thread.Start();
return this.asyncResult;
}
/// <summary>Ends a pending asynchronous operation started with <see cref="M:System.Net.FtpWebRequest.BeginGetRequestStream(System.AsyncCallback,System.Object)" />.</summary>
/// <returns>A writable <see cref="T:System.IO.Stream" /> instance associated with this instance.</returns>
/// <param name="asyncResult">The <see cref="T:System.IAsyncResult" /> object that was returned when the operation started. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="asyncResult" /> was not obtained by calling <see cref="M:System.Net.FtpWebRequest.BeginGetRequestStream(System.AsyncCallback,System.Object)" />. </exception>
/// <exception cref="T:System.InvalidOperationException">This method was already called for the operation identified by <paramref name="asyncResult" />. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Net.WebPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x060012DA RID: 4826 RVA: 0x00038BAC File Offset: 0x00036DAC
public override Stream EndGetRequestStream(IAsyncResult asyncResult)
{
if (asyncResult == null)
{
throw new ArgumentNullException("asyncResult");
}
if (!(asyncResult is FtpAsyncResult))
{
throw new ArgumentException("asyncResult");
}
if (this.State == FtpWebRequest.RequestState.Aborted)
{
throw new WebException("Request aborted", WebExceptionStatus.RequestCanceled);
}
if (asyncResult != this.asyncResult)
{
throw new ArgumentException("AsyncResult is from another request!");
}
FtpAsyncResult ftpAsyncResult = (FtpAsyncResult)asyncResult;
if (!ftpAsyncResult.WaitUntilComplete(this.timeout, false))
{
this.Abort();
throw new WebException("Request timed out");
}
if (ftpAsyncResult.GotException)
{
throw ftpAsyncResult.Exception;
}
return ftpAsyncResult.Stream;
}
/// <summary>Retrieves the stream used to upload data to an FTP server.</summary>
/// <returns>A writable <see cref="T:System.IO.Stream" /> instance used to store data to be sent to the server by the current request.</returns>
/// <exception cref="T:System.InvalidOperationException">
/// <see cref="M:System.Net.FtpWebRequest.BeginGetRequestStream(System.AsyncCallback,System.Object)" /> has been called and has not completed. - or -An HTTP proxy is enabled, and you attempted to use an FTP command other than <see cref="F:System.Net.WebRequestMethods.Ftp.DownloadFile" />, <see cref="F:System.Net.WebRequestMethods.Ftp.ListDirectory" />, or <see cref="F:System.Net.WebRequestMethods.Ftp.ListDirectoryDetails" />.</exception>
/// <exception cref="T:System.Net.WebException">A connection to the FTP server could not be established. </exception>
/// <exception cref="T:System.Net.ProtocolViolationException">The <see cref="P:System.Net.FtpWebRequest.Method" /> property is not set to <see cref="F:System.Net.WebRequestMethods.Ftp.UploadFile" /> or <see cref="F:System.Net.WebRequestMethods.Ftp.AppendFile" />. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.DnsPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.WebPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x060012DB RID: 4827 RVA: 0x00038C54 File Offset: 0x00036E54
public override Stream GetRequestStream()
{
IAsyncResult asyncResult = this.BeginGetRequestStream(null, null);
return this.EndGetRequestStream(asyncResult);
}
// Token: 0x060012DC RID: 4828 RVA: 0x00038C74 File Offset: 0x00036E74
private ServicePoint GetServicePoint()
{
if (this.servicePoint == null)
{
this.servicePoint = ServicePointManager.FindServicePoint(this.requestUri, this.proxy);
}
return this.servicePoint;
}
// Token: 0x060012DD RID: 4829 RVA: 0x00038CAC File Offset: 0x00036EAC
private void ResolveHost()
{
this.CheckIfAborted();
this.hostEntry = this.GetServicePoint().HostEntry;
if (this.hostEntry == null)
{
this.ftpResponse.UpdateStatus(new FtpStatus(FtpStatusCode.ActionAbortedLocalProcessingError, "Cannot resolve server name"));
throw new WebException("The remote server name could not be resolved: " + this.requestUri, null, WebExceptionStatus.NameResolutionFailure, this.ftpResponse);
}
}
// Token: 0x060012DE RID: 4830 RVA: 0x00038D14 File Offset: 0x00036F14
private void ProcessRequest()
{
if (this.State == FtpWebRequest.RequestState.Scheduled)
{
this.ftpResponse = new FtpWebResponse(this, this.requestUri, this.method, this.keepAlive);
try
{
this.ProcessMethod();
this.asyncResult.SetCompleted(false, this.ftpResponse);
}
catch (Exception ex)
{
this.State = FtpWebRequest.RequestState.Error;
this.SetCompleteWithError(ex);
}
}
else
{
if (this.InProgress())
{
FtpStatus responseStatus = this.GetResponseStatus();
this.ftpResponse.UpdateStatus(responseStatus);
if (this.ftpResponse.IsFinal())
{
this.State = FtpWebRequest.RequestState.Finished;
}
}
this.asyncResult.SetCompleted(false, this.ftpResponse);
}
}
// Token: 0x060012DF RID: 4831 RVA: 0x00038DE4 File Offset: 0x00036FE4
private void SetType()
{
if (this.binary)
{
FtpStatus ftpStatus = this.SendCommand("TYPE", new string[] { this.DataType });
if (ftpStatus.StatusCode < FtpStatusCode.CommandOK || ftpStatus.StatusCode >= (FtpStatusCode)300)
{
throw this.CreateExceptionFromResponse(ftpStatus);
}
}
}
// Token: 0x060012E0 RID: 4832 RVA: 0x00038E40 File Offset: 0x00037040
private string GetRemoteFolderPath(global::System.Uri uri)
{
string text = global::System.Uri.UnescapeDataString(uri.LocalPath);
string text2;
if (this.initial_path == null || this.initial_path == "/")
{
text2 = text;
}
else
{
if (text[0] == '/')
{
text = text.Substring(1);
}
global::System.Uri uri2 = new global::System.Uri("ftp://dummy-host" + this.initial_path);
text2 = new global::System.Uri(uri2, text).LocalPath;
}
int num = text2.LastIndexOf('/');
if (num == -1)
{
return null;
}
return text2.Substring(0, num + 1);
}
// Token: 0x060012E1 RID: 4833 RVA: 0x00038ED8 File Offset: 0x000370D8
private void CWDAndSetFileName(global::System.Uri uri)
{
string remoteFolderPath = this.GetRemoteFolderPath(uri);
if (remoteFolderPath != null)
{
FtpStatus ftpStatus = this.SendCommand("CWD", new string[] { remoteFolderPath });
if (ftpStatus.StatusCode < FtpStatusCode.CommandOK || ftpStatus.StatusCode >= (FtpStatusCode)300)
{
throw this.CreateExceptionFromResponse(ftpStatus);
}
int num = uri.LocalPath.LastIndexOf('/');
if (num >= 0)
{
this.file_name = global::System.Uri.UnescapeDataString(uri.LocalPath.Substring(num + 1));
}
}
}
// Token: 0x060012E2 RID: 4834 RVA: 0x00038F60 File Offset: 0x00037160
private void ProcessMethod()
{
this.State = FtpWebRequest.RequestState.Connecting;
this.ResolveHost();
this.OpenControlConnection();
this.CWDAndSetFileName(this.requestUri);
this.SetType();
string text = this.method;
if (text != null)
{
if (FtpWebRequest.<>f__switch$map5 == null)
{
FtpWebRequest.<>f__switch$map5 = new Dictionary<string, int>(12)
{
{ "RETR", 0 },
{ "NLST", 0 },
{ "LIST", 0 },
{ "APPE", 1 },
{ "STOR", 1 },
{ "STOU", 1 },
{ "SIZE", 2 },
{ "MDTM", 2 },
{ "PWD", 2 },
{ "MKD", 2 },
{ "RENAME", 2 },
{ "DELE", 2 }
};
}
int num;
if (FtpWebRequest.<>f__switch$map5.TryGetValue(text, out num))
{
switch (num)
{
case 0:
this.DownloadData();
break;
case 1:
this.UploadData();
break;
case 2:
this.ProcessSimpleMethod();
break;
default:
goto IL_124;
}
this.CheckIfAborted();
return;
}
}
IL_124:
throw new Exception(string.Format("Support for command {0} not implemented yet", this.method));
}
// Token: 0x060012E3 RID: 4835 RVA: 0x000390B0 File Offset: 0x000372B0
private void CloseControlConnection()
{
if (this.controlStream != null)
{
this.SendCommand("QUIT", new string[0]);
this.controlStream.Close();
this.controlStream = null;
}
}
// Token: 0x060012E4 RID: 4836 RVA: 0x000390E4 File Offset: 0x000372E4
internal void CloseDataConnection()
{
if (this.origDataStream != null)
{
this.origDataStream.Close();
this.origDataStream = null;
}
}
// Token: 0x060012E5 RID: 4837 RVA: 0x00039104 File Offset: 0x00037304
private void CloseConnection()
{
this.CloseControlConnection();
this.CloseDataConnection();
}
// Token: 0x060012E6 RID: 4838 RVA: 0x00039114 File Offset: 0x00037314
private void ProcessSimpleMethod()
{
this.State = FtpWebRequest.RequestState.TransferInProgress;
if (this.method == "PWD")
{
this.method = "PWD";
}
if (this.method == "RENAME")
{
this.method = "RNFR";
}
FtpStatus ftpStatus = this.SendCommand(this.method, new string[] { this.file_name });
this.ftpResponse.Stream = Stream.Null;
string statusDescription = ftpStatus.StatusDescription;
string text = this.method;
switch (text)
{
case "SIZE":
{
if (ftpStatus.StatusCode != FtpStatusCode.FileStatus)
{
throw this.CreateExceptionFromResponse(ftpStatus);
}
int num2 = 4;
int num3 = 0;
while (num2 < statusDescription.Length && char.IsDigit(statusDescription[num2]))
{
num2++;
num3++;
}
if (num3 == 0)
{
throw new WebException("Bad format for server response in " + this.method);
}
long num4;
if (!long.TryParse(statusDescription.Substring(4, num3), out num4))
{
throw new WebException("Bad format for server response in " + this.method);
}
this.ftpResponse.contentLength = num4;
break;
}
case "MDTM":
if (ftpStatus.StatusCode != FtpStatusCode.FileStatus)
{
throw this.CreateExceptionFromResponse(ftpStatus);
}
this.ftpResponse.LastModified = DateTime.ParseExact(statusDescription.Substring(4), "yyyyMMddHHmmss", null);
break;
case "MKD":
if (ftpStatus.StatusCode != FtpStatusCode.PathnameCreated)
{
throw this.CreateExceptionFromResponse(ftpStatus);
}
break;
case "CWD":
this.method = "PWD";
if (ftpStatus.StatusCode != FtpStatusCode.FileActionOK)
{
throw this.CreateExceptionFromResponse(ftpStatus);
}
ftpStatus = this.SendCommand(this.method, new string[0]);
if (ftpStatus.StatusCode != FtpStatusCode.PathnameCreated)
{
throw this.CreateExceptionFromResponse(ftpStatus);
}
break;
case "RNFR":
this.method = "RENAME";
if (ftpStatus.StatusCode != FtpStatusCode.FileCommandPending)
{
throw this.CreateExceptionFromResponse(ftpStatus);
}
ftpStatus = this.SendCommand("RNTO", new string[] { (this.renameTo == null) ? string.Empty : this.renameTo });
if (ftpStatus.StatusCode != FtpStatusCode.FileActionOK)
{
throw this.CreateExceptionFromResponse(ftpStatus);
}
break;
case "DELE":
if (ftpStatus.StatusCode != FtpStatusCode.FileActionOK)
{
throw this.CreateExceptionFromResponse(ftpStatus);
}
break;
}
this.State = FtpWebRequest.RequestState.Finished;
}
// Token: 0x060012E7 RID: 4839 RVA: 0x00039424 File Offset: 0x00037624
private void UploadData()
{
this.State = FtpWebRequest.RequestState.OpeningData;
this.OpenDataConnection();
this.State = FtpWebRequest.RequestState.TransferInProgress;
this.requestStream = new FtpDataStream(this, this.dataStream, false);
this.asyncResult.Stream = this.requestStream;
}
// Token: 0x060012E8 RID: 4840 RVA: 0x0003946C File Offset: 0x0003766C
private void DownloadData()
{
this.State = FtpWebRequest.RequestState.OpeningData;
this.OpenDataConnection();
this.State = FtpWebRequest.RequestState.TransferInProgress;
this.ftpResponse.Stream = new FtpDataStream(this, this.dataStream, true);
}
// Token: 0x060012E9 RID: 4841 RVA: 0x000394A8 File Offset: 0x000376A8
private void CheckRequestStarted()
{
if (this.State != FtpWebRequest.RequestState.Before)
{
throw new InvalidOperationException("There is a request currently in progress");
}
}
// Token: 0x060012EA RID: 4842 RVA: 0x000394C0 File Offset: 0x000376C0
private void OpenControlConnection()
{
Exception ex = null;
global::System.Net.Sockets.Socket socket = null;
foreach (IPAddress ipaddress in this.hostEntry.AddressList)
{
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.requestUri.Port);
if (!this.ServicePoint.CallEndPointDelegate(socket, ipendPoint))
{
socket.Close();
socket = null;
}
else
{
try
{
socket.Connect(ipendPoint);
this.localEndPoint = (IPEndPoint)socket.LocalEndPoint;
break;
}
catch (global::System.Net.Sockets.SocketException ex2)
{
ex = ex2;
socket.Close();
socket = null;
}
}
}
if (socket == null)
{
throw new WebException("Unable to connect to remote server", ex, WebExceptionStatus.UnknownError, this.ftpResponse);
}
this.controlStream = new global::System.Net.Sockets.NetworkStream(socket);
this.controlReader = new StreamReader(this.controlStream, Encoding.ASCII);
this.State = FtpWebRequest.RequestState.Authenticating;
this.Authenticate();
FtpStatus ftpStatus = this.SendCommand("OPTS", new string[] { "utf8", "on" });
ftpStatus = this.SendCommand("PWD", new string[0]);
this.initial_path = FtpWebRequest.GetInitialPath(ftpStatus);
}
// Token: 0x060012EB RID: 4843 RVA: 0x00039618 File Offset: 0x00037818
private static string GetInitialPath(FtpStatus status)
{
int statusCode = (int)status.StatusCode;
if (statusCode < 200 || statusCode > 300 || status.StatusDescription.Length <= 4)
{
throw new WebException("Error getting current directory: " + status.StatusDescription, null, WebExceptionStatus.UnknownError, null);
}
string text = status.StatusDescription.Substring(4);
if (text[0] == '"')
{
int num = text.IndexOf('"', 1);
if (num == -1)
{
throw new WebException("Error getting current directory: PWD -> " + status.StatusDescription, null, WebExceptionStatus.UnknownError, null);
}
text = text.Substring(1, num - 1);
}
if (!text.EndsWith("/"))
{
text += "/";
}
return text;
}
// Token: 0x060012EC RID: 4844 RVA: 0x000396DC File Offset: 0x000378DC
private global::System.Net.Sockets.Socket SetupPassiveConnection(string statusDescription)
{
if (statusDescription.Length < 4)
{
throw new WebException("Cannot open passive data connection");
}
int num = 3;
while (num < statusDescription.Length && !char.IsDigit(statusDescription[num]))
{
num++;
}
if (num >= statusDescription.Length)
{
throw new WebException("Cannot open passive data connection");
}
string[] array = statusDescription.Substring(num).Split(new char[] { ',' }, 6);
if (array.Length != 6)
{
throw new WebException("Cannot open passive data connection");
}
int num2 = array[5].Length - 1;
while (num2 >= 0 && !char.IsDigit(array[5][num2]))
{
num2--;
}
if (num2 < 0)
{
throw new WebException("Cannot open passive data connection");
}
array[5] = array[5].Substring(0, num2 + 1);
IPAddress ipaddress;
try
{
ipaddress = IPAddress.Parse(string.Join(".", array, 0, 4));
}
catch (FormatException)
{
throw new WebException("Cannot open passive data connection");
}
int num3;
int num4;
if (!int.TryParse(array[4], out num3) || !int.TryParse(array[5], out num4))
{
throw new WebException("Cannot open passive data connection");
}
int num5 = (num3 << 8) + num4;
if (num5 < 0 || num5 > 65535)
{
throw new WebException("Cannot open passive data connection");
}
IPEndPoint ipendPoint = new IPEndPoint(ipaddress, num5);
global::System.Net.Sockets.Socket socket = new global::System.Net.Sockets.Socket(ipendPoint.AddressFamily, global::System.Net.Sockets.SocketType.Stream, global::System.Net.Sockets.ProtocolType.Tcp);
try
{
socket.Connect(ipendPoint);
}
catch (global::System.Net.Sockets.SocketException)
{
socket.Close();
throw new WebException("Cannot open passive data connection");
}
return socket;
}
// Token: 0x060012ED RID: 4845 RVA: 0x000398B0 File Offset: 0x00037AB0
private Exception CreateExceptionFromResponse(FtpStatus status)
{
FtpWebResponse ftpWebResponse = new FtpWebResponse(this, this.requestUri, this.method, status);
return new WebException("Server returned an error: " + status.StatusDescription, null, WebExceptionStatus.ProtocolError, ftpWebResponse);
}
// Token: 0x060012EE RID: 4846 RVA: 0x000398EC File Offset: 0x00037AEC
internal void SetTransferCompleted()
{
if (this.InFinalState())
{
return;
}
this.State = FtpWebRequest.RequestState.Finished;
FtpStatus responseStatus = this.GetResponseStatus();
this.ftpResponse.UpdateStatus(responseStatus);
if (!this.keepAlive)
{
this.CloseConnection();
}
}
// Token: 0x060012EF RID: 4847 RVA: 0x00039930 File Offset: 0x00037B30
internal void OperationCompleted()
{
if (!this.keepAlive)
{
this.CloseConnection();
}
}
// Token: 0x060012F0 RID: 4848 RVA: 0x00039944 File Offset: 0x00037B44
private void SetCompleteWithError(Exception exc)
{
if (this.asyncResult != null)
{
this.asyncResult.SetCompleted(false, exc);
}
}
// Token: 0x060012F1 RID: 4849 RVA: 0x00039960 File Offset: 0x00037B60
private global::System.Net.Sockets.Socket InitDataConnection()
{
if (this.usePassive)
{
FtpStatus ftpStatus = this.SendCommand("PASV", new string[0]);
if (ftpStatus.StatusCode != FtpStatusCode.EnteringPassive)
{
throw this.CreateExceptionFromResponse(ftpStatus);
}
return this.SetupPassiveConnection(ftpStatus.StatusDescription);
}
else
{
global::System.Net.Sockets.Socket socket = new global::System.Net.Sockets.Socket(global::System.Net.Sockets.AddressFamily.InterNetwork, global::System.Net.Sockets.SocketType.Stream, global::System.Net.Sockets.ProtocolType.Tcp);
try
{
socket.Bind(new IPEndPoint(this.localEndPoint.Address, 0));
socket.Listen(1);
}
catch (global::System.Net.Sockets.SocketException ex)
{
socket.Close();
throw new WebException("Couldn't open listening socket on client", ex);
}
IPEndPoint ipendPoint = (IPEndPoint)socket.LocalEndPoint;
string text = ipendPoint.Address.ToString().Replace('.', ',');
int num = ipendPoint.Port >> 8;
int num2 = ipendPoint.Port % 256;
string text2 = string.Concat(new object[] { text, ",", num, ",", num2 });
FtpStatus ftpStatus = this.SendCommand("PORT", new string[] { text2 });
if (ftpStatus.StatusCode != FtpStatusCode.CommandOK)
{
socket.Close();
throw this.CreateExceptionFromResponse(ftpStatus);
}
return socket;
}
}
// Token: 0x060012F2 RID: 4850 RVA: 0x00039AB8 File Offset: 0x00037CB8
private void OpenDataConnection()
{
global::System.Net.Sockets.Socket socket = this.InitDataConnection();
FtpStatus ftpStatus;
if (this.offset > 0L)
{
ftpStatus = this.SendCommand("REST", new string[] { this.offset.ToString() });
if (ftpStatus.StatusCode != FtpStatusCode.FileCommandPending)
{
throw this.CreateExceptionFromResponse(ftpStatus);
}
}
if (this.method != "NLST" && this.method != "LIST" && this.method != "STOU")
{
ftpStatus = this.SendCommand(this.method, new string[] { this.file_name });
}
else
{
ftpStatus = this.SendCommand(this.method, new string[0]);
}
if (ftpStatus.StatusCode != FtpStatusCode.OpeningData && ftpStatus.StatusCode != FtpStatusCode.DataAlreadyOpen)
{
throw this.CreateExceptionFromResponse(ftpStatus);
}
if (this.usePassive)
{
this.origDataStream = new global::System.Net.Sockets.NetworkStream(socket, true);
this.dataStream = this.origDataStream;
if (this.EnableSsl)
{
this.ChangeToSSLSocket(ref this.dataStream);
}
}
else
{
global::System.Net.Sockets.Socket socket2 = null;
try
{
socket2 = socket.Accept();
}
catch (global::System.Net.Sockets.SocketException)
{
socket.Close();
if (socket2 != null)
{
socket2.Close();
}
throw new ProtocolViolationException("Server commited a protocol violation.");
}
socket.Close();
this.origDataStream = new global::System.Net.Sockets.NetworkStream(socket, true);
this.dataStream = this.origDataStream;
if (this.EnableSsl)
{
this.ChangeToSSLSocket(ref this.dataStream);
}
}
this.ftpResponse.UpdateStatus(ftpStatus);
}
// Token: 0x060012F3 RID: 4851 RVA: 0x00039C7C File Offset: 0x00037E7C
private void Authenticate()
{
string text = null;
string text2 = null;
string text3 = null;
if (this.credentials != null)
{
text = this.credentials.UserName;
text2 = this.credentials.Password;
text3 = this.credentials.Domain;
}
if (text == null)
{
text = "anonymous";
}
if (text2 == null)
{
text2 = "@anonymous";
}
if (!string.IsNullOrEmpty(text3))
{
text = text3 + '\\' + text;
}
FtpStatus ftpStatus = this.GetResponseStatus();
this.ftpResponse.BannerMessage = ftpStatus.StatusDescription;
if (this.EnableSsl)
{
this.InitiateSecureConnection(ref this.controlStream);
this.controlReader = new StreamReader(this.controlStream, Encoding.ASCII);
ftpStatus = this.SendCommand("PBSZ", new string[] { "0" });
int num = (int)ftpStatus.StatusCode;
if (num < 200 || num >= 300)
{
throw this.CreateExceptionFromResponse(ftpStatus);
}
ftpStatus = this.SendCommand("PROT", new string[] { "P" });
num = (int)ftpStatus.StatusCode;
if (num < 200 || num >= 300)
{
throw this.CreateExceptionFromResponse(ftpStatus);
}
ftpStatus = new FtpStatus(FtpStatusCode.SendUserCommand, string.Empty);
}
if (ftpStatus.StatusCode != FtpStatusCode.SendUserCommand)
{
throw this.CreateExceptionFromResponse(ftpStatus);
}
ftpStatus = this.SendCommand("USER", new string[] { text });
FtpStatusCode statusCode = ftpStatus.StatusCode;
if (statusCode != FtpStatusCode.LoggedInProceed)
{
if (statusCode != FtpStatusCode.SendPasswordCommand)
{
throw this.CreateExceptionFromResponse(ftpStatus);
}
ftpStatus = this.SendCommand("PASS", new string[] { text2 });
if (ftpStatus.StatusCode != FtpStatusCode.LoggedInProceed)
{
throw this.CreateExceptionFromResponse(ftpStatus);
}
}
this.ftpResponse.WelcomeMessage = ftpStatus.StatusDescription;
this.ftpResponse.UpdateStatus(ftpStatus);
}
// Token: 0x060012F4 RID: 4852 RVA: 0x00039E7C File Offset: 0x0003807C
private FtpStatus SendCommand(string command, params string[] parameters)
{
return this.SendCommand(true, command, parameters);
}
// Token: 0x060012F5 RID: 4853 RVA: 0x00039E88 File Offset: 0x00038088
private FtpStatus SendCommand(bool waitResponse, string command, params string[] parameters)
{
string text = command;
if (parameters.Length > 0)
{
text = text + " " + string.Join(" ", parameters);
}
text += "\r\n";
byte[] bytes = Encoding.ASCII.GetBytes(text);
try
{
this.controlStream.Write(bytes, 0, bytes.Length);
}
catch (IOException)
{
return new FtpStatus(FtpStatusCode.ServiceNotAvailable, "Write failed");
}
if (!waitResponse)
{
return null;
}
FtpStatus responseStatus = this.GetResponseStatus();
if (this.ftpResponse != null)
{
this.ftpResponse.UpdateStatus(responseStatus);
}
return responseStatus;
}
// Token: 0x060012F6 RID: 4854 RVA: 0x00039F44 File Offset: 0x00038144
internal static FtpStatus ServiceNotAvailable()
{
return new FtpStatus(FtpStatusCode.ServiceNotAvailable, global::Locale.GetText("Invalid response from server"));
}
// Token: 0x060012F7 RID: 4855 RVA: 0x00039F5C File Offset: 0x0003815C
internal FtpStatus GetResponseStatus()
{
string text = null;
try
{
text = this.controlReader.ReadLine();
}
catch (IOException)
{
}
if (text == null || text.Length < 3)
{
return FtpWebRequest.ServiceNotAvailable();
}
int num;
if (!int.TryParse(text.Substring(0, 3), out num))
{
return FtpWebRequest.ServiceNotAvailable();
}
if (text.Length > 3 && text[3] == '-')
{
string text2 = null;
string text3 = num.ToString() + ' ';
for (;;)
{
text2 = null;
try
{
text2 = this.controlReader.ReadLine();
}
catch (IOException)
{
}
if (text2 == null)
{
break;
}
text = text + Environment.NewLine + text2;
if (text2.StartsWith(text3, StringComparison.Ordinal))
{
goto Block_8;
}
}
return FtpWebRequest.ServiceNotAvailable();
Block_8:;
}
return new FtpStatus((FtpStatusCode)num, text);
}
// Token: 0x060012F8 RID: 4856 RVA: 0x0003A070 File Offset: 0x00038270
private void InitiateSecureConnection(ref Stream stream)
{
FtpStatus ftpStatus = this.SendCommand("AUTH", new string[] { "TLS" });
if (ftpStatus.StatusCode != FtpStatusCode.ServerWantsSecureSession)
{
throw this.CreateExceptionFromResponse(ftpStatus);
}
this.ChangeToSSLSocket(ref stream);
}
// Token: 0x060012F9 RID: 4857 RVA: 0x0003A0B8 File Offset: 0x000382B8
internal bool ChangeToSSLSocket(ref Stream stream)
{
global::System.Net.Security.SslStream sslStream = new global::System.Net.Security.SslStream(stream, true, this.callback, null);
sslStream.AuthenticateAsClient(this.requestUri.Host, null, global::System.Security.Authentication.SslProtocols.Default, false);
stream = sslStream;
return true;
}
// Token: 0x060012FA RID: 4858 RVA: 0x0003A0F4 File Offset: 0x000382F4
private bool InFinalState()
{
return this.State == FtpWebRequest.RequestState.Aborted || this.State == FtpWebRequest.RequestState.Error || this.State == FtpWebRequest.RequestState.Finished;
}
// Token: 0x060012FB RID: 4859 RVA: 0x0003A128 File Offset: 0x00038328
private bool InProgress()
{
return this.State != FtpWebRequest.RequestState.Before && !this.InFinalState();
}
// Token: 0x060012FC RID: 4860 RVA: 0x0003A144 File Offset: 0x00038344
internal void CheckIfAborted()
{
if (this.State == FtpWebRequest.RequestState.Aborted)
{
throw new WebException("Request aborted", WebExceptionStatus.RequestCanceled);
}
}
// Token: 0x060012FD RID: 4861 RVA: 0x0003A160 File Offset: 0x00038360
private void CheckFinalState()
{
if (this.InFinalState())
{
throw new InvalidOperationException("Cannot change final state");
}
}
// Token: 0x04001008 RID: 4104
private const string ChangeDir = "CWD";
// Token: 0x04001009 RID: 4105
private const string UserCommand = "USER";
// Token: 0x0400100A RID: 4106
private const string PasswordCommand = "PASS";
// Token: 0x0400100B RID: 4107
private const string TypeCommand = "TYPE";
// Token: 0x0400100C RID: 4108
private const string PassiveCommand = "PASV";
// Token: 0x0400100D RID: 4109
private const string PortCommand = "PORT";
// Token: 0x0400100E RID: 4110
private const string AbortCommand = "ABOR";
// Token: 0x0400100F RID: 4111
private const string AuthCommand = "AUTH";
// Token: 0x04001010 RID: 4112
private const string RestCommand = "REST";
// Token: 0x04001011 RID: 4113
private const string RenameFromCommand = "RNFR";
// Token: 0x04001012 RID: 4114
private const string RenameToCommand = "RNTO";
// Token: 0x04001013 RID: 4115
private const string QuitCommand = "QUIT";
// Token: 0x04001014 RID: 4116
private const string EOL = "\r\n";
// Token: 0x04001015 RID: 4117
private global::System.Uri requestUri;
// Token: 0x04001016 RID: 4118
private string file_name;
// Token: 0x04001017 RID: 4119
private ServicePoint servicePoint;
// Token: 0x04001018 RID: 4120
private Stream origDataStream;
// Token: 0x04001019 RID: 4121
private Stream dataStream;
// Token: 0x0400101A RID: 4122
private Stream controlStream;
// Token: 0x0400101B RID: 4123
private StreamReader controlReader;
// Token: 0x0400101C RID: 4124
private NetworkCredential credentials;
// Token: 0x0400101D RID: 4125
private IPHostEntry hostEntry;
// Token: 0x0400101E RID: 4126
private IPEndPoint localEndPoint;
// Token: 0x0400101F RID: 4127
private IWebProxy proxy;
// Token: 0x04001020 RID: 4128
private int timeout = 100000;
// Token: 0x04001021 RID: 4129
private int rwTimeout = 300000;
// Token: 0x04001022 RID: 4130
private long offset;
// Token: 0x04001023 RID: 4131
private bool binary = true;
// Token: 0x04001024 RID: 4132
private bool enableSsl;
// Token: 0x04001025 RID: 4133
private bool usePassive = true;
// Token: 0x04001026 RID: 4134
private bool keepAlive;
// Token: 0x04001027 RID: 4135
private string method = "RETR";
// Token: 0x04001028 RID: 4136
private string renameTo;
// Token: 0x04001029 RID: 4137
private object locker = new object();
// Token: 0x0400102A RID: 4138
private FtpWebRequest.RequestState requestState;
// Token: 0x0400102B RID: 4139
private FtpAsyncResult asyncResult;
// Token: 0x0400102C RID: 4140
private FtpWebResponse ftpResponse;
// Token: 0x0400102D RID: 4141
private Stream requestStream;
// Token: 0x0400102E RID: 4142
private string initial_path;
// Token: 0x0400102F RID: 4143
private static readonly string[] supportedCommands = new string[]
{
"APPE", "DELE", "LIST", "MDTM", "MKD", "NLST", "PWD", "RENAME", "RETR", "RMD",
"SIZE", "STOR", "STOU"
};
// Token: 0x04001030 RID: 4144
private global::System.Net.Security.RemoteCertificateValidationCallback callback = delegate(object sender, X509Certificate certificate, global::System.Security.Cryptography.X509Certificates.X509Chain chain, global::System.Net.Security.SslPolicyErrors sslPolicyErrors)
{
if (ServicePointManager.ServerCertificateValidationCallback != null)
{
return ServicePointManager.ServerCertificateValidationCallback(sender, certificate, chain, sslPolicyErrors);
}
if (sslPolicyErrors != global::System.Net.Security.SslPolicyErrors.None)
{
throw new InvalidOperationException("SSL authentication error: " + sslPolicyErrors);
}
return true;
};
// Token: 0x02000223 RID: 547
private enum RequestState
{
// Token: 0x04001035 RID: 4149
Before,
// Token: 0x04001036 RID: 4150
Scheduled,
// Token: 0x04001037 RID: 4151
Connecting,
// Token: 0x04001038 RID: 4152
Authenticating,
// Token: 0x04001039 RID: 4153
OpeningData,
// Token: 0x0400103A RID: 4154
TransferInProgress,
// Token: 0x0400103B RID: 4155
Finished,
// Token: 0x0400103C RID: 4156
Aborted,
// Token: 0x0400103D RID: 4157
Error
}
}
}
+295
View File
@@ -0,0 +1,295 @@
using System;
using System.IO;
namespace System.Net
{
/// <summary>Encapsulates a File Transfer Protocol (FTP) server's response to a request.</summary>
// Token: 0x02000224 RID: 548
public class FtpWebResponse : WebResponse
{
// Token: 0x060012FF RID: 4863 RVA: 0x0003A1BC File Offset: 0x000383BC
internal FtpWebResponse(FtpWebRequest request, global::System.Uri uri, string method, bool keepAlive)
{
this.request = request;
this.uri = uri;
this.method = method;
}
// Token: 0x06001300 RID: 4864 RVA: 0x0003A218 File Offset: 0x00038418
internal FtpWebResponse(FtpWebRequest request, global::System.Uri uri, string method, FtpStatusCode statusCode, string statusDescription)
{
this.request = request;
this.uri = uri;
this.method = method;
this.statusCode = statusCode;
this.statusDescription = statusDescription;
}
// Token: 0x06001301 RID: 4865 RVA: 0x0003A284 File Offset: 0x00038484
internal FtpWebResponse(FtpWebRequest request, global::System.Uri uri, string method, FtpStatus status)
: this(request, uri, method, status.StatusCode, status.StatusDescription)
{
}
/// <summary>Gets the length of the data received from the FTP server.</summary>
/// <returns>An <see cref="T:System.Int64" /> value that contains the number of bytes of data received from the FTP server. </returns>
// Token: 0x17000626 RID: 1574
// (get) Token: 0x06001302 RID: 4866 RVA: 0x0003A2A8 File Offset: 0x000384A8
public override long ContentLength
{
get
{
return this.contentLength;
}
}
/// <summary>Gets an empty <see cref="T:System.Net.WebHeaderCollection" /> object.</summary>
/// <returns>An empty <see cref="T:System.Net.WebHeaderCollection" /> object.</returns>
// Token: 0x17000627 RID: 1575
// (get) Token: 0x06001303 RID: 4867 RVA: 0x0003A2B0 File Offset: 0x000384B0
public override WebHeaderCollection Headers
{
get
{
return new WebHeaderCollection();
}
}
/// <summary>Gets the URI that sent the response to the request.</summary>
/// <returns>A <see cref="T:System.Uri" /> instance that identifies the resource associated with this response.</returns>
// Token: 0x17000628 RID: 1576
// (get) Token: 0x06001304 RID: 4868 RVA: 0x0003A2B8 File Offset: 0x000384B8
public override global::System.Uri ResponseUri
{
get
{
return this.uri;
}
}
/// <summary>Gets the date and time that a file on an FTP server was last modified.</summary>
/// <returns>A <see cref="T:System.DateTime" /> that contains the last modified date and time for a file.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x17000629 RID: 1577
// (get) Token: 0x06001305 RID: 4869 RVA: 0x0003A2C0 File Offset: 0x000384C0
// (set) Token: 0x06001306 RID: 4870 RVA: 0x0003A2C8 File Offset: 0x000384C8
public DateTime LastModified
{
get
{
return this.lastModified;
}
internal set
{
this.lastModified = value;
}
}
/// <summary>Gets the message sent by the FTP server when a connection is established prior to logon.</summary>
/// <returns>A <see cref="T:System.String" /> that contains the banner message sent by the server; otherwise, <see cref="F:System.String.Empty" /> if no message is sent.</returns>
// Token: 0x1700062A RID: 1578
// (get) Token: 0x06001307 RID: 4871 RVA: 0x0003A2D4 File Offset: 0x000384D4
// (set) Token: 0x06001308 RID: 4872 RVA: 0x0003A2DC File Offset: 0x000384DC
public string BannerMessage
{
get
{
return this.bannerMessage;
}
internal set
{
this.bannerMessage = value;
}
}
/// <summary>Gets the message sent by the FTP server when authentication is complete.</summary>
/// <returns>A <see cref="T:System.String" /> that contains the welcome message sent by the server; otherwise, <see cref="F:System.String.Empty" /> if no message is sent.</returns>
// Token: 0x1700062B RID: 1579
// (get) Token: 0x06001309 RID: 4873 RVA: 0x0003A2E8 File Offset: 0x000384E8
// (set) Token: 0x0600130A RID: 4874 RVA: 0x0003A2F0 File Offset: 0x000384F0
public string WelcomeMessage
{
get
{
return this.welcomeMessage;
}
internal set
{
this.welcomeMessage = value;
}
}
/// <summary>Gets the message sent by the server when the FTP session is ending.</summary>
/// <returns>A <see cref="T:System.String" /> that contains the exit message sent by the server; otherwise, <see cref="F:System.String.Empty" /> if no message is sent.</returns>
// Token: 0x1700062C RID: 1580
// (get) Token: 0x0600130B RID: 4875 RVA: 0x0003A2FC File Offset: 0x000384FC
// (set) Token: 0x0600130C RID: 4876 RVA: 0x0003A304 File Offset: 0x00038504
public string ExitMessage
{
get
{
return this.exitMessage;
}
internal set
{
this.exitMessage = value;
}
}
/// <summary>Gets the most recent status code sent from the FTP server.</summary>
/// <returns>An <see cref="T:System.Net.FtpStatusCode" /> value that indicates the most recent status code returned with this response.</returns>
// Token: 0x1700062D RID: 1581
// (get) Token: 0x0600130D RID: 4877 RVA: 0x0003A310 File Offset: 0x00038510
// (set) Token: 0x0600130E RID: 4878 RVA: 0x0003A318 File Offset: 0x00038518
public FtpStatusCode StatusCode
{
get
{
return this.statusCode;
}
private set
{
this.statusCode = value;
}
}
/// <summary>Gets text that describes a status code sent from the FTP server.</summary>
/// <returns>A <see cref="T:System.String" /> instance that contains the status code and message returned with this response.</returns>
// Token: 0x1700062E RID: 1582
// (get) Token: 0x0600130F RID: 4879 RVA: 0x0003A324 File Offset: 0x00038524
// (set) Token: 0x06001310 RID: 4880 RVA: 0x0003A32C File Offset: 0x0003852C
public string StatusDescription
{
get
{
return this.statusDescription;
}
private set
{
this.statusDescription = value;
}
}
/// <summary>Frees the resources held by the response.</summary>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06001311 RID: 4881 RVA: 0x0003A338 File Offset: 0x00038538
public override void Close()
{
if (this.disposed)
{
return;
}
this.disposed = true;
if (this.stream != null)
{
this.stream.Close();
if (this.stream == Stream.Null)
{
this.request.OperationCompleted();
}
}
this.stream = null;
}
/// <summary>Retrieves the stream that contains response data sent from an FTP server.</summary>
/// <returns>A readable <see cref="T:System.IO.Stream" /> instance that contains data returned with the response; otherwise, <see cref="F:System.IO.Stream.Null" /> if no response data was returned by the server.</returns>
/// <exception cref="T:System.InvalidOperationException">The response did not return a data stream. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06001312 RID: 4882 RVA: 0x0003A390 File Offset: 0x00038590
public override Stream GetResponseStream()
{
if (this.stream == null)
{
return Stream.Null;
}
if (this.method != "RETR" && this.method != "NLST")
{
this.CheckDisposed();
}
return this.stream;
}
// Token: 0x1700062F RID: 1583
// (get) Token: 0x06001314 RID: 4884 RVA: 0x0003A3F0 File Offset: 0x000385F0
// (set) Token: 0x06001313 RID: 4883 RVA: 0x0003A3E4 File Offset: 0x000385E4
internal Stream Stream
{
get
{
return this.stream;
}
set
{
this.stream = value;
}
}
// Token: 0x06001315 RID: 4885 RVA: 0x0003A3F8 File Offset: 0x000385F8
internal void UpdateStatus(FtpStatus status)
{
this.statusCode = status.StatusCode;
this.statusDescription = status.StatusDescription;
}
// Token: 0x06001316 RID: 4886 RVA: 0x0003A414 File Offset: 0x00038614
private void CheckDisposed()
{
if (this.disposed)
{
throw new ObjectDisposedException(base.GetType().FullName);
}
}
// Token: 0x06001317 RID: 4887 RVA: 0x0003A434 File Offset: 0x00038634
internal bool IsFinal()
{
return this.statusCode >= FtpStatusCode.CommandOK;
}
// Token: 0x0400103E RID: 4158
private Stream stream;
// Token: 0x0400103F RID: 4159
private global::System.Uri uri;
// Token: 0x04001040 RID: 4160
private FtpStatusCode statusCode;
// Token: 0x04001041 RID: 4161
private DateTime lastModified = DateTime.MinValue;
// Token: 0x04001042 RID: 4162
private string bannerMessage = string.Empty;
// Token: 0x04001043 RID: 4163
private string welcomeMessage = string.Empty;
// Token: 0x04001044 RID: 4164
private string exitMessage = string.Empty;
// Token: 0x04001045 RID: 4165
private string statusDescription;
// Token: 0x04001046 RID: 4166
private string method;
// Token: 0x04001047 RID: 4167
private bool disposed;
// Token: 0x04001048 RID: 4168
private FtpWebRequest request;
// Token: 0x04001049 RID: 4169
internal long contentLength = -1L;
}
}
+76
View File
@@ -0,0 +1,76 @@
using System;
namespace System.Net
{
/// <summary>Contains a global default proxy instance for all HTTP requests.</summary>
// Token: 0x02000225 RID: 549
[Obsolete("Use WebRequest.DefaultProxy instead")]
public class GlobalProxySelection
{
/// <summary>Gets or sets the global HTTP proxy.</summary>
/// <returns>An <see cref="T:System.Net.IWebProxy" /> that every call to <see cref="M:System.Net.HttpWebRequest.GetResponse" /> uses.</returns>
/// <exception cref="T:System.ArgumentNullException">The value specified for a set operation was null. </exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have permission for the requested operation. </exception>
// Token: 0x17000630 RID: 1584
// (get) Token: 0x06001319 RID: 4889 RVA: 0x0003A450 File Offset: 0x00038650
// (set) Token: 0x0600131A RID: 4890 RVA: 0x0003A458 File Offset: 0x00038658
public static IWebProxy Select
{
get
{
return WebRequest.DefaultWebProxy;
}
set
{
WebRequest.DefaultWebProxy = value;
}
}
/// <summary>Returns an empty proxy instance.</summary>
/// <returns>An <see cref="T:System.Net.IWebProxy" /> that contains no information.</returns>
// Token: 0x0600131B RID: 4891 RVA: 0x0003A460 File Offset: 0x00038660
public static IWebProxy GetEmptyWebProxy()
{
return new GlobalProxySelection.EmptyWebProxy();
}
// Token: 0x02000226 RID: 550
internal class EmptyWebProxy : IWebProxy
{
// Token: 0x0600131C RID: 4892 RVA: 0x0003A468 File Offset: 0x00038668
internal EmptyWebProxy()
{
}
// Token: 0x17000631 RID: 1585
// (get) Token: 0x0600131D RID: 4893 RVA: 0x0003A470 File Offset: 0x00038670
// (set) Token: 0x0600131E RID: 4894 RVA: 0x0003A478 File Offset: 0x00038678
public ICredentials Credentials
{
get
{
return this.credentials;
}
set
{
this.credentials = value;
}
}
// Token: 0x0600131F RID: 4895 RVA: 0x0003A484 File Offset: 0x00038684
public global::System.Uri GetProxy(global::System.Uri destination)
{
return destination;
}
// Token: 0x06001320 RID: 4896 RVA: 0x0003A488 File Offset: 0x00038688
public bool IsBypassed(global::System.Uri host)
{
return true;
}
// Token: 0x0400104A RID: 4170
private ICredentials credentials;
}
}
}
+545
View File
@@ -0,0 +1,545 @@
using System;
using System.IO;
using System.Net.Sockets;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using Mono.Security.Protocol.Tls;
namespace System.Net
{
// Token: 0x02000227 RID: 551
internal sealed class HttpConnection
{
// Token: 0x06001321 RID: 4897 RVA: 0x0003A48C File Offset: 0x0003868C
public HttpConnection(global::System.Net.Sockets.Socket sock, EndPointListener epl, bool secure, global::System.Security.Cryptography.X509Certificates.X509Certificate2 cert, AsymmetricAlgorithm key)
{
this.sock = sock;
this.epl = epl;
this.secure = secure;
this.key = key;
if (!secure)
{
this.stream = new global::System.Net.Sockets.NetworkStream(sock, false);
}
else
{
SslServerStream sslServerStream = new SslServerStream(new global::System.Net.Sockets.NetworkStream(sock, false), cert, false, false);
SslServerStream sslServerStream2 = sslServerStream;
sslServerStream2.PrivateKeyCertSelectionDelegate = (PrivateKeySelectionCallback)Delegate.Combine(sslServerStream2.PrivateKeyCertSelectionDelegate, new PrivateKeySelectionCallback(this.OnPVKSelection));
this.stream = sslServerStream;
}
this.Init();
}
// Token: 0x06001322 RID: 4898 RVA: 0x0003A514 File Offset: 0x00038714
private AsymmetricAlgorithm OnPVKSelection(X509Certificate certificate, string targetHost)
{
return this.key;
}
// Token: 0x06001323 RID: 4899 RVA: 0x0003A51C File Offset: 0x0003871C
private void Init()
{
this.context_bound = false;
this.i_stream = null;
this.o_stream = null;
this.prefix = null;
this.chunked = false;
this.ms = new MemoryStream();
this.position = 0;
this.input_state = HttpConnection.InputState.RequestLine;
this.line_state = HttpConnection.LineState.None;
this.context = new HttpListenerContext(this);
}
// Token: 0x17000632 RID: 1586
// (get) Token: 0x06001324 RID: 4900 RVA: 0x0003A578 File Offset: 0x00038778
public int ChunkedUses
{
get
{
return this.chunked_uses;
}
}
// Token: 0x17000633 RID: 1587
// (get) Token: 0x06001325 RID: 4901 RVA: 0x0003A580 File Offset: 0x00038780
public IPEndPoint LocalEndPoint
{
get
{
return (IPEndPoint)this.sock.LocalEndPoint;
}
}
// Token: 0x17000634 RID: 1588
// (get) Token: 0x06001326 RID: 4902 RVA: 0x0003A594 File Offset: 0x00038794
public IPEndPoint RemoteEndPoint
{
get
{
return (IPEndPoint)this.sock.RemoteEndPoint;
}
}
// Token: 0x17000635 RID: 1589
// (get) Token: 0x06001327 RID: 4903 RVA: 0x0003A5A8 File Offset: 0x000387A8
public bool IsSecure
{
get
{
return this.secure;
}
}
// Token: 0x17000636 RID: 1590
// (get) Token: 0x06001328 RID: 4904 RVA: 0x0003A5B0 File Offset: 0x000387B0
// (set) Token: 0x06001329 RID: 4905 RVA: 0x0003A5B8 File Offset: 0x000387B8
public ListenerPrefix Prefix
{
get
{
return this.prefix;
}
set
{
this.prefix = value;
}
}
// Token: 0x0600132A RID: 4906 RVA: 0x0003A5C4 File Offset: 0x000387C4
public void BeginReadRequest()
{
if (this.buffer == null)
{
this.buffer = new byte[8192];
}
try
{
this.stream.BeginRead(this.buffer, 0, 8192, new AsyncCallback(this.OnRead), this);
}
catch
{
this.CloseSocket();
}
}
// Token: 0x0600132B RID: 4907 RVA: 0x0003A640 File Offset: 0x00038840
public RequestStream GetRequestStream(bool chunked, long contentlength)
{
if (this.i_stream == null)
{
byte[] array = this.ms.GetBuffer();
int num = (int)this.ms.Length;
this.ms = null;
if (chunked)
{
this.chunked = true;
this.context.Response.SendChunked = true;
this.i_stream = new ChunkedInputStream(this.context, this.stream, array, this.position, num - this.position);
}
else
{
this.i_stream = new RequestStream(this.stream, array, this.position, num - this.position, contentlength);
}
}
return this.i_stream;
}
// Token: 0x0600132C RID: 4908 RVA: 0x0003A6E8 File Offset: 0x000388E8
public ResponseStream GetResponseStream()
{
if (this.o_stream == null)
{
HttpListener listener = this.context.Listener;
bool flag = listener == null || listener.IgnoreWriteExceptions;
this.o_stream = new ResponseStream(this.stream, this.context.Response, flag);
}
return this.o_stream;
}
// Token: 0x0600132D RID: 4909 RVA: 0x0003A744 File Offset: 0x00038944
private void OnRead(IAsyncResult ares)
{
HttpConnection httpConnection = (HttpConnection)ares.AsyncState;
int num = -1;
try
{
num = this.stream.EndRead(ares);
this.ms.Write(this.buffer, 0, num);
if (this.ms.Length > 32768L)
{
this.SendError("Bad request", 400);
this.Close(true);
return;
}
}
catch
{
if (this.ms != null && this.ms.Length > 0L)
{
this.SendError();
}
if (this.sock != null)
{
this.CloseSocket();
}
return;
}
if (num == 0)
{
this.CloseSocket();
return;
}
if (this.ProcessInput(this.ms))
{
if (!this.context.HaveError)
{
this.context.Request.FinishInitialization();
}
if (this.context.HaveError)
{
this.SendError();
this.Close(true);
return;
}
if (!this.epl.BindContext(this.context))
{
this.SendError("Invalid host", 400);
this.Close(true);
}
this.context_bound = true;
return;
}
else
{
this.stream.BeginRead(this.buffer, 0, 8192, new AsyncCallback(this.OnRead), httpConnection);
}
}
// Token: 0x0600132E RID: 4910 RVA: 0x0003A8C8 File Offset: 0x00038AC8
private bool ProcessInput(MemoryStream ms)
{
byte[] array = ms.GetBuffer();
int num = (int)ms.Length;
int num2 = 0;
string text;
try
{
text = this.ReadLine(array, this.position, num - this.position, ref num2);
this.position += num2;
}
catch (Exception ex)
{
this.context.ErrorMessage = "Bad request";
this.context.ErrorStatus = 400;
return true;
}
while (text != null)
{
if (text == string.Empty)
{
if (this.input_state != HttpConnection.InputState.RequestLine)
{
this.current_line = null;
ms = null;
return true;
}
}
else
{
if (this.input_state == HttpConnection.InputState.RequestLine)
{
this.context.Request.SetRequestLine(text);
this.input_state = HttpConnection.InputState.Headers;
}
else
{
try
{
this.context.Request.AddHeader(text);
}
catch (Exception ex2)
{
this.context.ErrorMessage = ex2.Message;
this.context.ErrorStatus = 400;
return true;
}
}
if (this.context.HaveError)
{
return true;
}
if (this.position >= num)
{
break;
}
try
{
text = this.ReadLine(array, this.position, num - this.position, ref num2);
this.position += num2;
}
catch (Exception ex3)
{
this.context.ErrorMessage = "Bad request";
this.context.ErrorStatus = 400;
return true;
}
}
if (text != null)
{
continue;
}
IL_194:
if (num2 == num)
{
ms.SetLength(0L);
this.position = 0;
}
return false;
}
goto IL_194;
}
// Token: 0x0600132F RID: 4911 RVA: 0x0003AAD0 File Offset: 0x00038CD0
private string ReadLine(byte[] buffer, int offset, int len, ref int used)
{
if (this.current_line == null)
{
this.current_line = new StringBuilder();
}
int num = offset + len;
used = 0;
int num2 = offset;
while (num2 < num && this.line_state != HttpConnection.LineState.LF)
{
used++;
byte b = buffer[num2];
if (b == 13)
{
this.line_state = HttpConnection.LineState.CR;
}
else if (b == 10)
{
this.line_state = HttpConnection.LineState.LF;
}
else
{
this.current_line.Append((char)b);
}
num2++;
}
string text = null;
if (this.line_state == HttpConnection.LineState.LF)
{
this.line_state = HttpConnection.LineState.None;
text = this.current_line.ToString();
this.current_line.Length = 0;
}
return text;
}
// Token: 0x06001330 RID: 4912 RVA: 0x0003AB8C File Offset: 0x00038D8C
public void SendError(string msg, int status)
{
try
{
HttpListenerResponse response = this.context.Response;
response.StatusCode = status;
response.ContentType = "text/html";
string statusDescription = HttpListenerResponse.GetStatusDescription(status);
string text;
if (msg != null)
{
text = string.Format("<h1>{0} ({1})</h1>", statusDescription, msg);
}
else
{
text = string.Format("<h1>{0}</h1>", statusDescription);
}
byte[] bytes = this.context.Response.ContentEncoding.GetBytes(text);
response.Close(bytes, false);
}
catch
{
}
}
// Token: 0x06001331 RID: 4913 RVA: 0x0003AC28 File Offset: 0x00038E28
public void SendError()
{
this.SendError(this.context.ErrorMessage, this.context.ErrorStatus);
}
// Token: 0x06001332 RID: 4914 RVA: 0x0003AC48 File Offset: 0x00038E48
private void Unbind()
{
if (this.context_bound)
{
this.epl.UnbindContext(this.context);
this.context_bound = false;
}
}
// Token: 0x06001333 RID: 4915 RVA: 0x0003AC70 File Offset: 0x00038E70
public void Close()
{
this.Close(false);
}
// Token: 0x06001334 RID: 4916 RVA: 0x0003AC7C File Offset: 0x00038E7C
private void CloseSocket()
{
if (this.sock == null)
{
return;
}
try
{
this.sock.Close();
}
catch
{
}
finally
{
this.sock = null;
}
}
// Token: 0x06001335 RID: 4917 RVA: 0x0003ACE8 File Offset: 0x00038EE8
internal void Close(bool force_close)
{
if (this.sock != null)
{
Stream responseStream = this.GetResponseStream();
responseStream.Close();
this.o_stream = null;
}
if (this.sock == null)
{
return;
}
force_close |= this.context.Request.Headers["connection"] == "close";
if (!force_close)
{
int statusCode = this.context.Response.StatusCode;
bool flag = statusCode == 400 || statusCode == 408 || statusCode == 411 || statusCode == 413 || statusCode == 414 || statusCode == 500 || statusCode == 503;
force_close |= this.context.Request.ProtocolVersion <= HttpVersion.Version10;
}
if (force_close || !this.context.Request.FlushInput())
{
global::System.Net.Sockets.Socket socket = this.sock;
this.sock = null;
try
{
if (socket != null)
{
socket.Shutdown(global::System.Net.Sockets.SocketShutdown.Both);
}
}
catch
{
}
finally
{
if (socket != null)
{
socket.Close();
}
}
this.Unbind();
return;
}
if (this.chunked && !this.context.Response.ForceCloseChunked)
{
this.chunked_uses++;
this.Unbind();
this.Init();
this.BeginReadRequest();
return;
}
this.Unbind();
this.Init();
this.BeginReadRequest();
}
// Token: 0x0400104B RID: 4171
private const int BufferSize = 8192;
// Token: 0x0400104C RID: 4172
private global::System.Net.Sockets.Socket sock;
// Token: 0x0400104D RID: 4173
private Stream stream;
// Token: 0x0400104E RID: 4174
private EndPointListener epl;
// Token: 0x0400104F RID: 4175
private MemoryStream ms;
// Token: 0x04001050 RID: 4176
private byte[] buffer;
// Token: 0x04001051 RID: 4177
private HttpListenerContext context;
// Token: 0x04001052 RID: 4178
private StringBuilder current_line;
// Token: 0x04001053 RID: 4179
private ListenerPrefix prefix;
// Token: 0x04001054 RID: 4180
private RequestStream i_stream;
// Token: 0x04001055 RID: 4181
private ResponseStream o_stream;
// Token: 0x04001056 RID: 4182
private bool chunked;
// Token: 0x04001057 RID: 4183
private int chunked_uses;
// Token: 0x04001058 RID: 4184
private bool context_bound;
// Token: 0x04001059 RID: 4185
private bool secure;
// Token: 0x0400105A RID: 4186
private AsymmetricAlgorithm key;
// Token: 0x0400105B RID: 4187
private HttpConnection.InputState input_state;
// Token: 0x0400105C RID: 4188
private HttpConnection.LineState line_state;
// Token: 0x0400105D RID: 4189
private int position;
// Token: 0x02000228 RID: 552
private enum InputState
{
// Token: 0x0400105F RID: 4191
RequestLine,
// Token: 0x04001060 RID: 4192
Headers
}
// Token: 0x02000229 RID: 553
private enum LineState
{
// Token: 0x04001062 RID: 4194
None,
// Token: 0x04001063 RID: 4195
CR,
// Token: 0x04001064 RID: 4196
LF
}
}
}
+11
View File
@@ -0,0 +1,11 @@
using System;
namespace System.Net
{
/// <summary>Represents the method that notifies callers when a continue response is received by the client.</summary>
/// <param name="StatusCode">The numeric value of the HTTP status from the server. </param>
/// <param name="httpHeaders">The headers returned with the 100-continue response from the server. </param>
// Token: 0x02000338 RID: 824
// (Invoke) Token: 0x06001CB9 RID: 7353
public delegate void HttpContinueDelegate(int StatusCode, WebHeaderCollection httpHeaders);
}
+503
View File
@@ -0,0 +1,503 @@
using System;
using System.Collections;
using System.Threading;
namespace System.Net
{
/// <summary>Provides a simple, programmatically controlled HTTP protocol listener. This class cannot be inherited.</summary>
// Token: 0x0200022A RID: 554
public sealed class HttpListener : IDisposable
{
/// <summary>Initializes a new instance of the <see cref="T:System.Net.HttpListener" /> class.</summary>
/// <exception cref="T:System.PlatformNotSupportedException">This class cannot be used on the current operating system. Windows Server 2003 or Windows XP SP2 is required to use instances of this class.</exception>
// Token: 0x06001336 RID: 4918 RVA: 0x0003AEA8 File Offset: 0x000390A8
public HttpListener()
{
this.prefixes = new HttpListenerPrefixCollection(this);
this.registry = new Hashtable();
this.ctx_queue = new ArrayList();
this.wait_queue = new ArrayList();
this.auth_schemes = AuthenticationSchemes.Anonymous;
}
/// <summary>Releases the resources held by this <see cref="T:System.Net.HttpListener" /> object.</summary>
// Token: 0x06001337 RID: 4919 RVA: 0x0003AEF4 File Offset: 0x000390F4
void IDisposable.Dispose()
{
if (this.disposed)
{
return;
}
this.Close(true);
this.disposed = true;
}
/// <summary>Gets or sets the scheme used to authenticate clients.</summary>
/// <returns>A bitwise combination of <see cref="T:System.Net.AuthenticationSchemes" /> enumeration values that indicates how clients are to be authenticated. The default value is <see cref="F:System.Net.AuthenticationSchemes.Anonymous" />.</returns>
/// <exception cref="T:System.ObjectDisposedException">This object has been closed.</exception>
// Token: 0x17000637 RID: 1591
// (get) Token: 0x06001338 RID: 4920 RVA: 0x0003AF10 File Offset: 0x00039110
// (set) Token: 0x06001339 RID: 4921 RVA: 0x0003AF18 File Offset: 0x00039118
public AuthenticationSchemes AuthenticationSchemes
{
get
{
return this.auth_schemes;
}
set
{
this.CheckDisposed();
this.auth_schemes = value;
}
}
/// <summary>Gets or sets the delegate called to determine the protocol used to authenticate clients.</summary>
/// <returns>An <see cref="T:System.Net.AuthenticationSchemeSelector" /> delegate that invokes the method used to select an authentication protocol. The default value is null.</returns>
/// <exception cref="T:System.ObjectDisposedException">This object has been closed.</exception>
// Token: 0x17000638 RID: 1592
// (get) Token: 0x0600133A RID: 4922 RVA: 0x0003AF28 File Offset: 0x00039128
// (set) Token: 0x0600133B RID: 4923 RVA: 0x0003AF30 File Offset: 0x00039130
public AuthenticationSchemeSelector AuthenticationSchemeSelectorDelegate
{
get
{
return this.auth_selector;
}
set
{
this.CheckDisposed();
this.auth_selector = value;
}
}
/// <summary>Gets or sets a <see cref="T:System.Boolean" /> value that specifies whether your application receives exceptions that occur when an <see cref="T:System.Net.HttpListener" /> sends the response to the client.</summary>
/// <returns>true if this <see cref="T:System.Net.HttpListener" /> should not return exceptions that occur when sending the response to the client; otherwise false. The default value is false.</returns>
/// <exception cref="T:System.ObjectDisposedException">This object has been closed.</exception>
// Token: 0x17000639 RID: 1593
// (get) Token: 0x0600133C RID: 4924 RVA: 0x0003AF40 File Offset: 0x00039140
// (set) Token: 0x0600133D RID: 4925 RVA: 0x0003AF48 File Offset: 0x00039148
public bool IgnoreWriteExceptions
{
get
{
return this.ignore_write_exceptions;
}
set
{
this.CheckDisposed();
this.ignore_write_exceptions = value;
}
}
/// <summary>Gets a value that indicates whether <see cref="T:System.Net.HttpListener" /> has been started.</summary>
/// <returns>true if the <see cref="T:System.Net.HttpListener" /> was started; otherwise, false.</returns>
// Token: 0x1700063A RID: 1594
// (get) Token: 0x0600133E RID: 4926 RVA: 0x0003AF58 File Offset: 0x00039158
public bool IsListening
{
get
{
return this.listening;
}
}
/// <summary>Gets a value that indicates whether <see cref="T:System.Net.HttpListener" /> can be used with the current operating system.</summary>
/// <returns>true if <see cref="T:System.Net.HttpListener" /> is supported; otherwise, false.</returns>
// Token: 0x1700063B RID: 1595
// (get) Token: 0x0600133F RID: 4927 RVA: 0x0003AF60 File Offset: 0x00039160
public static bool IsSupported
{
get
{
return true;
}
}
/// <summary>Gets the Uniform Resource Identifier (URI) prefixes handled by this <see cref="T:System.Net.HttpListener" /> object.</summary>
/// <returns>An <see cref="T:System.Net.HttpListenerPrefixCollection" /> that contains the URI prefixes that this <see cref="T:System.Net.HttpListener" /> object is configured to handle. </returns>
/// <exception cref="T:System.ObjectDisposedException">This object has been closed.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x1700063C RID: 1596
// (get) Token: 0x06001340 RID: 4928 RVA: 0x0003AF64 File Offset: 0x00039164
public HttpListenerPrefixCollection Prefixes
{
get
{
this.CheckDisposed();
return this.prefixes;
}
}
/// <summary>Gets or sets the realm, or resource partition, associated with this <see cref="T:System.Net.HttpListener" /> object.</summary>
/// <returns>A <see cref="T:System.String" /> value that contains the name of the realm associated with the <see cref="T:System.Net.HttpListener" /> object.</returns>
/// <exception cref="T:System.ObjectDisposedException">This object has been closed.</exception>
// Token: 0x1700063D RID: 1597
// (get) Token: 0x06001341 RID: 4929 RVA: 0x0003AF74 File Offset: 0x00039174
// (set) Token: 0x06001342 RID: 4930 RVA: 0x0003AF7C File Offset: 0x0003917C
public string Realm
{
get
{
return this.realm;
}
set
{
this.CheckDisposed();
this.realm = value;
}
}
/// <summary>Gets or sets a <see cref="T:System.Boolean" /> value that controls whether, when NTLM is used, additional requests using the same Transmission Control Protocol (TCP) connection are required to authenticate.</summary>
/// <returns>true if the <see cref="T:System.Security.Principal.IIdentity" /> of the first request will be used for subsequent requests on the same connection; otherwise, false. The default value is false.</returns>
/// <exception cref="T:System.ObjectDisposedException">This object has been closed.</exception>
// Token: 0x1700063E RID: 1598
// (get) Token: 0x06001343 RID: 4931 RVA: 0x0003AF8C File Offset: 0x0003918C
// (set) Token: 0x06001344 RID: 4932 RVA: 0x0003AF94 File Offset: 0x00039194
[global::System.MonoTODO("Support for NTLM needs some loving.")]
public bool UnsafeConnectionNtlmAuthentication
{
get
{
return this.unsafe_ntlm_auth;
}
set
{
this.CheckDisposed();
this.unsafe_ntlm_auth = value;
}
}
/// <summary>Shuts down the <see cref="T:System.Net.HttpListener" /> object immediately, discarding all currently queued requests.</summary>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06001345 RID: 4933 RVA: 0x0003AFA4 File Offset: 0x000391A4
public void Abort()
{
if (this.disposed)
{
return;
}
if (!this.listening)
{
return;
}
this.Close(true);
}
/// <summary>Shuts down the <see cref="T:System.Net.HttpListener" /> after processing all currently queued requests.</summary>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06001346 RID: 4934 RVA: 0x0003AFC8 File Offset: 0x000391C8
public void Close()
{
if (this.disposed)
{
return;
}
if (!this.listening)
{
this.disposed = true;
return;
}
this.Close(false);
this.disposed = true;
}
// Token: 0x06001347 RID: 4935 RVA: 0x0003AFF8 File Offset: 0x000391F8
private void Close(bool force)
{
this.CheckDisposed();
EndPointManager.RemoveListener(this);
this.Cleanup(force);
}
// Token: 0x06001348 RID: 4936 RVA: 0x0003B010 File Offset: 0x00039210
private void Cleanup(bool close_existing)
{
Hashtable hashtable = this.registry;
lock (hashtable)
{
if (close_existing)
{
foreach (object obj in this.registry.Keys)
{
HttpListenerContext httpListenerContext = (HttpListenerContext)obj;
httpListenerContext.Connection.Close();
}
this.registry.Clear();
}
ArrayList arrayList = this.ctx_queue;
lock (arrayList)
{
foreach (object obj2 in this.ctx_queue)
{
HttpListenerContext httpListenerContext2 = (HttpListenerContext)obj2;
httpListenerContext2.Connection.Close();
}
this.ctx_queue.Clear();
}
ArrayList arrayList2 = this.wait_queue;
lock (arrayList2)
{
foreach (object obj3 in this.wait_queue)
{
ListenerAsyncResult listenerAsyncResult = (ListenerAsyncResult)obj3;
listenerAsyncResult.Complete("Listener was closed.");
}
this.wait_queue.Clear();
}
}
}
/// <summary>Begins asynchronously retrieving an incoming request.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> object that indicates the status of the asynchronous operation.</returns>
/// <param name="callback">An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when a client request is available.</param>
/// <param name="state">A user-defined object that contains information about the operation. This object is passed to the <paramref name="callback" /> delegate when the operation completes.</param>
/// <exception cref="T:System.Net.HttpListenerException">A Win32 function call failed. Check the exception's <see cref="P:System.Net.HttpListenerException.ErrorCode" /> property to determine the cause of the exception.</exception>
/// <exception cref="T:System.InvalidOperationException">This object has not been started or is currently stopped.</exception>
/// <exception cref="T:System.ObjectDisposedException">This object is closed.</exception>
// Token: 0x06001349 RID: 4937 RVA: 0x0003B220 File Offset: 0x00039420
public IAsyncResult BeginGetContext(AsyncCallback callback, object state)
{
this.CheckDisposed();
if (!this.listening)
{
throw new InvalidOperationException("Please, call Start before using this method.");
}
ListenerAsyncResult listenerAsyncResult = new ListenerAsyncResult(callback, state);
ArrayList arrayList = this.wait_queue;
lock (arrayList)
{
ArrayList arrayList2 = this.ctx_queue;
lock (arrayList2)
{
HttpListenerContext contextFromQueue = this.GetContextFromQueue();
if (contextFromQueue != null)
{
listenerAsyncResult.Complete(contextFromQueue, true);
return listenerAsyncResult;
}
}
this.wait_queue.Add(listenerAsyncResult);
}
return listenerAsyncResult;
}
/// <summary>Completes an asynchronous operation to retrieve an incoming client request.</summary>
/// <returns>An <see cref="T:System.Net.HttpListenerContext" /> object that represents the client request.</returns>
/// <param name="asyncResult">An <see cref="T:System.IAsyncResult" /> object that was obtained when the asynchronous operation was started.</param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="asyncResult" /> was not obtained by calling the <see cref="M:System.Net.HttpListener.BeginGetContext(System.AsyncCallback,System.Object)" /> method.</exception>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The <see cref="M:System.Net.HttpListener.EndGetContext(System.IAsyncResult)" /> method was already called for the specified <paramref name="asyncResult" /> object.</exception>
/// <exception cref="T:System.ObjectDisposedException">This object is closed.</exception>
// Token: 0x0600134A RID: 4938 RVA: 0x0003B2E8 File Offset: 0x000394E8
public HttpListenerContext EndGetContext(IAsyncResult asyncResult)
{
this.CheckDisposed();
if (asyncResult == null)
{
throw new ArgumentNullException("asyncResult");
}
ListenerAsyncResult listenerAsyncResult = asyncResult as ListenerAsyncResult;
if (listenerAsyncResult == null)
{
throw new ArgumentException("Wrong IAsyncResult.", "asyncResult");
}
if (!listenerAsyncResult.IsCompleted)
{
listenerAsyncResult.AsyncWaitHandle.WaitOne();
}
ArrayList arrayList = this.wait_queue;
lock (arrayList)
{
int num = this.wait_queue.IndexOf(listenerAsyncResult);
if (num >= 0)
{
this.wait_queue.RemoveAt(num);
}
}
HttpListenerContext context = listenerAsyncResult.GetContext();
if (this.auth_schemes != AuthenticationSchemes.Anonymous)
{
context.ParseAuthentication(this.auth_schemes);
}
return context;
}
// Token: 0x0600134B RID: 4939 RVA: 0x0003B3BC File Offset: 0x000395BC
internal AuthenticationSchemes SelectAuthenticationScheme(HttpListenerContext context)
{
if (this.AuthenticationSchemeSelectorDelegate != null)
{
return this.AuthenticationSchemeSelectorDelegate(context.Request);
}
return this.auth_schemes;
}
/// <summary>Waits for an incoming request and returns when one is received.</summary>
/// <returns>An <see cref="T:System.Net.HttpListenerContext" /> object that represents a client request.</returns>
/// <exception cref="T:System.Net.HttpListenerException">A Win32 function call failed. Check the exception's <see cref="P:System.Net.HttpListenerException.ErrorCode" /> property to determine the cause of the exception.</exception>
/// <exception cref="T:System.InvalidOperationException">This object has not been started or is currently stopped.-or-The <see cref="T:System.Net.HttpListener" /> does not have any Uniform Resource Identifier (URI) prefixes to respond to. See Remarks.</exception>
/// <exception cref="T:System.ObjectDisposedException">This object is closed.</exception>
// Token: 0x0600134C RID: 4940 RVA: 0x0003B3EC File Offset: 0x000395EC
public HttpListenerContext GetContext()
{
if (this.prefixes.Count == 0)
{
throw new InvalidOperationException("Please, call AddPrefix before using this method.");
}
IAsyncResult asyncResult = this.BeginGetContext(null, null);
return this.EndGetContext(asyncResult);
}
/// <summary>Allows this instance to receive incoming requests.</summary>
/// <exception cref="T:System.Net.HttpListenerException">A Win32 function call failed. Check the exception's <see cref="P:System.Net.HttpListenerException.ErrorCode" /> property to determine the cause of the exception.</exception>
/// <exception cref="T:System.ObjectDisposedException">This object is closed.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x0600134D RID: 4941 RVA: 0x0003B424 File Offset: 0x00039624
public void Start()
{
this.CheckDisposed();
if (this.listening)
{
return;
}
EndPointManager.AddListener(this);
this.listening = true;
}
/// <summary>Causes this instance to stop receiving incoming requests.</summary>
/// <exception cref="T:System.ObjectDisposedException">This object has been closed.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x0600134E RID: 4942 RVA: 0x0003B448 File Offset: 0x00039648
public void Stop()
{
this.CheckDisposed();
this.listening = false;
this.Close(false);
}
// Token: 0x0600134F RID: 4943 RVA: 0x0003B460 File Offset: 0x00039660
internal void CheckDisposed()
{
if (this.disposed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
}
// Token: 0x06001350 RID: 4944 RVA: 0x0003B480 File Offset: 0x00039680
private HttpListenerContext GetContextFromQueue()
{
if (this.ctx_queue.Count == 0)
{
return null;
}
HttpListenerContext httpListenerContext = (HttpListenerContext)this.ctx_queue[0];
this.ctx_queue.RemoveAt(0);
return httpListenerContext;
}
// Token: 0x06001351 RID: 4945 RVA: 0x0003B4C0 File Offset: 0x000396C0
internal void RegisterContext(HttpListenerContext context)
{
try
{
Monitor.Enter(this.registry);
this.registry[context] = context;
Monitor.Enter(this.wait_queue);
Monitor.Enter(this.ctx_queue);
if (this.wait_queue.Count == 0)
{
this.ctx_queue.Add(context);
}
else
{
ListenerAsyncResult listenerAsyncResult = (ListenerAsyncResult)this.wait_queue[0];
this.wait_queue.RemoveAt(0);
listenerAsyncResult.Complete(context);
}
}
finally
{
Monitor.Exit(this.ctx_queue);
Monitor.Exit(this.wait_queue);
Monitor.Exit(this.registry);
}
}
// Token: 0x06001352 RID: 4946 RVA: 0x0003B588 File Offset: 0x00039788
internal void UnregisterContext(HttpListenerContext context)
{
try
{
Monitor.Enter(this.registry);
Monitor.Enter(this.ctx_queue);
int num = this.ctx_queue.IndexOf(context);
if (num >= 0)
{
this.ctx_queue.RemoveAt(num);
}
this.registry.Remove(context);
}
finally
{
Monitor.Exit(this.ctx_queue);
Monitor.Exit(this.registry);
}
}
// Token: 0x04001065 RID: 4197
private AuthenticationSchemes auth_schemes;
// Token: 0x04001066 RID: 4198
private HttpListenerPrefixCollection prefixes;
// Token: 0x04001067 RID: 4199
private AuthenticationSchemeSelector auth_selector;
// Token: 0x04001068 RID: 4200
private string realm;
// Token: 0x04001069 RID: 4201
private bool ignore_write_exceptions;
// Token: 0x0400106A RID: 4202
private bool unsafe_ntlm_auth;
// Token: 0x0400106B RID: 4203
private bool listening;
// Token: 0x0400106C RID: 4204
private bool disposed;
// Token: 0x0400106D RID: 4205
private Hashtable registry;
// Token: 0x0400106E RID: 4206
private ArrayList ctx_queue;
// Token: 0x0400106F RID: 4207
private ArrayList wait_queue;
}
}
+35
View File
@@ -0,0 +1,35 @@
using System;
using System.Security.Principal;
namespace System.Net
{
/// <summary>Holds the user name and password from a basic authentication request.</summary>
// Token: 0x0200022B RID: 555
public class HttpListenerBasicIdentity : GenericIdentity
{
/// <summary>Initializes a new instance of the <see cref="T:System.Net.HttpListenerBasicIdentity" /> class using the specified user name and password.</summary>
/// <param name="username">The user name.</param>
/// <param name="password">The password.</param>
// Token: 0x06001353 RID: 4947 RVA: 0x0003B610 File Offset: 0x00039810
public HttpListenerBasicIdentity(string username, string password)
: base(username, "Basic")
{
this.password = password;
}
/// <summary>Indicates the password from a basic authentication attempt.</summary>
/// <returns>A <see cref="T:System.String" /> that holds the password.</returns>
// Token: 0x1700063F RID: 1599
// (get) Token: 0x06001354 RID: 4948 RVA: 0x0003B628 File Offset: 0x00039828
public virtual string Password
{
get
{
return this.password;
}
}
// Token: 0x04001070 RID: 4208
private string password;
}
}
+175
View File
@@ -0,0 +1,175 @@
using System;
using System.Security.Principal;
using System.Text;
namespace System.Net
{
/// <summary>Provides access to the request and response objects used by the <see cref="T:System.Net.HttpListener" /> class. This class cannot be inherited.</summary>
// Token: 0x0200022C RID: 556
public sealed class HttpListenerContext
{
// Token: 0x06001355 RID: 4949 RVA: 0x0003B630 File Offset: 0x00039830
internal HttpListenerContext(HttpConnection cnc)
{
this.cnc = cnc;
this.request = new HttpListenerRequest(this);
this.response = new HttpListenerResponse(this);
}
// Token: 0x17000640 RID: 1600
// (get) Token: 0x06001356 RID: 4950 RVA: 0x0003B670 File Offset: 0x00039870
// (set) Token: 0x06001357 RID: 4951 RVA: 0x0003B678 File Offset: 0x00039878
internal int ErrorStatus
{
get
{
return this.err_status;
}
set
{
this.err_status = value;
}
}
// Token: 0x17000641 RID: 1601
// (get) Token: 0x06001358 RID: 4952 RVA: 0x0003B684 File Offset: 0x00039884
// (set) Token: 0x06001359 RID: 4953 RVA: 0x0003B68C File Offset: 0x0003988C
internal string ErrorMessage
{
get
{
return this.error;
}
set
{
this.error = value;
}
}
// Token: 0x17000642 RID: 1602
// (get) Token: 0x0600135A RID: 4954 RVA: 0x0003B698 File Offset: 0x00039898
internal bool HaveError
{
get
{
return this.error != null;
}
}
// Token: 0x17000643 RID: 1603
// (get) Token: 0x0600135B RID: 4955 RVA: 0x0003B6A8 File Offset: 0x000398A8
internal HttpConnection Connection
{
get
{
return this.cnc;
}
}
/// <summary>Gets the <see cref="T:System.Net.HttpListenerRequest" /> that represents a client's request for a resource.</summary>
/// <returns>An <see cref="T:System.Net.HttpListenerRequest" /> object that represents the client request.</returns>
// Token: 0x17000644 RID: 1604
// (get) Token: 0x0600135C RID: 4956 RVA: 0x0003B6B0 File Offset: 0x000398B0
public HttpListenerRequest Request
{
get
{
return this.request;
}
}
/// <summary>Gets the <see cref="T:System.Net.HttpListenerResponse" /> object that will be sent to the client in response to the client's request. </summary>
/// <returns>An <see cref="T:System.Net.HttpListenerResponse" /> object used to send a response back to the client.</returns>
// Token: 0x17000645 RID: 1605
// (get) Token: 0x0600135D RID: 4957 RVA: 0x0003B6B8 File Offset: 0x000398B8
public HttpListenerResponse Response
{
get
{
return this.response;
}
}
/// <summary>Gets an object used to obtain identity, authentication information, and security roles for the client whose request is represented by this <see cref="T:System.Net.HttpListenerContext" /> object. </summary>
/// <returns>An <see cref="T:System.Security.Principal.IPrincipal" /> object that describes the client, or null if the <see cref="T:System.Net.HttpListener" /> that supplied this <see cref="T:System.Net.HttpListenerContext" /> does not require authentication.</returns>
// Token: 0x17000646 RID: 1606
// (get) Token: 0x0600135E RID: 4958 RVA: 0x0003B6C0 File Offset: 0x000398C0
public IPrincipal User
{
get
{
return this.user;
}
}
// Token: 0x0600135F RID: 4959 RVA: 0x0003B6C8 File Offset: 0x000398C8
internal void ParseAuthentication(AuthenticationSchemes expectedSchemes)
{
if (expectedSchemes == AuthenticationSchemes.Anonymous)
{
return;
}
string text = this.request.Headers["Authorization"];
if (text == null || text.Length < 2)
{
return;
}
string[] array = text.Split(new char[] { ' ' }, 2);
if (string.Compare(array[0], "basic", true) == 0)
{
this.user = this.ParseBasicAuthentication(array[1]);
}
}
// Token: 0x06001360 RID: 4960 RVA: 0x0003B740 File Offset: 0x00039940
internal IPrincipal ParseBasicAuthentication(string authData)
{
IPrincipal principal;
try
{
string text = Encoding.Default.GetString(Convert.FromBase64String(authData));
int num = text.IndexOf(':');
string text2 = text.Substring(num + 1);
text = text.Substring(0, num);
num = text.IndexOf('\\');
string text3;
if (num > 0)
{
text3 = text.Substring(num);
}
else
{
text3 = text;
}
HttpListenerBasicIdentity httpListenerBasicIdentity = new HttpListenerBasicIdentity(text3, text2);
principal = new GenericPrincipal(httpListenerBasicIdentity, new string[0]);
}
catch (Exception)
{
principal = null;
}
return principal;
}
// Token: 0x04001071 RID: 4209
private HttpListenerRequest request;
// Token: 0x04001072 RID: 4210
private HttpListenerResponse response;
// Token: 0x04001073 RID: 4211
private IPrincipal user;
// Token: 0x04001074 RID: 4212
private HttpConnection cnc;
// Token: 0x04001075 RID: 4213
private string error;
// Token: 0x04001076 RID: 4214
private int err_status = 400;
// Token: 0x04001077 RID: 4215
internal HttpListener Listener;
}
}
+56
View File
@@ -0,0 +1,56 @@
using System;
using System.ComponentModel;
using System.Runtime.Serialization;
namespace System.Net
{
/// <summary>The exception that is thrown when an error occurs processing an HTTP request.</summary>
// Token: 0x0200022D RID: 557
[Serializable]
public class HttpListenerException : global::System.ComponentModel.Win32Exception
{
/// <summary>Initializes a new instance of the <see cref="T:System.Net.HttpListenerException" /> class. </summary>
// Token: 0x06001361 RID: 4961 RVA: 0x0003B7F0 File Offset: 0x000399F0
public HttpListenerException()
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.HttpListenerException" /> class using the specified error code.</summary>
/// <param name="errorCode">A <see cref="T:System.Int32" /> value that identifies the error that occurred.</param>
// Token: 0x06001362 RID: 4962 RVA: 0x0003B7F8 File Offset: 0x000399F8
public HttpListenerException(int errorCode)
: base(errorCode)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.HttpListenerException" /> class using the specified error code and message.</summary>
/// <param name="errorCode">A <see cref="T:System.Int32" /> value that identifies the error that occurred.</param>
/// <param name="message">A <see cref="T:System.String" /> that describes the error that occurred.</param>
// Token: 0x06001363 RID: 4963 RVA: 0x0003B804 File Offset: 0x00039A04
public HttpListenerException(int errorCode, string message)
: base(errorCode, message)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.HttpListenerException" /> class from the specified instances of the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> and <see cref="T:System.Runtime.Serialization.StreamingContext" /> classes.</summary>
/// <param name="serializationInfo">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object that contains the information required to deserialize the new <see cref="T:System.Net.HttpListenerException" /> object. </param>
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> object. </param>
// Token: 0x06001364 RID: 4964 RVA: 0x0003B810 File Offset: 0x00039A10
protected HttpListenerException(SerializationInfo serializationInfo, StreamingContext streamingContext)
: base(serializationInfo, streamingContext)
{
}
/// <summary>Gets a value that identifies the error that occurred.</summary>
/// <returns>A <see cref="T:System.Int32" /> value.</returns>
// Token: 0x17000647 RID: 1607
// (get) Token: 0x06001365 RID: 4965 RVA: 0x0003B81C File Offset: 0x00039A1C
public override int ErrorCode
{
get
{
return base.ErrorCode;
}
}
}
}
+194
View File
@@ -0,0 +1,194 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace System.Net
{
/// <summary>Represents the collection used to store Uniform Resource Identifier (URI) prefixes for <see cref="T:System.Net.HttpListener" /> objects.</summary>
// Token: 0x0200022E RID: 558
public class HttpListenerPrefixCollection : IEnumerable, ICollection<string>, IEnumerable<string>
{
// Token: 0x06001366 RID: 4966 RVA: 0x0003B824 File Offset: 0x00039A24
internal HttpListenerPrefixCollection(HttpListener listener)
{
this.listener = listener;
}
/// <summary>Returns an object that can be used to iterate through the collection.</summary>
/// <returns>An object that implements the <see cref="T:System.Collections.IEnumerator" /> interface and provides access to the strings in this collection.</returns>
// Token: 0x06001367 RID: 4967 RVA: 0x0003B840 File Offset: 0x00039A40
IEnumerator IEnumerable.GetEnumerator()
{
return this.prefixes.GetEnumerator();
}
/// <summary>Gets the number of prefixes contained in the collection.</summary>
/// <returns>An <see cref="T:System.Int32" /> that contains the number of prefixes in this collection. </returns>
// Token: 0x17000648 RID: 1608
// (get) Token: 0x06001368 RID: 4968 RVA: 0x0003B854 File Offset: 0x00039A54
public int Count
{
get
{
return this.prefixes.Count;
}
}
/// <summary>Gets a value that indicates whether access to the collection is read-only.</summary>
/// <returns>Always returns false.</returns>
// Token: 0x17000649 RID: 1609
// (get) Token: 0x06001369 RID: 4969 RVA: 0x0003B864 File Offset: 0x00039A64
public bool IsReadOnly
{
get
{
return false;
}
}
/// <summary>Gets a value that indicates whether access to the collection is synchronized (thread-safe).</summary>
/// <returns>This property always returns false.</returns>
// Token: 0x1700064A RID: 1610
// (get) Token: 0x0600136A RID: 4970 RVA: 0x0003B868 File Offset: 0x00039A68
public bool IsSynchronized
{
get
{
return false;
}
}
/// <summary>Adds a Uniform Resource Identifier (URI) prefix to the collection.</summary>
/// <param name="uriPrefix">A <see cref="T:System.String" /> that identifies the URI information that is compared in incoming requests. The prefix must be terminated with a forward slash ("/").</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="uriPrefix" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="uriPrefix" /> does not use the http:// or https:// scheme. These are the only schemes supported for <see cref="T:System.Net.HttpListener" /> objects. -or-<paramref name="uriPrefix" /> is not a correctly formatted URI prefix. Make sure the string is terminated with a "/".</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.HttpListener" /> associated with this collection is closed.</exception>
/// <exception cref="T:System.Net.HttpListenerException">A Windows function call failed. Check the exception's <see cref="P:System.Net.HttpListenerException.ErrorCode" /> property to determine the cause of the exception. This exception is thrown if another <see cref="T:System.Net.HttpListener" /> has already added the prefix <paramref name="uriPrefix" />.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Net.WebPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x0600136B RID: 4971 RVA: 0x0003B86C File Offset: 0x00039A6C
public void Add(string uriPrefix)
{
this.listener.CheckDisposed();
ListenerPrefix.CheckUri(uriPrefix);
if (this.prefixes.Contains(uriPrefix))
{
return;
}
this.prefixes.Add(uriPrefix);
if (this.listener.IsListening)
{
EndPointManager.AddPrefix(uriPrefix, this.listener);
}
}
/// <summary>Removes all the Uniform Resource Identifier (URI) prefixes from the collection.</summary>
/// <exception cref="T:System.Net.HttpListenerException">A Windows function call failed. Check the exception's <see cref="P:System.Net.HttpListenerException.ErrorCode" /> property to determine the cause of the exception.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.HttpListener" /> associated with this collection is closed.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x0600136C RID: 4972 RVA: 0x0003B8C4 File Offset: 0x00039AC4
public void Clear()
{
this.listener.CheckDisposed();
this.prefixes.Clear();
if (this.listener.IsListening)
{
EndPointManager.RemoveListener(this.listener);
}
}
/// <summary>Returns a <see cref="T:System.Boolean" /> value that indicates whether the specified prefix is contained in the collection.</summary>
/// <returns>true if this collection contains the prefix specified by <paramref name="uriPrefix" />; otherwise, false.</returns>
/// <param name="uriPrefix">A <see cref="T:System.String" /> that contains the Uniform Resource Identifier (URI) prefix to test.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="uriPrefix" /> is null.</exception>
// Token: 0x0600136D RID: 4973 RVA: 0x0003B8F8 File Offset: 0x00039AF8
public bool Contains(string uriPrefix)
{
this.listener.CheckDisposed();
return this.prefixes.Contains(uriPrefix);
}
/// <summary>Copies the contents of an <see cref="T:System.Net.HttpListenerPrefixCollection" /> to the specified string array. </summary>
/// <param name="array">The one dimensional string array that receives the Uniform Resource Identifier (URI) prefix strings in this collection.</param>
/// <param name="offset">The zero-based index in <paramref name="array" /> at which copying begins.</param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="array" /> has more than one dimension.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">This collection contains more elements than can be stored in <paramref name="array" /> starting at <paramref name="offset" />.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.HttpListener" /> associated with this collection is closed.</exception>
// Token: 0x0600136E RID: 4974 RVA: 0x0003B914 File Offset: 0x00039B14
public void CopyTo(string[] array, int offset)
{
this.listener.CheckDisposed();
this.prefixes.CopyTo(array, offset);
}
/// <summary>Copies the contents of an <see cref="T:System.Net.HttpListenerPrefixCollection" /> to the specified array. </summary>
/// <param name="array">The one dimensional <see cref="T:System.Array" /> that receives the Uniform Resource Identifier (URI) prefix strings in this collection.</param>
/// <param name="offset">The zero-based index in <paramref name="array" /> at which copying begins.</param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="array" /> has more than one dimension.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">This collection contains more elements than can be stored in <paramref name="array" /> starting at <paramref name="offset" />.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.HttpListener" /> associated with this collection is closed.</exception>
/// <exception cref="T:System.InvalidCastException">
/// <paramref name="array" /> cannot store string values.</exception>
// Token: 0x0600136F RID: 4975 RVA: 0x0003B930 File Offset: 0x00039B30
public void CopyTo(Array array, int offset)
{
this.listener.CheckDisposed();
((ICollection)this.prefixes).CopyTo(array, offset);
}
/// <summary>Returns an object that can be used to iterate through the collection.</summary>
/// <returns>An object that implements the <see cref="T:System.Collections.IEnumerator" /> interface and provides access to the strings in this collection.</returns>
// Token: 0x06001370 RID: 4976 RVA: 0x0003B94C File Offset: 0x00039B4C
public IEnumerator<string> GetEnumerator()
{
return this.prefixes.GetEnumerator();
}
/// <summary>Removes the specified Uniform Resource Identifier (URI) from the list of prefixes handled by the <see cref="T:System.Net.HttpListener" /> object.</summary>
/// <returns>true if the <paramref name="uriPrefix" /> was found in the <see cref="T:System.Net.HttpListenerPrefixCollection" /> and removed; otherwise false.</returns>
/// <param name="uriPrefix">A <see cref="T:System.String" /> that contains the URI prefix to remove.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="uriPrefix" /> is null.</exception>
/// <exception cref="T:System.Net.HttpListenerException">A Windows function call failed. To determine the cause of the exception, check the exception's error code.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.HttpListener" /> associated with this collection is closed.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06001371 RID: 4977 RVA: 0x0003B960 File Offset: 0x00039B60
public bool Remove(string uriPrefix)
{
this.listener.CheckDisposed();
if (uriPrefix == null)
{
throw new ArgumentNullException("uriPrefix");
}
bool flag = this.prefixes.Remove(uriPrefix);
if (flag && this.listener.IsListening)
{
EndPointManager.RemovePrefix(uriPrefix, this.listener);
}
return flag;
}
// Token: 0x04001078 RID: 4216
private List<string> prefixes = new List<string>();
// Token: 0x04001079 RID: 4217
private HttpListener listener;
}
}
+760
View File
@@ -0,0 +1,760 @@
using System;
using System.Collections.Specialized;
using System.Globalization;
using System.IO;
using System.Security.Cryptography.X509Certificates;
using System.Text;
namespace System.Net
{
/// <summary>Describes an incoming HTTP request to an <see cref="T:System.Net.HttpListener" /> object. This class cannot be inherited.</summary>
// Token: 0x0200022F RID: 559
public sealed class HttpListenerRequest
{
// Token: 0x06001372 RID: 4978 RVA: 0x0003B9BC File Offset: 0x00039BBC
internal HttpListenerRequest(HttpListenerContext context)
{
this.context = context;
this.headers = new WebHeaderCollection();
this.input_stream = Stream.Null;
this.version = HttpVersion.Version10;
}
// Token: 0x06001374 RID: 4980 RVA: 0x0003BA4C File Offset: 0x00039C4C
internal void SetRequestLine(string req)
{
string[] array = req.Split(HttpListenerRequest.separators, 3);
if (array.Length != 3)
{
this.context.ErrorMessage = "Invalid request line (parts).";
return;
}
this.method = array[0];
foreach (char c in this.method)
{
int num = (int)c;
if ((num < 65 || num > 90) && (num <= 32 || c >= '\u007f' || c == '(' || c == ')' || c == '<' || c == '<' || c == '>' || c == '@' || c == ',' || c == ';' || c == ':' || c == '\\' || c == '"' || c == '/' || c == '[' || c == ']' || c == '?' || c == '=' || c == '{' || c == '}'))
{
this.context.ErrorMessage = "(Invalid verb)";
return;
}
}
this.raw_url = array[1];
if (array[2].Length != 8 || !array[2].StartsWith("HTTP/"))
{
this.context.ErrorMessage = "Invalid request line (version).";
return;
}
try
{
this.version = new Version(array[2].Substring(5));
if (this.version.Major < 1)
{
throw new Exception();
}
}
catch
{
this.context.ErrorMessage = "Invalid request line (version).";
}
}
// Token: 0x06001375 RID: 4981 RVA: 0x0003BC1C File Offset: 0x00039E1C
private void CreateQueryString(string query)
{
this.query_string = new global::System.Collections.Specialized.NameValueCollection();
if (query == null || query.Length == 0)
{
return;
}
if (query[0] == '?')
{
query = query.Substring(1);
}
string[] array = query.Split(new char[] { '&' });
foreach (string text in array)
{
int num = text.IndexOf('=');
if (num == -1)
{
this.query_string.Add(null, HttpUtility.UrlDecode(text));
}
else
{
string text2 = HttpUtility.UrlDecode(text.Substring(0, num));
string text3 = HttpUtility.UrlDecode(text.Substring(num + 1));
this.query_string.Add(text2, text3);
}
}
}
// Token: 0x06001376 RID: 4982 RVA: 0x0003BCE4 File Offset: 0x00039EE4
internal void FinishInitialization()
{
string text = this.UserHostName;
if (this.version > HttpVersion.Version10 && (text == null || text.Length == 0))
{
this.context.ErrorMessage = "Invalid host name";
return;
}
global::System.Uri uri;
string pathAndQuery;
if (global::System.Uri.MaybeUri(this.raw_url) && global::System.Uri.TryCreate(this.raw_url, global::System.UriKind.Absolute, out uri))
{
pathAndQuery = uri.PathAndQuery;
}
else
{
pathAndQuery = this.raw_url;
}
if (text == null || text.Length == 0)
{
text = this.UserHostAddress;
}
if (uri != null)
{
text = uri.Host;
}
int num = text.IndexOf(':');
if (num >= 0)
{
text = text.Substring(0, num);
}
string text2 = string.Format("{0}://{1}:{2}", (!this.IsSecureConnection) ? "http" : "https", text, this.LocalEndPoint.Port);
if (!global::System.Uri.TryCreate(text2 + pathAndQuery, global::System.UriKind.Absolute, out this.url))
{
this.context.ErrorMessage = "Invalid url: " + text2 + pathAndQuery;
return;
}
this.CreateQueryString(this.url.Query);
string text3 = null;
if (this.version >= HttpVersion.Version11)
{
text3 = this.Headers["Transfer-Encoding"];
if (text3 != null && text3 != "chunked")
{
this.context.Connection.SendError(null, 501);
return;
}
}
this.is_chunked = text3 == "chunked";
foreach (string text4 in HttpListenerRequest.no_body_methods)
{
if (string.Compare(this.method, text4, StringComparison.InvariantCultureIgnoreCase) == 0)
{
return;
}
}
if (!this.is_chunked && !this.cl_set)
{
this.context.Connection.SendError(null, 411);
return;
}
if (this.is_chunked || this.content_length > 0L)
{
this.input_stream = this.context.Connection.GetRequestStream(this.is_chunked, this.content_length);
}
if (this.Headers["Expect"] == "100-continue")
{
ResponseStream responseStream = this.context.Connection.GetResponseStream();
responseStream.InternalWrite(HttpListenerRequest._100continue, 0, HttpListenerRequest._100continue.Length);
}
}
// Token: 0x06001377 RID: 4983 RVA: 0x0003BF78 File Offset: 0x0003A178
internal static string Unquote(string str)
{
int num = str.IndexOf('"');
int num2 = str.LastIndexOf('"');
if (num >= 0 && num2 >= 0)
{
str = str.Substring(num + 1, num2 - 1);
}
return str.Trim();
}
// Token: 0x06001378 RID: 4984 RVA: 0x0003BFBC File Offset: 0x0003A1BC
internal void AddHeader(string header)
{
int num = header.IndexOf(':');
if (num == -1 || num == 0)
{
this.context.ErrorMessage = "Bad Request";
this.context.ErrorStatus = 400;
return;
}
string text = header.Substring(0, num).Trim();
string text2 = header.Substring(num + 1).Trim();
string text3 = text.ToLower(CultureInfo.InvariantCulture);
this.headers.SetInternal(text, text2);
string text4 = text3;
switch (text4)
{
case "accept-language":
this.user_languages = text2.Split(new char[] { ',' });
break;
case "accept":
this.accept_types = text2.Split(new char[] { ',' });
break;
case "content-length":
try
{
this.content_length = long.Parse(text2.Trim());
if (this.content_length < 0L)
{
this.context.ErrorMessage = "Invalid Content-Length.";
}
this.cl_set = true;
}
catch
{
this.context.ErrorMessage = "Invalid Content-Length.";
}
break;
case "referer":
try
{
this.referrer = new global::System.Uri(text2);
}
catch
{
this.referrer = new global::System.Uri("http://someone.is.screwing.with.the.headers.com/");
}
break;
case "cookie":
{
if (this.cookies == null)
{
this.cookies = new CookieCollection();
}
string[] array = text2.Split(new char[] { ',', ';' });
Cookie cookie = null;
int num3 = 0;
foreach (string text5 in array)
{
string text6 = text5.Trim();
if (text6.Length != 0)
{
if (text6.StartsWith("$Version"))
{
num3 = int.Parse(HttpListenerRequest.Unquote(text6.Substring(text6.IndexOf("=") + 1)));
}
else if (text6.StartsWith("$Path"))
{
if (cookie != null)
{
cookie.Path = text6.Substring(text6.IndexOf("=") + 1).Trim();
}
}
else if (text6.StartsWith("$Domain"))
{
if (cookie != null)
{
cookie.Domain = text6.Substring(text6.IndexOf("=") + 1).Trim();
}
}
else if (text6.StartsWith("$Port"))
{
if (cookie != null)
{
cookie.Port = text6.Substring(text6.IndexOf("=") + 1).Trim();
}
}
else
{
if (cookie != null)
{
this.cookies.Add(cookie);
}
cookie = new Cookie();
int num4 = text6.IndexOf("=");
if (num4 > 0)
{
cookie.Name = text6.Substring(0, num4).Trim();
cookie.Value = text6.Substring(num4 + 1).Trim();
}
else
{
cookie.Name = text6.Trim();
cookie.Value = string.Empty;
}
cookie.Version = num3;
}
}
}
if (cookie != null)
{
this.cookies.Add(cookie);
}
break;
}
}
}
// Token: 0x06001379 RID: 4985 RVA: 0x0003C3BC File Offset: 0x0003A5BC
internal bool FlushInput()
{
if (!this.HasEntityBody)
{
return true;
}
int num = 2048;
if (this.content_length > 0L)
{
num = (int)Math.Min(this.content_length, (long)num);
}
byte[] array = new byte[num];
bool flag;
for (;;)
{
try
{
if (this.InputStream.Read(array, 0, num) <= 0)
{
flag = true;
break;
}
}
catch
{
flag = false;
break;
}
}
return flag;
}
/// <summary>Gets the MIME types accepted by the client. </summary>
/// <returns>A <see cref="T:System.String" /> array that contains the type names specified in the request's Accept header or null if the client request did not include an Accept header.</returns>
// Token: 0x1700064B RID: 1611
// (get) Token: 0x0600137A RID: 4986 RVA: 0x0003C450 File Offset: 0x0003A650
public string[] AcceptTypes
{
get
{
return this.accept_types;
}
}
/// <summary>Gets an error code that identifies a problem with the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> provided by the client.</summary>
/// <returns>An <see cref="T:System.Int32" /> value that contains a Windows error code.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.KeyContainerPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Create" />
/// </PermissionSet>
// Token: 0x1700064C RID: 1612
// (get) Token: 0x0600137B RID: 4987 RVA: 0x0003C458 File Offset: 0x0003A658
[global::System.MonoTODO("Always returns 0")]
public int ClientCertificateError
{
get
{
return 0;
}
}
/// <summary>Gets the content encoding that can be used with data sent with the request</summary>
/// <returns>An <see cref="T:System.Text.Encoding" /> object suitable for use with the data in the <see cref="P:System.Net.HttpListenerRequest.InputStream" /> property.</returns>
// Token: 0x1700064D RID: 1613
// (get) Token: 0x0600137C RID: 4988 RVA: 0x0003C45C File Offset: 0x0003A65C
public Encoding ContentEncoding
{
get
{
if (this.content_encoding == null)
{
this.content_encoding = Encoding.Default;
}
return this.content_encoding;
}
}
/// <summary>Gets the length of the body data included in the request.</summary>
/// <returns>The value from the request's Content-Length header. This value is -1 if the content length is not known.</returns>
// Token: 0x1700064E RID: 1614
// (get) Token: 0x0600137D RID: 4989 RVA: 0x0003C47C File Offset: 0x0003A67C
public long ContentLength64
{
get
{
return this.content_length;
}
}
/// <summary>Gets the MIME type of the body data included in the request.</summary>
/// <returns>A <see cref="T:System.String" /> that contains the text of the request's Content-Type header.</returns>
// Token: 0x1700064F RID: 1615
// (get) Token: 0x0600137E RID: 4990 RVA: 0x0003C484 File Offset: 0x0003A684
public string ContentType
{
get
{
return this.headers["content-type"];
}
}
/// <summary>Gets the cookies sent with the request.</summary>
/// <returns>A <see cref="T:System.Net.CookieCollection" /> that contains cookies that accompany the request. This property returns an empty collection if the request does not contain cookies.</returns>
// Token: 0x17000650 RID: 1616
// (get) Token: 0x0600137F RID: 4991 RVA: 0x0003C498 File Offset: 0x0003A698
public CookieCollection Cookies
{
get
{
if (this.cookies == null)
{
this.cookies = new CookieCollection();
}
return this.cookies;
}
}
/// <summary>Gets a <see cref="T:System.Boolean" /> value that indicates whether the request has associated body data.</summary>
/// <returns>true if the request has associated body data; otherwise, false.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
/// </PermissionSet>
// Token: 0x17000651 RID: 1617
// (get) Token: 0x06001380 RID: 4992 RVA: 0x0003C4B8 File Offset: 0x0003A6B8
public bool HasEntityBody
{
get
{
return this.content_length > 0L || this.is_chunked;
}
}
/// <summary>Gets the collection of header name/value pairs sent in the request.</summary>
/// <returns>A <see cref="T:System.Net.WebHeaderCollection" /> that contains the HTTP headers included in the request.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x17000652 RID: 1618
// (get) Token: 0x06001381 RID: 4993 RVA: 0x0003C4D0 File Offset: 0x0003A6D0
public global::System.Collections.Specialized.NameValueCollection Headers
{
get
{
return this.headers;
}
}
/// <summary>Gets the HTTP method specified by the client. </summary>
/// <returns>A <see cref="T:System.String" /> that contains the method used in the request.</returns>
// Token: 0x17000653 RID: 1619
// (get) Token: 0x06001382 RID: 4994 RVA: 0x0003C4D8 File Offset: 0x0003A6D8
public string HttpMethod
{
get
{
return this.method;
}
}
/// <summary>Gets a stream that contains the body data sent by the client.</summary>
/// <returns>A readable <see cref="T:System.IO.Stream" /> object that contains the bytes sent by the client in the body of the request. This property returns <see cref="F:System.IO.Stream.Null" /> if no data is sent with the request.</returns>
// Token: 0x17000654 RID: 1620
// (get) Token: 0x06001383 RID: 4995 RVA: 0x0003C4E0 File Offset: 0x0003A6E0
public Stream InputStream
{
get
{
return this.input_stream;
}
}
/// <summary>Gets a <see cref="T:System.Boolean" /> value that indicates whether the client sending this request is authenticated.</summary>
/// <returns>true if the client was authenticated; otherwise, false.</returns>
// Token: 0x17000655 RID: 1621
// (get) Token: 0x06001384 RID: 4996 RVA: 0x0003C4E8 File Offset: 0x0003A6E8
[global::System.MonoTODO("Always returns false")]
public bool IsAuthenticated
{
get
{
return false;
}
}
/// <summary>Gets a <see cref="T:System.Boolean" /> value that indicates whether the request is sent from the local computer.</summary>
/// <returns>true if the request originated on the same computer as the <see cref="T:System.Net.HttpListener" /> object that provided the request; otherwise, false.</returns>
// Token: 0x17000656 RID: 1622
// (get) Token: 0x06001385 RID: 4997 RVA: 0x0003C4EC File Offset: 0x0003A6EC
public bool IsLocal
{
get
{
return IPAddress.IsLoopback(this.RemoteEndPoint.Address);
}
}
/// <summary>Gets a <see cref="T:System.Boolean" /> value that indicates whether the TCP connection used to send the request is using the Secure Sockets Layer (SSL) protocol.</summary>
/// <returns>true if the TCP connection is using SSL; otherwise, false.</returns>
// Token: 0x17000657 RID: 1623
// (get) Token: 0x06001386 RID: 4998 RVA: 0x0003C500 File Offset: 0x0003A700
public bool IsSecureConnection
{
get
{
return this.context.Connection.IsSecure;
}
}
/// <summary>Gets a <see cref="T:System.Boolean" /> value that indicates whether the client requests a persistent connection.</summary>
/// <returns>true if the connection should be kept open; otherwise, false.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x17000658 RID: 1624
// (get) Token: 0x06001387 RID: 4999 RVA: 0x0003C514 File Offset: 0x0003A714
public bool KeepAlive
{
get
{
return false;
}
}
/// <summary>Get the server IP address and port number to which the request is directed.</summary>
/// <returns>An <see cref="T:System.Net.IPEndPoint" /> that represents the IP address that the request is sent to.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x17000659 RID: 1625
// (get) Token: 0x06001388 RID: 5000 RVA: 0x0003C518 File Offset: 0x0003A718
public IPEndPoint LocalEndPoint
{
get
{
return this.context.Connection.LocalEndPoint;
}
}
/// <summary>Gets the HTTP version used by the requesting client.</summary>
/// <returns>A <see cref="T:System.Version" /> that identifies the client's version of HTTP.</returns>
// Token: 0x1700065A RID: 1626
// (get) Token: 0x06001389 RID: 5001 RVA: 0x0003C52C File Offset: 0x0003A72C
public Version ProtocolVersion
{
get
{
return this.version;
}
}
/// <summary>Gets the query string included in the request.</summary>
/// <returns>A <see cref="T:System.Collections.Specialized.NameValueCollection" /> object that contains the query data included in the request <see cref="P:System.Net.HttpListenerRequest.Url" />.</returns>
// Token: 0x1700065B RID: 1627
// (get) Token: 0x0600138A RID: 5002 RVA: 0x0003C534 File Offset: 0x0003A734
public global::System.Collections.Specialized.NameValueCollection QueryString
{
get
{
return this.query_string;
}
}
/// <summary>Gets the URL information (without the host and port) requested by the client.</summary>
/// <returns>A <see cref="T:System.String" /> that contains the raw URL for this request.</returns>
// Token: 0x1700065C RID: 1628
// (get) Token: 0x0600138B RID: 5003 RVA: 0x0003C53C File Offset: 0x0003A73C
public string RawUrl
{
get
{
return this.raw_url;
}
}
/// <summary>Gets the client IP address and port number from which the request originated.</summary>
/// <returns>An <see cref="T:System.Net.IPEndPoint" /> that represents the IP address and port number from which the request originated.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x1700065D RID: 1629
// (get) Token: 0x0600138C RID: 5004 RVA: 0x0003C544 File Offset: 0x0003A744
public IPEndPoint RemoteEndPoint
{
get
{
return this.context.Connection.RemoteEndPoint;
}
}
/// <summary>Gets the request identifier of the incoming HTTP request.</summary>
/// <returns>A <see cref="T:System.Guid" /> object that contains the identifier of the HTTP request.</returns>
// Token: 0x1700065E RID: 1630
// (get) Token: 0x0600138D RID: 5005 RVA: 0x0003C558 File Offset: 0x0003A758
public Guid RequestTraceIdentifier
{
get
{
return this.identifier;
}
}
/// <summary>Gets the <see cref="T:System.Uri" /> object requested by the client.</summary>
/// <returns>A <see cref="T:System.Uri" /> object that identifies the resource requested by the client.</returns>
// Token: 0x1700065F RID: 1631
// (get) Token: 0x0600138E RID: 5006 RVA: 0x0003C560 File Offset: 0x0003A760
public global::System.Uri Url
{
get
{
return this.url;
}
}
/// <summary>Gets the Uniform Resource Identifier (URI) of the resource that referred the client to the server.</summary>
/// <returns>A <see cref="T:System.Uri" /> object that contains the text of the request's <see cref="F:System.Net.HttpRequestHeader.Referer" /> header, or null if the header was not included in the request.</returns>
// Token: 0x17000660 RID: 1632
// (get) Token: 0x0600138F RID: 5007 RVA: 0x0003C568 File Offset: 0x0003A768
public global::System.Uri UrlReferrer
{
get
{
return this.referrer;
}
}
/// <summary>Gets the user agent presented by the client.</summary>
/// <returns>A <see cref="T:System.String" /> object that contains the text of the request's User-Agent header.</returns>
// Token: 0x17000661 RID: 1633
// (get) Token: 0x06001390 RID: 5008 RVA: 0x0003C570 File Offset: 0x0003A770
public string UserAgent
{
get
{
return this.headers["user-agent"];
}
}
/// <summary>Gets the server IP address and port number to which the request is directed.</summary>
/// <returns>A <see cref="T:System.String" /> that contains the host address information.</returns>
// Token: 0x17000662 RID: 1634
// (get) Token: 0x06001391 RID: 5009 RVA: 0x0003C584 File Offset: 0x0003A784
public string UserHostAddress
{
get
{
return this.LocalEndPoint.ToString();
}
}
/// <summary>Gets the DNS name and, if provided, the port number specified by the client.</summary>
/// <returns>A <see cref="T:System.String" /> value that contains the text of the request's Host header.</returns>
// Token: 0x17000663 RID: 1635
// (get) Token: 0x06001392 RID: 5010 RVA: 0x0003C594 File Offset: 0x0003A794
public string UserHostName
{
get
{
return this.headers["host"];
}
}
/// <summary>Gets the natural languages that are preferred for the response.</summary>
/// <returns>A <see cref="T:System.String" /> array that contains the languages specified in the request's <see cref="F:System.Net.HttpRequestHeader.AcceptLanguage" /> header or null if the client request did not include an <see cref="F:System.Net.HttpRequestHeader.AcceptLanguage" /> header.</returns>
// Token: 0x17000664 RID: 1636
// (get) Token: 0x06001393 RID: 5011 RVA: 0x0003C5A8 File Offset: 0x0003A7A8
public string[] UserLanguages
{
get
{
return this.user_languages;
}
}
/// <summary>Begins an asynchronous request for the client's X.509 v.3 certificate.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> that indicates the status of the operation.</returns>
/// <param name="requestCallback">An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when the operation is complete.</param>
/// <param name="state">A user-defined object that contains information about the operation. This object is passed to the callback delegate when the operation completes.</param>
// Token: 0x06001394 RID: 5012 RVA: 0x0003C5B0 File Offset: 0x0003A7B0
public IAsyncResult BeginGetClientCertificate(AsyncCallback requestCallback, object state)
{
return null;
}
/// <summary>Ends an asynchronous request for the client's X.509 v.3 certificate.</summary>
/// <returns>The <see cref="T:System.IAsyncResult" /> object that is returned when the operation started.</returns>
/// <param name="asyncResult">The pending request for the certificate.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="asyncResult" /> was not obtained by calling <see cref="M:System.Net.HttpListenerRequest.BeginGetClientCertificate(System.AsyncCallback,System.Object)" /><paramref name="e." /></exception>
/// <exception cref="T:System.InvalidOperationException">This method was already called for the operation identified by <paramref name="asyncResult" />. </exception>
// Token: 0x06001395 RID: 5013 RVA: 0x0003C5B4 File Offset: 0x0003A7B4
public global::System.Security.Cryptography.X509Certificates.X509Certificate2 EndGetClientCertificate(IAsyncResult asyncResult)
{
return null;
}
/// <summary>Retrieves the client's X.509 v.3 certificate.</summary>
/// <returns>A <see cref="N:System.Security.Cryptography.X509Certificates" /> object that contains the client's X.509 v.3 certificate.</returns>
/// <exception cref="T:System.InvalidOperationException">A call to this method to retrieve the client's X.509 v.3 certificate is in progress and therefore another call to this method cannot be made.</exception>
// Token: 0x06001396 RID: 5014 RVA: 0x0003C5B8 File Offset: 0x0003A7B8
public global::System.Security.Cryptography.X509Certificates.X509Certificate2 GetClientCertificate()
{
return null;
}
// Token: 0x0400107A RID: 4218
private string[] accept_types;
// Token: 0x0400107B RID: 4219
private Encoding content_encoding;
// Token: 0x0400107C RID: 4220
private long content_length;
// Token: 0x0400107D RID: 4221
private bool cl_set;
// Token: 0x0400107E RID: 4222
private CookieCollection cookies;
// Token: 0x0400107F RID: 4223
private WebHeaderCollection headers;
// Token: 0x04001080 RID: 4224
private string method;
// Token: 0x04001081 RID: 4225
private Stream input_stream;
// Token: 0x04001082 RID: 4226
private Version version;
// Token: 0x04001083 RID: 4227
private global::System.Collections.Specialized.NameValueCollection query_string;
// Token: 0x04001084 RID: 4228
private string raw_url;
// Token: 0x04001085 RID: 4229
private Guid identifier;
// Token: 0x04001086 RID: 4230
private global::System.Uri url;
// Token: 0x04001087 RID: 4231
private global::System.Uri referrer;
// Token: 0x04001088 RID: 4232
private string[] user_languages;
// Token: 0x04001089 RID: 4233
private HttpListenerContext context;
// Token: 0x0400108A RID: 4234
private bool is_chunked;
// Token: 0x0400108B RID: 4235
private static byte[] _100continue = Encoding.ASCII.GetBytes("HTTP/1.1 100 Continue\r\n\r\n");
// Token: 0x0400108C RID: 4236
private static readonly string[] no_body_methods = new string[] { "GET", "HEAD", "DELETE" };
// Token: 0x0400108D RID: 4237
private static char[] separators = new char[] { ' ' };
}
}
+823
View File
@@ -0,0 +1,823 @@
using System;
using System.Globalization;
using System.IO;
using System.Text;
namespace System.Net
{
/// <summary>Represents a response to a request being handled by an <see cref="T:System.Net.HttpListener" /> object.</summary>
// Token: 0x02000230 RID: 560
public sealed class HttpListenerResponse : IDisposable
{
// Token: 0x06001397 RID: 5015 RVA: 0x0003C5BC File Offset: 0x0003A7BC
internal HttpListenerResponse(HttpListenerContext context)
{
this.context = context;
}
/// <summary>Releases all resources used by the <see cref="T:System.Net.HttpListenerResponse" />.</summary>
// Token: 0x06001398 RID: 5016 RVA: 0x0003C60C File Offset: 0x0003A80C
void IDisposable.Dispose()
{
this.Close(true);
}
// Token: 0x17000665 RID: 1637
// (get) Token: 0x06001399 RID: 5017 RVA: 0x0003C618 File Offset: 0x0003A818
internal bool ForceCloseChunked
{
get
{
return this.force_close_chunked;
}
}
/// <summary>Gets or sets the <see cref="T:System.Text.Encoding" /> for this response's <see cref="P:System.Net.HttpListenerResponse.OutputStream" />.</summary>
/// <returns>An <see cref="T:System.Text.Encoding" /> object suitable for use with the data in the <see cref="P:System.Net.HttpListenerResponse.OutputStream" /> property, or null if no encoding is specified.</returns>
// Token: 0x17000666 RID: 1638
// (get) Token: 0x0600139A RID: 5018 RVA: 0x0003C620 File Offset: 0x0003A820
// (set) Token: 0x0600139B RID: 5019 RVA: 0x0003C640 File Offset: 0x0003A840
public Encoding ContentEncoding
{
get
{
if (this.content_encoding == null)
{
this.content_encoding = Encoding.Default;
}
return this.content_encoding;
}
set
{
if (this.disposed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (this.HeadersSent)
{
throw new InvalidOperationException("Cannot be changed after headers are sent.");
}
this.content_encoding = value;
}
}
/// <summary>Gets or sets the number of bytes in the body data included in the response.</summary>
/// <returns>The value of the response's Content-Length header.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value specified for a set operation is less than zero.</exception>
/// <exception cref="T:System.InvalidOperationException">The response is already being sent.</exception>
/// <exception cref="T:System.ObjectDisposedException">This object is closed.</exception>
// Token: 0x17000667 RID: 1639
// (get) Token: 0x0600139C RID: 5020 RVA: 0x0003C67C File Offset: 0x0003A87C
// (set) Token: 0x0600139D RID: 5021 RVA: 0x0003C684 File Offset: 0x0003A884
public long ContentLength64
{
get
{
return this.content_length;
}
set
{
if (this.disposed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (this.HeadersSent)
{
throw new InvalidOperationException("Cannot be changed after headers are sent.");
}
if (value < 0L)
{
throw new ArgumentOutOfRangeException("Must be >= 0", "value");
}
this.cl_set = true;
this.content_length = value;
}
}
/// <summary>Gets or sets the MIME type of the content returned.</summary>
/// <returns>A <see cref="T:System.String" /> instance that contains the text of the response's Content-Type header.</returns>
/// <exception cref="T:System.ArgumentNullException">The value specified for a set operation is null.</exception>
/// <exception cref="T:System.ArgumentException">The value specified for a set operation is an empty string ("").</exception>
/// <exception cref="T:System.ObjectDisposedException">This object is closed.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x17000668 RID: 1640
// (get) Token: 0x0600139E RID: 5022 RVA: 0x0003C6EC File Offset: 0x0003A8EC
// (set) Token: 0x0600139F RID: 5023 RVA: 0x0003C6F4 File Offset: 0x0003A8F4
public string ContentType
{
get
{
return this.content_type;
}
set
{
if (this.disposed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (this.HeadersSent)
{
throw new InvalidOperationException("Cannot be changed after headers are sent.");
}
this.content_type = value;
}
}
/// <summary>Gets or sets the collection of cookies returned with the response.</summary>
/// <returns>A <see cref="T:System.Net.CookieCollection" /> that contains cookies to accompany the response. The collection is empty if no cookies have been added to the response.</returns>
// Token: 0x17000669 RID: 1641
// (get) Token: 0x060013A0 RID: 5024 RVA: 0x0003C730 File Offset: 0x0003A930
// (set) Token: 0x060013A1 RID: 5025 RVA: 0x0003C750 File Offset: 0x0003A950
public CookieCollection Cookies
{
get
{
if (this.cookies == null)
{
this.cookies = new CookieCollection();
}
return this.cookies;
}
set
{
this.cookies = value;
}
}
/// <summary>Gets or sets the collection of header name/value pairs returned by the server.</summary>
/// <returns>A <see cref="T:System.Net.WebHeaderCollection" /> instance that contains all the explicitly set HTTP headers to be included in the response.</returns>
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.Net.WebHeaderCollection" /> instance specified for a set operation is not valid for a response.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x1700066A RID: 1642
// (get) Token: 0x060013A2 RID: 5026 RVA: 0x0003C75C File Offset: 0x0003A95C
// (set) Token: 0x060013A3 RID: 5027 RVA: 0x0003C764 File Offset: 0x0003A964
public WebHeaderCollection Headers
{
get
{
return this.headers;
}
set
{
this.headers = value;
}
}
/// <summary>Gets or sets a value indicating whether the server requests a persistent connection.</summary>
/// <returns>true if the server requests a persistent connection; otherwise, false. The default is true.</returns>
/// <exception cref="T:System.ObjectDisposedException">This object is closed.</exception>
// Token: 0x1700066B RID: 1643
// (get) Token: 0x060013A4 RID: 5028 RVA: 0x0003C770 File Offset: 0x0003A970
// (set) Token: 0x060013A5 RID: 5029 RVA: 0x0003C778 File Offset: 0x0003A978
public bool KeepAlive
{
get
{
return this.keep_alive;
}
set
{
if (this.disposed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (this.HeadersSent)
{
throw new InvalidOperationException("Cannot be changed after headers are sent.");
}
this.keep_alive = value;
}
}
/// <summary>Gets a <see cref="T:System.IO.Stream" /> object to which a response can be written.</summary>
/// <returns>A <see cref="T:System.IO.Stream" /> object to which a response can be written.</returns>
/// <exception cref="T:System.ObjectDisposedException">This object is closed.</exception>
// Token: 0x1700066C RID: 1644
// (get) Token: 0x060013A6 RID: 5030 RVA: 0x0003C7B4 File Offset: 0x0003A9B4
public Stream OutputStream
{
get
{
if (this.output_stream == null)
{
this.output_stream = this.context.Connection.GetResponseStream();
}
return this.output_stream;
}
}
/// <summary>Gets or sets the HTTP version used for the response.</summary>
/// <returns>A <see cref="T:System.Version" /> object indicating the version of HTTP used when responding to the client. Note that this property is now obsolete.</returns>
/// <exception cref="T:System.ArgumentNullException">The value specified for a set operation is null.</exception>
/// <exception cref="T:System.ArgumentException">The value specified for a set operation does not have its <see cref="P:System.Version.Major" /> property set to 1 or does not have its <see cref="P:System.Version.Minor" /> property set to either 0 or 1.</exception>
/// <exception cref="T:System.ObjectDisposedException">This object is closed.</exception>
// Token: 0x1700066D RID: 1645
// (get) Token: 0x060013A7 RID: 5031 RVA: 0x0003C7E0 File Offset: 0x0003A9E0
// (set) Token: 0x060013A8 RID: 5032 RVA: 0x0003C7E8 File Offset: 0x0003A9E8
public Version ProtocolVersion
{
get
{
return this.version;
}
set
{
if (this.disposed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (this.HeadersSent)
{
throw new InvalidOperationException("Cannot be changed after headers are sent.");
}
if (value == null)
{
throw new ArgumentNullException("value");
}
if (value.Major != 1 || (value.Minor != 0 && value.Minor != 1))
{
throw new ArgumentException("Must be 1.0 or 1.1", "value");
}
if (this.disposed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
this.version = value;
}
}
/// <summary>Gets or sets the value of the HTTP Location header in this response.</summary>
/// <returns>A <see cref="T:System.String" /> that contains the absolute URL to be sent to the client in the Location header. </returns>
/// <exception cref="T:System.ArgumentException">The value specified for a set operation is an empty string ("").</exception>
/// <exception cref="T:System.ObjectDisposedException">This object is closed.</exception>
// Token: 0x1700066E RID: 1646
// (get) Token: 0x060013A9 RID: 5033 RVA: 0x0003C894 File Offset: 0x0003AA94
// (set) Token: 0x060013AA RID: 5034 RVA: 0x0003C89C File Offset: 0x0003AA9C
public string RedirectLocation
{
get
{
return this.location;
}
set
{
if (this.disposed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (this.HeadersSent)
{
throw new InvalidOperationException("Cannot be changed after headers are sent.");
}
this.location = value;
}
}
/// <summary>Gets or sets whether the response uses chunked transfer encoding.</summary>
/// <returns>true if the response is set to use chunked transfer encoding; otherwise, false. The default is false.</returns>
// Token: 0x1700066F RID: 1647
// (get) Token: 0x060013AB RID: 5035 RVA: 0x0003C8D8 File Offset: 0x0003AAD8
// (set) Token: 0x060013AC RID: 5036 RVA: 0x0003C8E0 File Offset: 0x0003AAE0
public bool SendChunked
{
get
{
return this.chunked;
}
set
{
if (this.disposed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (this.HeadersSent)
{
throw new InvalidOperationException("Cannot be changed after headers are sent.");
}
this.chunked = value;
}
}
/// <summary>Gets or sets the HTTP status code to be returned to the client.</summary>
/// <returns>An <see cref="T:System.Int32" /> value that specifies the HTTP status code for the requested resource. The default is <see cref="F:System.Net.HttpStatusCode.OK" />, indicating that the server successfully processed the client's request and included the requested resource in the response body.</returns>
/// <exception cref="T:System.ObjectDisposedException">This object is closed.</exception>
/// <exception cref="T:System.Net.ProtocolViolationException">The value specified for a set operation is not valid. Valid values are between 100 and 999 inclusive.</exception>
// Token: 0x17000670 RID: 1648
// (get) Token: 0x060013AD RID: 5037 RVA: 0x0003C91C File Offset: 0x0003AB1C
// (set) Token: 0x060013AE RID: 5038 RVA: 0x0003C924 File Offset: 0x0003AB24
public int StatusCode
{
get
{
return this.status_code;
}
set
{
if (this.disposed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (this.HeadersSent)
{
throw new InvalidOperationException("Cannot be changed after headers are sent.");
}
if (value < 100 || value > 999)
{
throw new ProtocolViolationException("StatusCode must be between 100 and 999.");
}
this.status_code = value;
this.status_description = HttpListenerResponse.GetStatusDescription(value);
}
}
// Token: 0x060013AF RID: 5039 RVA: 0x0003C994 File Offset: 0x0003AB94
internal static string GetStatusDescription(int code)
{
switch (code)
{
case 400:
return "Bad Request";
case 401:
return "Unauthorized";
case 402:
return "Payment Required";
case 403:
return "Forbidden";
case 404:
return "Not Found";
case 405:
return "Method Not Allowed";
case 406:
return "Not Acceptable";
case 407:
return "Proxy Authentication Required";
case 408:
return "Request Timeout";
case 409:
return "Conflict";
case 410:
return "Gone";
case 411:
return "Length Required";
case 412:
return "Precondition Failed";
case 413:
return "Request Entity Too Large";
case 414:
return "Request-Uri Too Long";
case 415:
return "Unsupported Media Type";
case 416:
return "Requested Range Not Satisfiable";
case 417:
return "Expectation Failed";
default:
switch (code)
{
case 200:
return "OK";
case 201:
return "Created";
case 202:
return "Accepted";
case 203:
return "Non-Authoritative Information";
case 204:
return "No Content";
case 205:
return "Reset Content";
case 206:
return "Partial Content";
case 207:
return "Multi-Status";
default:
switch (code)
{
case 300:
return "Multiple Choices";
case 301:
return "Moved Permanently";
case 302:
return "Found";
case 303:
return "See Other";
case 304:
return "Not Modified";
case 305:
return "Use Proxy";
default:
switch (code)
{
case 500:
return "Internal Server Error";
case 501:
return "Not Implemented";
case 502:
return "Bad Gateway";
case 503:
return "Service Unavailable";
case 504:
return "Gateway Timeout";
case 505:
return "Http Version Not Supported";
default:
switch (code)
{
case 100:
return "Continue";
case 101:
return "Switching Protocols";
case 102:
return "Processing";
default:
return string.Empty;
}
break;
case 507:
return "Insufficient Storage";
}
break;
case 307:
return "Temporary Redirect";
}
break;
}
break;
case 422:
return "Unprocessable Entity";
case 423:
return "Locked";
case 424:
return "Failed Dependency";
}
}
/// <summary>Gets or sets a text description of the HTTP status code returned to the client.</summary>
/// <returns>The text description of the HTTP status code returned to the client. The default is the RFC 2616 description for the <see cref="P:System.Net.HttpListenerResponse.StatusCode" /> property value, or an empty string ("") if an RFC 2616 description does not exist.</returns>
// Token: 0x17000671 RID: 1649
// (get) Token: 0x060013B0 RID: 5040 RVA: 0x0003CBCC File Offset: 0x0003ADCC
// (set) Token: 0x060013B1 RID: 5041 RVA: 0x0003CBD4 File Offset: 0x0003ADD4
public string StatusDescription
{
get
{
return this.status_description;
}
set
{
this.status_description = value;
}
}
/// <summary>Closes the connection to the client without sending a response.</summary>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x060013B2 RID: 5042 RVA: 0x0003CBE0 File Offset: 0x0003ADE0
public void Abort()
{
if (this.disposed)
{
return;
}
this.Close(true);
}
/// <summary>Adds the specified header and value to the HTTP headers for this response.</summary>
/// <param name="name">The name of the HTTP header to set.</param>
/// <param name="value">The value for the <paramref name="name" /> header.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="name" /> is null or an empty string ("").</exception>
/// <exception cref="T:System.ArgumentException">You are not allowed to specify a value for the specified header.-or-<paramref name="name" /> or <paramref name="value" /> contains invalid characters.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of <paramref name="value" /> is greater than 65,535 characters.</exception>
// Token: 0x060013B3 RID: 5043 RVA: 0x0003CBF8 File Offset: 0x0003ADF8
public void AddHeader(string name, string value)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
if (name == string.Empty)
{
throw new ArgumentException("'name' cannot be empty", "name");
}
if (value.Length > 65535)
{
throw new ArgumentOutOfRangeException("value");
}
this.headers.Set(name, value);
}
/// <summary>Adds the specified <see cref="T:System.Net.Cookie" /> to the collection of cookies for this response.</summary>
/// <param name="cookie">The <see cref="T:System.Net.Cookie" /> to add to the collection to be sent with this response</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="cookie" /> is null.</exception>
// Token: 0x060013B4 RID: 5044 RVA: 0x0003CC60 File Offset: 0x0003AE60
public void AppendCookie(Cookie cookie)
{
if (cookie == null)
{
throw new ArgumentNullException("cookie");
}
this.Cookies.Add(cookie);
}
/// <summary>Appends a value to the specified HTTP header to be sent with this response.</summary>
/// <param name="name">The name of the HTTP header to append <paramref name="value" /> to.</param>
/// <param name="value">The value to append to the <paramref name="name" /> header.</param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="name" /> is null or an empty string ("").-or-You are not allowed to specify a value for the specified header.-or-<paramref name="name" /> or <paramref name="value" /> contains invalid characters.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of <paramref name="value" /> is greater than 65,535 characters.</exception>
// Token: 0x060013B5 RID: 5045 RVA: 0x0003CC80 File Offset: 0x0003AE80
public void AppendHeader(string name, string value)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
if (name == string.Empty)
{
throw new ArgumentException("'name' cannot be empty", "name");
}
if (value.Length > 65535)
{
throw new ArgumentOutOfRangeException("value");
}
this.headers.Add(name, value);
}
// Token: 0x060013B6 RID: 5046 RVA: 0x0003CCE8 File Offset: 0x0003AEE8
private void Close(bool force)
{
this.disposed = true;
this.context.Connection.Close(force);
}
/// <summary>Sends the response to the client and releases the resources held by this <see cref="T:System.Net.HttpListenerResponse" /> instance.</summary>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x060013B7 RID: 5047 RVA: 0x0003CD04 File Offset: 0x0003AF04
public void Close()
{
if (this.disposed)
{
return;
}
this.Close(false);
}
/// <summary>Returns the specified byte array to the client and releases the resources held by this <see cref="T:System.Net.HttpListenerResponse" /> instance.</summary>
/// <param name="responseEntity">A <see cref="T:System.Byte" /> array that contains the response to send to the client.</param>
/// <param name="willBlock">true to block execution while flushing the stream to the client; otherwise, false.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="responseEntity" /> is null.</exception>
/// <exception cref="T:System.ObjectDisposedException">This object is closed.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x060013B8 RID: 5048 RVA: 0x0003CD1C File Offset: 0x0003AF1C
public void Close(byte[] responseEntity, bool willBlock)
{
if (this.disposed)
{
return;
}
if (responseEntity == null)
{
throw new ArgumentNullException("responseEntity");
}
this.ContentLength64 = (long)responseEntity.Length;
this.OutputStream.Write(responseEntity, 0, (int)this.content_length);
this.Close(false);
}
/// <summary>Copies properties from the specified <see cref="T:System.Net.HttpListenerResponse" /> to this response.</summary>
/// <param name="templateResponse">The <see cref="T:System.Net.HttpListenerResponse" /> instance to copy.</param>
// Token: 0x060013B9 RID: 5049 RVA: 0x0003CD6C File Offset: 0x0003AF6C
public void CopyFrom(HttpListenerResponse templateResponse)
{
this.headers.Clear();
this.headers.Add(templateResponse.headers);
this.content_length = templateResponse.content_length;
this.status_code = templateResponse.status_code;
this.status_description = templateResponse.status_description;
this.keep_alive = templateResponse.keep_alive;
this.version = templateResponse.version;
}
/// <summary>Configures the response to redirect the client to the specified URL.</summary>
/// <param name="url">The URL that the client should use to locate the requested resource.</param>
// Token: 0x060013BA RID: 5050 RVA: 0x0003CDD4 File Offset: 0x0003AFD4
public void Redirect(string url)
{
this.StatusCode = 302;
this.location = url;
}
// Token: 0x060013BB RID: 5051 RVA: 0x0003CDE8 File Offset: 0x0003AFE8
private bool FindCookie(Cookie cookie)
{
string name = cookie.Name;
string domain = cookie.Domain;
string path = cookie.Path;
foreach (object obj in this.cookies)
{
Cookie cookie2 = (Cookie)obj;
if (!(name != cookie2.Name))
{
if (!(domain != cookie2.Domain))
{
if (path == cookie2.Path)
{
return true;
}
}
}
}
return false;
}
// Token: 0x060013BC RID: 5052 RVA: 0x0003CEB8 File Offset: 0x0003B0B8
internal void SendHeaders(bool closing, MemoryStream ms)
{
Encoding @default = this.content_encoding;
if (@default == null)
{
@default = Encoding.Default;
}
if (this.content_type != null)
{
if (this.content_encoding != null && this.content_type.IndexOf("charset=") == -1)
{
string webName = this.content_encoding.WebName;
this.headers.SetInternal("Content-Type", this.content_type + "; charset=" + webName);
}
else
{
this.headers.SetInternal("Content-Type", this.content_type);
}
}
if (this.headers["Server"] == null)
{
this.headers.SetInternal("Server", "Mono-HTTPAPI/1.0");
}
CultureInfo invariantCulture = CultureInfo.InvariantCulture;
if (this.headers["Date"] == null)
{
this.headers.SetInternal("Date", DateTime.UtcNow.ToString("r", invariantCulture));
}
if (!this.chunked)
{
if (!this.cl_set && closing)
{
this.cl_set = true;
this.content_length = 0L;
}
if (this.cl_set)
{
this.headers.SetInternal("Content-Length", this.content_length.ToString(invariantCulture));
}
}
Version protocolVersion = this.context.Request.ProtocolVersion;
if (!this.cl_set && !this.chunked && protocolVersion >= HttpVersion.Version11)
{
this.chunked = true;
}
bool flag = this.status_code == 400 || this.status_code == 408 || this.status_code == 411 || this.status_code == 413 || this.status_code == 414 || this.status_code == 500 || this.status_code == 503;
if (!flag)
{
flag = this.context.Request.Headers["connection"] == "close";
flag |= protocolVersion <= HttpVersion.Version10;
}
if (!this.keep_alive || flag)
{
this.headers.SetInternal("Connection", "close");
}
if (this.chunked)
{
this.headers.SetInternal("Transfer-Encoding", "chunked");
}
int chunkedUses = this.context.Connection.ChunkedUses;
if (chunkedUses >= 100)
{
this.force_close_chunked = true;
if (!flag)
{
this.headers.SetInternal("Connection", "close");
}
}
if (this.location != null)
{
this.headers.SetInternal("Location", this.location);
}
if (this.cookies != null)
{
foreach (object obj in this.cookies)
{
Cookie cookie = (Cookie)obj;
this.headers.SetInternal("Set-Cookie", cookie.ToClientString());
}
}
StreamWriter streamWriter = new StreamWriter(ms, @default);
streamWriter.Write("HTTP/{0} {1} {2}\r\n", this.version, this.status_code, this.status_description);
string text = this.headers.ToStringMultiValue();
streamWriter.Write(text);
streamWriter.Flush();
int num = @default.GetPreamble().Length;
if (this.output_stream == null)
{
this.output_stream = this.context.Connection.GetResponseStream();
}
ms.Position = (long)num;
this.HeadersSent = true;
}
/// <summary>Adds or updates a <see cref="T:System.Net.Cookie" /> in the collection of cookies sent with this response. </summary>
/// <param name="cookie">A <see cref="T:System.Net.Cookie" /> for this response.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="cookie" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">The cookie already exists in the collection and could not be replaced.</exception>
// Token: 0x060013BD RID: 5053 RVA: 0x0003D2A4 File Offset: 0x0003B4A4
public void SetCookie(Cookie cookie)
{
if (cookie == null)
{
throw new ArgumentNullException("cookie");
}
if (this.cookies != null)
{
if (this.FindCookie(cookie))
{
throw new ArgumentException("The cookie already exists.");
}
}
else
{
this.cookies = new CookieCollection();
}
this.cookies.Add(cookie);
}
// Token: 0x0400108F RID: 4239
private bool disposed;
// Token: 0x04001090 RID: 4240
private Encoding content_encoding;
// Token: 0x04001091 RID: 4241
private long content_length;
// Token: 0x04001092 RID: 4242
private bool cl_set;
// Token: 0x04001093 RID: 4243
private string content_type;
// Token: 0x04001094 RID: 4244
private CookieCollection cookies;
// Token: 0x04001095 RID: 4245
private WebHeaderCollection headers = new WebHeaderCollection();
// Token: 0x04001096 RID: 4246
private bool keep_alive = true;
// Token: 0x04001097 RID: 4247
private ResponseStream output_stream;
// Token: 0x04001098 RID: 4248
private Version version = HttpVersion.Version11;
// Token: 0x04001099 RID: 4249
private string location;
// Token: 0x0400109A RID: 4250
private int status_code = 200;
// Token: 0x0400109B RID: 4251
private string status_description = "OK";
// Token: 0x0400109C RID: 4252
private bool chunked;
// Token: 0x0400109D RID: 4253
private HttpListenerContext context;
// Token: 0x0400109E RID: 4254
internal bool HeadersSent;
// Token: 0x0400109F RID: 4255
private bool force_close_chunked;
}
}
+19
View File
@@ -0,0 +1,19 @@
using System;
namespace System.Net
{
// Token: 0x02000231 RID: 561
internal class HttpRequestCreator : IWebRequestCreate
{
// Token: 0x060013BE RID: 5054 RVA: 0x0003D300 File Offset: 0x0003B500
internal HttpRequestCreator()
{
}
// Token: 0x060013BF RID: 5055 RVA: 0x0003D308 File Offset: 0x0003B508
public WebRequest Create(global::System.Uri uri)
{
return new HttpWebRequest(uri);
}
}
}
+133
View File
@@ -0,0 +1,133 @@
using System;
namespace System.Net
{
/// <summary>The HTTP headers that may be specified in a client request.</summary>
// Token: 0x02000232 RID: 562
public enum HttpRequestHeader
{
/// <summary>The Cache-Control header, which specifies directives that must be obeyed by all cache control mechanisms along the request/response chain.</summary>
// Token: 0x040010A1 RID: 4257
CacheControl,
/// <summary>The Connection header, which specifies options that are desired for a particular connection.</summary>
// Token: 0x040010A2 RID: 4258
Connection,
/// <summary>The Date header, which specifies the date and time at which the request originated.</summary>
// Token: 0x040010A3 RID: 4259
Date,
/// <summary>The Keep-Alive header, which specifies a parameter used into order to maintain a persistent connection.</summary>
// Token: 0x040010A4 RID: 4260
KeepAlive,
/// <summary>The Pragma header, which specifies implementation-specific directives that might apply to any agent along the request/response chain.</summary>
// Token: 0x040010A5 RID: 4261
Pragma,
/// <summary>The Trailer header, which specifies the header fields present in the trailer of a message encoded with chunked transfer-coding.</summary>
// Token: 0x040010A6 RID: 4262
Trailer,
/// <summary>The Transfer-Encoding header, which specifies what (if any) type of transformation that has been applied to the message body.</summary>
// Token: 0x040010A7 RID: 4263
TransferEncoding,
/// <summary>The Upgrade header, which specifies additional communications protocols that the client supports.</summary>
// Token: 0x040010A8 RID: 4264
Upgrade,
/// <summary>The Via header, which specifies intermediate protocols to be used by gateway and proxy agents.</summary>
// Token: 0x040010A9 RID: 4265
Via,
/// <summary>The Warning header, which specifies additional information about that status or transformation of a message that might not be reflected in the message.</summary>
// Token: 0x040010AA RID: 4266
Warning,
/// <summary>The Allow header, which specifies the set of HTTP methods supported.</summary>
// Token: 0x040010AB RID: 4267
Allow,
/// <summary>The Content-Length header, which specifies the length, in bytes, of the accompanying body data.</summary>
// Token: 0x040010AC RID: 4268
ContentLength,
/// <summary>The Content-Type header, which specifies the MIME type of the accompanying body data.</summary>
// Token: 0x040010AD RID: 4269
ContentType,
/// <summary>The Content-Encoding header, which specifies the encodings that have been applied to the accompanying body data.</summary>
// Token: 0x040010AE RID: 4270
ContentEncoding,
/// <summary>The Content-Langauge header, which specifies the natural language(s) of the accompanying body data.</summary>
// Token: 0x040010AF RID: 4271
ContentLanguage,
/// <summary>The Content-Location header, which specifies a URI from which the accompanying body may be obtained.</summary>
// Token: 0x040010B0 RID: 4272
ContentLocation,
/// <summary>The Content-MD5 header, which specifies the MD5 digest of the accompanying body data, for the purpose of providing an end-to-end message integrity check.</summary>
// Token: 0x040010B1 RID: 4273
ContentMd5,
/// <summary>The Content-Range header, which specifies where in the full body the accompanying partial body data should be applied.</summary>
// Token: 0x040010B2 RID: 4274
ContentRange,
/// <summary>The Expires header, which specifies the date and time after which the accompanying body data should be considered stale.</summary>
// Token: 0x040010B3 RID: 4275
Expires,
/// <summary>The Last-Modified header, which specifies the date and time at which the accompanying body data was last modified.</summary>
// Token: 0x040010B4 RID: 4276
LastModified,
/// <summary>The Accept header, which specifies the MIME types that are acceptable for the response.</summary>
// Token: 0x040010B5 RID: 4277
Accept,
/// <summary>The Accept-Charset header, which specifies the character sets that are acceptable for the response.</summary>
// Token: 0x040010B6 RID: 4278
AcceptCharset,
/// <summary>The Accept-Encoding header, which specifies the content encodings that are acceptable for the response.</summary>
// Token: 0x040010B7 RID: 4279
AcceptEncoding,
/// <summary>The Accept-Langauge header, which specifies that natural languages that are preferred for the response.</summary>
// Token: 0x040010B8 RID: 4280
AcceptLanguage,
/// <summary>The Authorization header, which specifies the credentials that the client presents in order to authenticate itself to the server.</summary>
// Token: 0x040010B9 RID: 4281
Authorization,
/// <summary>The Cookie header, which specifies cookie data presented to the server.</summary>
// Token: 0x040010BA RID: 4282
Cookie,
/// <summary>The Expect header, which specifies particular server behaviors that are required by the client.</summary>
// Token: 0x040010BB RID: 4283
Expect,
/// <summary>The From header, which specifies an Internet E-mail address for the human user who controls the requesting user agent.</summary>
// Token: 0x040010BC RID: 4284
From,
/// <summary>The Host header, which specifies the host name and port number of the resource being requested.</summary>
// Token: 0x040010BD RID: 4285
Host,
/// <summary>The If-Match header, which specifies that the requested operation should be performed only if the client's cached copy of the indicated resource is current.</summary>
// Token: 0x040010BE RID: 4286
IfMatch,
/// <summary>The If-Modified-Since header, which specifies that the requested operation should be performed only if the requested resource has been modified since the indicated data and time.</summary>
// Token: 0x040010BF RID: 4287
IfModifiedSince,
/// <summary>The If-None-Match header, which specifies that the requested operation should be performed only if none of client's cached copies of the indicated resources are current.</summary>
// Token: 0x040010C0 RID: 4288
IfNoneMatch,
/// <summary>The If-Range header, which specifies that only the specified range of the requested resource should be sent, if the client's cached copy is current.</summary>
// Token: 0x040010C1 RID: 4289
IfRange,
/// <summary>The If-Unmodified-Since header, which specifies that the requested operation should be performed only if the requested resource has not been modified since the indicated date and time.</summary>
// Token: 0x040010C2 RID: 4290
IfUnmodifiedSince,
/// <summary>The Max-Forwards header, which specifies an integer indicating the remaining number of times that this request may be forwarded.</summary>
// Token: 0x040010C3 RID: 4291
MaxForwards,
/// <summary>The Proxy-Authorization header, which specifies the credentials that the client presents in order to authenticate itself to a proxy.</summary>
// Token: 0x040010C4 RID: 4292
ProxyAuthorization,
/// <summary>The Referer header, which specifies the URI of the resource from which the request URI was obtained.</summary>
// Token: 0x040010C5 RID: 4293
Referer,
/// <summary>The Range header, which specifies the the sub-range(s) of the response that the client requests be returned in lieu of the entire response.</summary>
// Token: 0x040010C6 RID: 4294
Range,
/// <summary>The TE header, which specifies the transfer encodings that are acceptable for the response.</summary>
// Token: 0x040010C7 RID: 4295
Te,
/// <summary>The Translate header, a Microsoft extension to the HTTP specification used in conjunction with WebDAV functionality.</summary>
// Token: 0x040010C8 RID: 4296
Translate,
/// <summary>The User-Agent header, which specifies information about the client agent.</summary>
// Token: 0x040010C9 RID: 4297
UserAgent
}
}
+100
View File
@@ -0,0 +1,100 @@
using System;
namespace System.Net
{
/// <summary>The HTTP headers that can be specified in a server response.</summary>
// Token: 0x02000233 RID: 563
public enum HttpResponseHeader
{
/// <summary>The Cache-Control header, which specifies caching directives that must be obeyed by all caching mechanisms along the request/response chain.</summary>
// Token: 0x040010CB RID: 4299
CacheControl,
/// <summary>The Connection header, which specifies options that are desired for a particular connection.</summary>
// Token: 0x040010CC RID: 4300
Connection,
/// <summary>The Date header, which specifies the date and time at which the response originated.</summary>
// Token: 0x040010CD RID: 4301
Date,
/// <summary>The Keep-Alive header, which specifies a parameter to be used to maintain a persistent connection.</summary>
// Token: 0x040010CE RID: 4302
KeepAlive,
/// <summary>The Pragma header, which specifies implementation-specific directives that might apply to any agent along the request/response chain.</summary>
// Token: 0x040010CF RID: 4303
Pragma,
/// <summary>The Trailer header, which specifies that the indicated header fields are present in the trailer of a message that is encoded with chunked transfer-coding.</summary>
// Token: 0x040010D0 RID: 4304
Trailer,
/// <summary>The Transfer-Encoding header, which specifies what (if any) type of transformation has been applied to the message body.</summary>
// Token: 0x040010D1 RID: 4305
TransferEncoding,
/// <summary>The Upgrade header, which specifies additional communications protocols that the client supports.</summary>
// Token: 0x040010D2 RID: 4306
Upgrade,
/// <summary>The Via header, which specifies intermediate protocols to be used by gateway and proxy agents.</summary>
// Token: 0x040010D3 RID: 4307
Via,
/// <summary>The Warning header, which specifies additional information about that status or transformation of a message that might not be reflected in the message.</summary>
// Token: 0x040010D4 RID: 4308
Warning,
/// <summary>The Allow header, which specifies the set of HTTP methods that are supported.</summary>
// Token: 0x040010D5 RID: 4309
Allow,
/// <summary>The Content-Length header, which specifies the length, in bytes, of the accompanying body data.</summary>
// Token: 0x040010D6 RID: 4310
ContentLength,
/// <summary>The Content-Type header, which specifies the MIME type of the accompanying body data.</summary>
// Token: 0x040010D7 RID: 4311
ContentType,
/// <summary>The Content-Encoding header, which specifies the encodings that have been applied to the accompanying body data.</summary>
// Token: 0x040010D8 RID: 4312
ContentEncoding,
/// <summary>The Content-Langauge header, which specifies the natural language or languages of the accompanying body data.</summary>
// Token: 0x040010D9 RID: 4313
ContentLanguage,
/// <summary>The Content-Location header, which specifies a URI from which the accompanying body can be obtained.</summary>
// Token: 0x040010DA RID: 4314
ContentLocation,
/// <summary>The Content-MD5 header, which specifies the MD5 digest of the accompanying body data, for the purpose of providing an end-to-end message integrity check.</summary>
// Token: 0x040010DB RID: 4315
ContentMd5,
/// <summary>The Range header, which specifies the subrange or subranges of the response that the client requests be returned in lieu of the entire response.</summary>
// Token: 0x040010DC RID: 4316
ContentRange,
/// <summary>The Expires header, which specifies the date and time after which the accompanying body data should be considered stale.</summary>
// Token: 0x040010DD RID: 4317
Expires,
/// <summary>The Last-Modified header, which specifies the date and time at which the accompanying body data was last modified.</summary>
// Token: 0x040010DE RID: 4318
LastModified,
/// <summary>The Accept-Ranges header, which specifies the range that is accepted by the server.</summary>
// Token: 0x040010DF RID: 4319
AcceptRanges,
/// <summary>The Age header, which specifies the time, in seconds, since the response was generated by the originating server.</summary>
// Token: 0x040010E0 RID: 4320
Age,
/// <summary>The Etag header, which specifies the current value for the requested variant. </summary>
// Token: 0x040010E1 RID: 4321
ETag,
/// <summary>The Location header, which specifies a URI to which the client is redirected to obtain the requested resource.</summary>
// Token: 0x040010E2 RID: 4322
Location,
/// <summary>The Proxy-Authenticate header, which specifies that the client must authenticate itself to a proxy.</summary>
// Token: 0x040010E3 RID: 4323
ProxyAuthenticate,
/// <summary>The Retry-After header, which specifies a time (in seconds), or a date and time, after which the client can retry its request.</summary>
// Token: 0x040010E4 RID: 4324
RetryAfter,
/// <summary>The Server header, which specifies information about the originating server agent.</summary>
// Token: 0x040010E5 RID: 4325
Server,
/// <summary>The Set-Cookie header, which specifies cookie data that is presented to the client.</summary>
// Token: 0x040010E6 RID: 4326
SetCookie,
/// <summary>The Vary header, which specifies the request headers that are used to determine whether a cached response is fresh.</summary>
// Token: 0x040010E7 RID: 4327
Vary,
/// <summary>The WWW-Authenticate header, which specifies that the client must authenticate itself to the server.</summary>
// Token: 0x040010E8 RID: 4328
WwwAuthenticate
}
}
+148
View File
@@ -0,0 +1,148 @@
using System;
namespace System.Net
{
/// <summary>Contains the values of status codes defined for HTTP.</summary>
// Token: 0x02000234 RID: 564
public enum HttpStatusCode
{
/// <summary>Equivalent to HTTP status 100. <see cref="F:System.Net.HttpStatusCode.Continue" /> indicates that the client can continue with its request.</summary>
// Token: 0x040010EA RID: 4330
Continue = 100,
/// <summary>Equivalent to HTTP status 101. <see cref="F:System.Net.HttpStatusCode.SwitchingProtocols" /> indicates that the protocol version or protocol is being changed.</summary>
// Token: 0x040010EB RID: 4331
SwitchingProtocols,
/// <summary>Equivalent to HTTP status 200. <see cref="F:System.Net.HttpStatusCode.OK" /> indicates that the request succeeded and that the requested information is in the response. This is the most common status code to receive.</summary>
// Token: 0x040010EC RID: 4332
OK = 200,
/// <summary>Equivalent to HTTP status 201. <see cref="F:System.Net.HttpStatusCode.Created" /> indicates that the request resulted in a new resource created before the response was sent.</summary>
// Token: 0x040010ED RID: 4333
Created,
/// <summary>Equivalent to HTTP status 202. <see cref="F:System.Net.HttpStatusCode.Accepted" /> indicates that the request has been accepted for further processing.</summary>
// Token: 0x040010EE RID: 4334
Accepted,
/// <summary>Equivalent to HTTP status 203. <see cref="F:System.Net.HttpStatusCode.NonAuthoritativeInformation" /> indicates that the returned metainformation is from a cached copy instead of the origin server and therefore may be incorrect.</summary>
// Token: 0x040010EF RID: 4335
NonAuthoritativeInformation,
/// <summary>Equivalent to HTTP status 204. <see cref="F:System.Net.HttpStatusCode.NoContent" /> indicates that the request has been successfully processed and that the response is intentionally blank.</summary>
// Token: 0x040010F0 RID: 4336
NoContent,
/// <summary>Equivalent to HTTP status 205. <see cref="F:System.Net.HttpStatusCode.ResetContent" /> indicates that the client should reset (not reload) the current resource.</summary>
// Token: 0x040010F1 RID: 4337
ResetContent,
/// <summary>Equivalent to HTTP status 206. <see cref="F:System.Net.HttpStatusCode.PartialContent" /> indicates that the response is a partial response as requested by a GET request that includes a byte range.</summary>
// Token: 0x040010F2 RID: 4338
PartialContent,
/// <summary>Equivalent to HTTP status 300. <see cref="F:System.Net.HttpStatusCode.MultipleChoices" /> indicates that the requested information has multiple representations. The default action is to treat this status as a redirect and follow the contents of the Location header associated with this response.</summary>
// Token: 0x040010F3 RID: 4339
MultipleChoices = 300,
/// <summary>Equivalent to HTTP status 300. <see cref="F:System.Net.HttpStatusCode.Ambiguous" /> indicates that the requested information has multiple representations. The default action is to treat this status as a redirect and follow the contents of the Location header associated with this response.</summary>
// Token: 0x040010F4 RID: 4340
Ambiguous = 300,
/// <summary>Equivalent to HTTP status 301. <see cref="F:System.Net.HttpStatusCode.MovedPermanently" /> indicates that the requested information has been moved to the URI specified in the Location header. The default action when this status is received is to follow the Location header associated with the response.</summary>
// Token: 0x040010F5 RID: 4341
MovedPermanently,
/// <summary>Equivalent to HTTP status 301. <see cref="F:System.Net.HttpStatusCode.Moved" /> indicates that the requested information has been moved to the URI specified in the Location header. The default action when this status is received is to follow the Location header associated with the response. When the original request method was POST, the redirected request will use the GET method.</summary>
// Token: 0x040010F6 RID: 4342
Moved = 301,
/// <summary>Equivalent to HTTP status 302. <see cref="F:System.Net.HttpStatusCode.Found" /> indicates that the requested information is located at the URI specified in the Location header. The default action when this status is received is to follow the Location header associated with the response. When the original request method was POST, the redirected request will use the GET method.</summary>
// Token: 0x040010F7 RID: 4343
Found,
/// <summary>Equivalent to HTTP status 302. <see cref="F:System.Net.HttpStatusCode.Redirect" /> indicates that the requested information is located at the URI specified in the Location header. The default action when this status is received is to follow the Location header associated with the response. When the original request method was POST, the redirected request will use the GET method.</summary>
// Token: 0x040010F8 RID: 4344
Redirect = 302,
/// <summary>Equivalent to HTTP status 303. <see cref="F:System.Net.HttpStatusCode.SeeOther" /> automatically redirects the client to the URI specified in the Location header as the result of a POST. The request to the resource specified by the Location header will be made with a GET.</summary>
// Token: 0x040010F9 RID: 4345
SeeOther,
/// <summary>Equivalent to HTTP status 303. <see cref="F:System.Net.HttpStatusCode.RedirectMethod" /> automatically redirects the client to the URI specified in the Location header as the result of a POST. The request to the resource specified by the Location header will be made with a GET.</summary>
// Token: 0x040010FA RID: 4346
RedirectMethod = 303,
/// <summary>Equivalent to HTTP status 304. <see cref="F:System.Net.HttpStatusCode.NotModified" /> indicates that the client's cached copy is up to date. The contents of the resource are not transferred.</summary>
// Token: 0x040010FB RID: 4347
NotModified,
/// <summary>Equivalent to HTTP status 305. <see cref="F:System.Net.HttpStatusCode.UseProxy" /> indicates that the request should use the proxy server at the URI specified in the Location header.</summary>
// Token: 0x040010FC RID: 4348
UseProxy,
/// <summary>Equivalent to HTTP status 306. <see cref="F:System.Net.HttpStatusCode.Unused" /> is a proposed extension to the HTTP/1.1 specification that is not fully specified.</summary>
// Token: 0x040010FD RID: 4349
Unused,
/// <summary>Equivalent to HTTP status 307. <see cref="F:System.Net.HttpStatusCode.TemporaryRedirect" /> indicates that the request information is located at the URI specified in the Location header. The default action when this status is received is to follow the Location header associated with the response. When the original request method was POST, the redirected request will also use the POST method.</summary>
// Token: 0x040010FE RID: 4350
TemporaryRedirect,
/// <summary>Equivalent to HTTP status 307. <see cref="F:System.Net.HttpStatusCode.RedirectKeepVerb" /> indicates that the request information is located at the URI specified in the Location header. The default action when this status is received is to follow the Location header associated with the response. When the original request method was POST, the redirected request will also use the POST method.</summary>
// Token: 0x040010FF RID: 4351
RedirectKeepVerb = 307,
/// <summary>Equivalent to HTTP status 400. <see cref="F:System.Net.HttpStatusCode.BadRequest" /> indicates that the request could not be understood by the server. <see cref="F:System.Net.HttpStatusCode.BadRequest" /> is sent when no other error is applicable, or if the exact error is unknown or does not have its own error code.</summary>
// Token: 0x04001100 RID: 4352
BadRequest = 400,
/// <summary>Equivalent to HTTP status 401. <see cref="F:System.Net.HttpStatusCode.Unauthorized" /> indicates that the requested resource requires authentication. The WWW-Authenticate header contains the details of how to perform the authentication.</summary>
// Token: 0x04001101 RID: 4353
Unauthorized,
/// <summary>Equivalent to HTTP status 402. <see cref="F:System.Net.HttpStatusCode.PaymentRequired" /> is reserved for future use.</summary>
// Token: 0x04001102 RID: 4354
PaymentRequired,
/// <summary>Equivalent to HTTP status 403. <see cref="F:System.Net.HttpStatusCode.Forbidden" /> indicates that the server refuses to fulfill the request.</summary>
// Token: 0x04001103 RID: 4355
Forbidden,
/// <summary>Equivalent to HTTP status 404. <see cref="F:System.Net.HttpStatusCode.NotFound" /> indicates that the requested resource does not exist on the server.</summary>
// Token: 0x04001104 RID: 4356
NotFound,
/// <summary>Equivalent to HTTP status 405. <see cref="F:System.Net.HttpStatusCode.MethodNotAllowed" /> indicates that the request method (POST or GET) is not allowed on the requested resource.</summary>
// Token: 0x04001105 RID: 4357
MethodNotAllowed,
/// <summary>Equivalent to HTTP status 406. <see cref="F:System.Net.HttpStatusCode.NotAcceptable" /> indicates that the client has indicated with Accept headers that it will not accept any of the available representations of the resource.</summary>
// Token: 0x04001106 RID: 4358
NotAcceptable,
/// <summary>Equivalent to HTTP status 407. <see cref="F:System.Net.HttpStatusCode.ProxyAuthenticationRequired" /> indicates that the requested proxy requires authentication. The Proxy-authenticate header contains the details of how to perform the authentication.</summary>
// Token: 0x04001107 RID: 4359
ProxyAuthenticationRequired,
/// <summary>Equivalent to HTTP status 408. <see cref="F:System.Net.HttpStatusCode.RequestTimeout" /> indicates that the client did not send a request within the time the server was expecting the request.</summary>
// Token: 0x04001108 RID: 4360
RequestTimeout,
/// <summary>Equivalent to HTTP status 409. <see cref="F:System.Net.HttpStatusCode.Conflict" /> indicates that the request could not be carried out because of a conflict on the server.</summary>
// Token: 0x04001109 RID: 4361
Conflict,
/// <summary>Equivalent to HTTP status 410. <see cref="F:System.Net.HttpStatusCode.Gone" /> indicates that the requested resource is no longer available.</summary>
// Token: 0x0400110A RID: 4362
Gone,
/// <summary>Equivalent to HTTP status 411. <see cref="F:System.Net.HttpStatusCode.LengthRequired" /> indicates that the required Content-length header is missing.</summary>
// Token: 0x0400110B RID: 4363
LengthRequired,
/// <summary>Equivalent to HTTP status 412. <see cref="F:System.Net.HttpStatusCode.PreconditionFailed" /> indicates that a condition set for this request failed, and the request cannot be carried out. Conditions are set with conditional request headers like If-Match, If-None-Match, or If-Unmodified-Since.</summary>
// Token: 0x0400110C RID: 4364
PreconditionFailed,
/// <summary>Equivalent to HTTP status 413. <see cref="F:System.Net.HttpStatusCode.RequestEntityTooLarge" /> indicates that the request is too large for the server to process.</summary>
// Token: 0x0400110D RID: 4365
RequestEntityTooLarge,
/// <summary>Equivalent to HTTP status 414. <see cref="F:System.Net.HttpStatusCode.RequestUriTooLong" /> indicates that the URI is too long.</summary>
// Token: 0x0400110E RID: 4366
RequestUriTooLong,
/// <summary>Equivalent to HTTP status 415. <see cref="F:System.Net.HttpStatusCode.UnsupportedMediaType" /> indicates that the request is an unsupported type.</summary>
// Token: 0x0400110F RID: 4367
UnsupportedMediaType,
/// <summary>Equivalent to HTTP status 416. <see cref="F:System.Net.HttpStatusCode.RequestedRangeNotSatisfiable" /> indicates that the range of data requested from the resource cannot be returned, either because the beginning of the range is before the beginning of the resource, or the end of the range is after the end of the resource.</summary>
// Token: 0x04001110 RID: 4368
RequestedRangeNotSatisfiable,
/// <summary>Equivalent to HTTP status 417. <see cref="F:System.Net.HttpStatusCode.ExpectationFailed" /> indicates that an expectation given in an Expect header could not be met by the server.</summary>
// Token: 0x04001111 RID: 4369
ExpectationFailed,
/// <summary>Equivalent to HTTP status 500. <see cref="F:System.Net.HttpStatusCode.InternalServerError" /> indicates that a generic error has occurred on the server.</summary>
// Token: 0x04001112 RID: 4370
InternalServerError = 500,
/// <summary>Equivalent to HTTP status 501. <see cref="F:System.Net.HttpStatusCode.NotImplemented" /> indicates that the server does not support the requested function.</summary>
// Token: 0x04001113 RID: 4371
NotImplemented,
/// <summary>Equivalent to HTTP status 502. <see cref="F:System.Net.HttpStatusCode.BadGateway" /> indicates that an intermediate proxy server received a bad response from another proxy or the origin server.</summary>
// Token: 0x04001114 RID: 4372
BadGateway,
/// <summary>Equivalent to HTTP status 503. <see cref="F:System.Net.HttpStatusCode.ServiceUnavailable" /> indicates that the server is temporarily unavailable, usually due to high load or maintenance.</summary>
// Token: 0x04001115 RID: 4373
ServiceUnavailable,
/// <summary>Equivalent to HTTP status 504. <see cref="F:System.Net.HttpStatusCode.GatewayTimeout" /> indicates that an intermediate proxy server timed out while waiting for a response from another proxy or the origin server.</summary>
// Token: 0x04001116 RID: 4374
GatewayTimeout,
/// <summary>Equivalent to HTTP status 505. <see cref="F:System.Net.HttpStatusCode.HttpVersionNotSupported" /> indicates that the requested HTTP version is not supported by the server.</summary>
// Token: 0x04001117 RID: 4375
HttpVersionNotSupported
}
}
+121
View File
@@ -0,0 +1,121 @@
using System;
using System.Threading;
namespace System.Net
{
// Token: 0x02000235 RID: 565
internal class HttpStreamAsyncResult : IAsyncResult
{
// Token: 0x060013C1 RID: 5057 RVA: 0x0003D324 File Offset: 0x0003B524
public void Complete(Exception e)
{
this.Error = e;
this.Complete();
}
// Token: 0x060013C2 RID: 5058 RVA: 0x0003D334 File Offset: 0x0003B534
public void Complete()
{
object obj = this.locker;
lock (obj)
{
if (!this.completed)
{
this.completed = true;
if (this.handle != null)
{
this.handle.Set();
}
if (this.Callback != null)
{
this.Callback.BeginInvoke(this, null, null);
}
}
}
}
// Token: 0x17000672 RID: 1650
// (get) Token: 0x060013C3 RID: 5059 RVA: 0x0003D3C0 File Offset: 0x0003B5C0
public object AsyncState
{
get
{
return this.State;
}
}
// Token: 0x17000673 RID: 1651
// (get) Token: 0x060013C4 RID: 5060 RVA: 0x0003D3C8 File Offset: 0x0003B5C8
public WaitHandle AsyncWaitHandle
{
get
{
object obj = this.locker;
lock (obj)
{
if (this.handle == null)
{
this.handle = new ManualResetEvent(this.completed);
}
}
return this.handle;
}
}
// Token: 0x17000674 RID: 1652
// (get) Token: 0x060013C5 RID: 5061 RVA: 0x0003D42C File Offset: 0x0003B62C
public bool CompletedSynchronously
{
get
{
return this.SynchRead == this.Count;
}
}
// Token: 0x17000675 RID: 1653
// (get) Token: 0x060013C6 RID: 5062 RVA: 0x0003D43C File Offset: 0x0003B63C
public bool IsCompleted
{
get
{
object obj = this.locker;
bool flag;
lock (obj)
{
flag = this.completed;
}
return flag;
}
}
// Token: 0x04001118 RID: 4376
private object locker = new object();
// Token: 0x04001119 RID: 4377
private ManualResetEvent handle;
// Token: 0x0400111A RID: 4378
private bool completed;
// Token: 0x0400111B RID: 4379
internal byte[] Buffer;
// Token: 0x0400111C RID: 4380
internal int Offset;
// Token: 0x0400111D RID: 4381
internal int Count;
// Token: 0x0400111E RID: 4382
internal AsyncCallback Callback;
// Token: 0x0400111F RID: 4383
internal object State;
// Token: 0x04001120 RID: 4384
internal int SynchRead;
// Token: 0x04001121 RID: 4385
internal Exception Error;
}
}
+93
View File
@@ -0,0 +1,93 @@
using System;
using System.Globalization;
using System.IO;
using System.Text;
namespace System.Net
{
// Token: 0x02000236 RID: 566
internal sealed class HttpUtility
{
// Token: 0x060013C7 RID: 5063 RVA: 0x0003D48C File Offset: 0x0003B68C
private HttpUtility()
{
}
// Token: 0x060013C8 RID: 5064 RVA: 0x0003D494 File Offset: 0x0003B694
public static string UrlDecode(string s)
{
return HttpUtility.UrlDecode(s, null);
}
// Token: 0x060013C9 RID: 5065 RVA: 0x0003D4A0 File Offset: 0x0003B6A0
private static char[] GetChars(MemoryStream b, Encoding e)
{
return e.GetChars(b.GetBuffer(), 0, (int)b.Length);
}
// Token: 0x060013CA RID: 5066 RVA: 0x0003D4C4 File Offset: 0x0003B6C4
public static string UrlDecode(string s, Encoding e)
{
if (s == null)
{
return null;
}
if (s.IndexOf('%') == -1 && s.IndexOf('+') == -1)
{
return s;
}
if (e == null)
{
e = Encoding.GetEncoding(28591);
}
StringBuilder stringBuilder = new StringBuilder();
long num = (long)s.Length;
NumberStyles numberStyles = NumberStyles.HexNumber;
MemoryStream memoryStream = new MemoryStream();
int num2 = 0;
while ((long)num2 < num)
{
if (s[num2] == '%' && (long)(num2 + 2) < num)
{
if (s[num2 + 1] == 'u' && (long)(num2 + 5) < num)
{
if (memoryStream.Length > 0L)
{
stringBuilder.Append(HttpUtility.GetChars(memoryStream, e));
memoryStream.SetLength(0L);
}
stringBuilder.Append((char)int.Parse(s.Substring(num2 + 2, 4), numberStyles));
num2 += 5;
}
else
{
memoryStream.WriteByte((byte)int.Parse(s.Substring(num2 + 1, 2), numberStyles));
num2 += 2;
}
}
else
{
if (memoryStream.Length > 0L)
{
stringBuilder.Append(HttpUtility.GetChars(memoryStream, e));
memoryStream.SetLength(0L);
}
if (s[num2] == '+')
{
stringBuilder.Append(' ');
}
else
{
stringBuilder.Append(s[num2]);
}
}
num2++;
}
if (memoryStream.Length > 0L)
{
stringBuilder.Append(HttpUtility.GetChars(memoryStream, e));
}
return stringBuilder.ToString();
}
}
}
+17
View File
@@ -0,0 +1,17 @@
using System;
namespace System.Net
{
/// <summary>Defines the HTTP version numbers that are supported by the <see cref="T:System.Net.HttpWebRequest" /> and <see cref="T:System.Net.HttpWebResponse" /> classes.</summary>
// Token: 0x02000237 RID: 567
public class HttpVersion
{
/// <summary>Defines a <see cref="T:System.Version" /> instance for HTTP 1.0.</summary>
// Token: 0x04001122 RID: 4386
public static readonly Version Version10 = new Version(1, 0);
/// <summary>Defines a <see cref="T:System.Version" /> instance for HTTP 1.1.</summary>
// Token: 0x04001123 RID: 4387
public static readonly Version Version11 = new Version(1, 1);
}
}
+2327
View File
@@ -0,0 +1,2327 @@
using System;
using System.IO;
using System.Net.Cache;
using System.Runtime.Serialization;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading;
namespace System.Net
{
/// <summary>Provides an HTTP-specific implementation of the <see cref="T:System.Net.WebRequest" /> class.</summary>
// Token: 0x02000238 RID: 568
[Serializable]
public class HttpWebRequest : WebRequest, ISerializable
{
// Token: 0x060013CD RID: 5069 RVA: 0x0003D670 File Offset: 0x0003B870
public HttpWebRequest(global::System.Uri uri)
{
this.requestUri = uri;
this.actualUri = uri;
this.proxy = GlobalProxySelection.Select;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.HttpWebRequest" /> class from the specified instances of the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> and <see cref="T:System.Runtime.Serialization.StreamingContext" /> classes.</summary>
/// <param name="serializationInfo">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object that contains the information required to serialize the new <see cref="T:System.Net.HttpWebRequest" /> object. </param>
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> object that contains the source and destination of the serialized stream associated with the new <see cref="T:System.Net.HttpWebRequest" /> object. </param>
// Token: 0x060013CE RID: 5070 RVA: 0x0003D724 File Offset: 0x0003B924
[Obsolete("Serialization is obsoleted for this type", false)]
protected HttpWebRequest(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
this.requestUri = (global::System.Uri)serializationInfo.GetValue("requestUri", typeof(global::System.Uri));
this.actualUri = (global::System.Uri)serializationInfo.GetValue("actualUri", typeof(global::System.Uri));
this.allowAutoRedirect = serializationInfo.GetBoolean("allowAutoRedirect");
this.allowBuffering = serializationInfo.GetBoolean("allowBuffering");
this.certificates = (global::System.Security.Cryptography.X509Certificates.X509CertificateCollection)serializationInfo.GetValue("certificates", typeof(global::System.Security.Cryptography.X509Certificates.X509CertificateCollection));
this.connectionGroup = serializationInfo.GetString("connectionGroup");
this.contentLength = serializationInfo.GetInt64("contentLength");
this.webHeaders = (WebHeaderCollection)serializationInfo.GetValue("webHeaders", typeof(WebHeaderCollection));
this.keepAlive = serializationInfo.GetBoolean("keepAlive");
this.maxAutoRedirect = serializationInfo.GetInt32("maxAutoRedirect");
this.mediaType = serializationInfo.GetString("mediaType");
this.method = serializationInfo.GetString("method");
this.initialMethod = serializationInfo.GetString("initialMethod");
this.pipelined = serializationInfo.GetBoolean("pipelined");
this.version = (Version)serializationInfo.GetValue("version", typeof(Version));
this.proxy = (IWebProxy)serializationInfo.GetValue("proxy", typeof(IWebProxy));
this.sendChunked = serializationInfo.GetBoolean("sendChunked");
this.timeout = serializationInfo.GetInt32("timeout");
this.redirects = serializationInfo.GetInt32("redirects");
}
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with the data needed to serialize the target object.</summary>
/// <param name="serializationInfo">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> to populate with data. </param>
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> that specifies the destination for this serialization.</param>
// Token: 0x060013D0 RID: 5072 RVA: 0x0003D968 File Offset: 0x0003BB68
void ISerializable.GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
this.GetObjectData(serializationInfo, streamingContext);
}
// Token: 0x17000676 RID: 1654
// (get) Token: 0x060013D1 RID: 5073 RVA: 0x0003D974 File Offset: 0x0003BB74
internal bool UsesNtlmAuthentication
{
get
{
return this.is_ntlm_auth;
}
}
/// <summary>Gets or sets the value of the Accept HTTP header.</summary>
/// <returns>The value of the Accept HTTP header. The default value is null.</returns>
// Token: 0x17000677 RID: 1655
// (get) Token: 0x060013D2 RID: 5074 RVA: 0x0003D97C File Offset: 0x0003BB7C
// (set) Token: 0x060013D3 RID: 5075 RVA: 0x0003D990 File Offset: 0x0003BB90
public string Accept
{
get
{
return this.webHeaders["Accept"];
}
set
{
this.CheckRequestStarted();
this.webHeaders.RemoveAndAdd("Accept", value);
}
}
/// <summary>Gets the Uniform Resource Identifier (URI) of the Internet resource that actually responds to the request.</summary>
/// <returns>A <see cref="T:System.Uri" /> that identifies the Internet resource that actually responds to the request. The default is the URI used by the <see cref="M:System.Net.WebRequest.Create(System.String)" /> method to initialize the request.</returns>
// Token: 0x17000678 RID: 1656
// (get) Token: 0x060013D4 RID: 5076 RVA: 0x0003D9AC File Offset: 0x0003BBAC
public global::System.Uri Address
{
get
{
return this.actualUri;
}
}
/// <summary>Gets or sets a value that indicates whether the request should follow redirection responses.</summary>
/// <returns>true if the request should automatically follow redirection responses from the Internet resource; otherwise, false. The default value is true.</returns>
// Token: 0x17000679 RID: 1657
// (get) Token: 0x060013D5 RID: 5077 RVA: 0x0003D9B4 File Offset: 0x0003BBB4
// (set) Token: 0x060013D6 RID: 5078 RVA: 0x0003D9BC File Offset: 0x0003BBBC
public bool AllowAutoRedirect
{
get
{
return this.allowAutoRedirect;
}
set
{
this.allowAutoRedirect = value;
}
}
/// <summary>Gets or sets a value that indicates whether to buffer the data sent to the Internet resource.</summary>
/// <returns>true to enable buffering of the data sent to the Internet resource; false to disable buffering. The default is true.</returns>
// Token: 0x1700067A RID: 1658
// (get) Token: 0x060013D7 RID: 5079 RVA: 0x0003D9C8 File Offset: 0x0003BBC8
// (set) Token: 0x060013D8 RID: 5080 RVA: 0x0003D9D0 File Offset: 0x0003BBD0
public bool AllowWriteStreamBuffering
{
get
{
return this.allowBuffering;
}
set
{
this.allowBuffering = value;
}
}
// Token: 0x060013D9 RID: 5081 RVA: 0x0003D9DC File Offset: 0x0003BBDC
private static Exception GetMustImplement()
{
return new NotImplementedException();
}
/// <summary>Gets or sets the type of decompression that is used.</summary>
/// <returns>A T:System.Net.DecompressionMethods object that indicates the type of decompression that is used. </returns>
/// <exception cref="T:System.InvalidOperationException">The object's current state does not allow this property to be set.</exception>
// Token: 0x1700067B RID: 1659
// (get) Token: 0x060013DA RID: 5082 RVA: 0x0003D9E4 File Offset: 0x0003BBE4
// (set) Token: 0x060013DB RID: 5083 RVA: 0x0003D9EC File Offset: 0x0003BBEC
public DecompressionMethods AutomaticDecompression
{
get
{
return this.auto_decomp;
}
set
{
this.CheckRequestStarted();
this.auto_decomp = value;
}
}
// Token: 0x1700067C RID: 1660
// (get) Token: 0x060013DC RID: 5084 RVA: 0x0003D9FC File Offset: 0x0003BBFC
internal bool InternalAllowBuffering
{
get
{
return this.allowBuffering && (this.method != "HEAD" && this.method != "GET" && this.method != "MKCOL" && this.method != "CONNECT" && this.method != "DELETE") && this.method != "TRACE";
}
}
/// <summary>Gets or sets the collection of security certificates that are associated with this request.</summary>
/// <returns>The <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" /> that contains the security certificates associated with this request.</returns>
/// <exception cref="T:System.ArgumentNullException">The value specified for a set operation is null. </exception>
// Token: 0x1700067D RID: 1661
// (get) Token: 0x060013DD RID: 5085 RVA: 0x0003DA94 File Offset: 0x0003BC94
// (set) Token: 0x060013DE RID: 5086 RVA: 0x0003DAB4 File Offset: 0x0003BCB4
public global::System.Security.Cryptography.X509Certificates.X509CertificateCollection ClientCertificates
{
get
{
if (this.certificates == null)
{
this.certificates = new global::System.Security.Cryptography.X509Certificates.X509CertificateCollection();
}
return this.certificates;
}
[global::System.MonoTODO]
set
{
throw HttpWebRequest.GetMustImplement();
}
}
/// <summary>Gets or sets the value of the Connection HTTP header.</summary>
/// <returns>The value of the Connection HTTP header. The default value is null.</returns>
/// <exception cref="T:System.ArgumentException">The value of <see cref="P:System.Net.HttpWebRequest.Connection" /> is set to Keep-alive or Close. </exception>
// Token: 0x1700067E RID: 1662
// (get) Token: 0x060013DF RID: 5087 RVA: 0x0003DABC File Offset: 0x0003BCBC
// (set) Token: 0x060013E0 RID: 5088 RVA: 0x0003DAD0 File Offset: 0x0003BCD0
public string Connection
{
get
{
return this.webHeaders["Connection"];
}
set
{
this.CheckRequestStarted();
string text = value;
if (text != null)
{
text = text.Trim().ToLower();
}
if (text == null || text.Length == 0)
{
this.webHeaders.RemoveInternal("Connection");
return;
}
if (text == "keep-alive" || text == "close")
{
throw new ArgumentException("Keep-Alive and Close may not be set with this property");
}
if (this.keepAlive && text.IndexOf("keep-alive") == -1)
{
value += ", Keep-Alive";
}
this.webHeaders.RemoveAndAdd("Connection", value);
}
}
/// <summary>Gets or sets the name of the connection group for the request.</summary>
/// <returns>The name of the connection group for this request. The default value is null.</returns>
// Token: 0x1700067F RID: 1663
// (get) Token: 0x060013E1 RID: 5089 RVA: 0x0003DB80 File Offset: 0x0003BD80
// (set) Token: 0x060013E2 RID: 5090 RVA: 0x0003DB88 File Offset: 0x0003BD88
public override string ConnectionGroupName
{
get
{
return this.connectionGroup;
}
set
{
this.connectionGroup = value;
}
}
/// <summary>Gets or sets the Content-length HTTP header.</summary>
/// <returns>The number of bytes of data to send to the Internet resource. The default is -1, which indicates the property has not been set and that there is no request data to send.</returns>
/// <exception cref="T:System.InvalidOperationException">The request has been started by calling the <see cref="M:System.Net.HttpWebRequest.GetRequestStream" />, <see cref="M:System.Net.HttpWebRequest.BeginGetRequestStream(System.AsyncCallback,System.Object)" />, <see cref="M:System.Net.HttpWebRequest.GetResponse" />, or <see cref="M:System.Net.HttpWebRequest.BeginGetResponse(System.AsyncCallback,System.Object)" /> method. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The new <see cref="P:System.Net.HttpWebRequest.ContentLength" /> value is less than 0. </exception>
// Token: 0x17000680 RID: 1664
// (get) Token: 0x060013E3 RID: 5091 RVA: 0x0003DB94 File Offset: 0x0003BD94
// (set) Token: 0x060013E4 RID: 5092 RVA: 0x0003DB9C File Offset: 0x0003BD9C
public override long ContentLength
{
get
{
return this.contentLength;
}
set
{
this.CheckRequestStarted();
if (value < 0L)
{
throw new ArgumentOutOfRangeException("value", "Content-Length must be >= 0");
}
this.contentLength = value;
}
}
// Token: 0x17000681 RID: 1665
// (set) Token: 0x060013E5 RID: 5093 RVA: 0x0003DBC4 File Offset: 0x0003BDC4
internal long InternalContentLength
{
set
{
this.contentLength = value;
}
}
/// <summary>Gets or sets the value of the Content-type HTTP header.</summary>
/// <returns>The value of the Content-type HTTP header. The default value is null.</returns>
// Token: 0x17000682 RID: 1666
// (get) Token: 0x060013E6 RID: 5094 RVA: 0x0003DBD0 File Offset: 0x0003BDD0
// (set) Token: 0x060013E7 RID: 5095 RVA: 0x0003DBE4 File Offset: 0x0003BDE4
public override string ContentType
{
get
{
return this.webHeaders["Content-Type"];
}
set
{
if (value == null || value.Trim().Length == 0)
{
this.webHeaders.RemoveInternal("Content-Type");
return;
}
this.webHeaders.RemoveAndAdd("Content-Type", value);
}
}
/// <summary>Gets or sets the delegate method called when an HTTP 100-continue response is received from the Internet resource.</summary>
/// <returns>A delegate that implements the callback method that executes when an HTTP Continue response is returned from the Internet resource. The default value is null.</returns>
// Token: 0x17000683 RID: 1667
// (get) Token: 0x060013E8 RID: 5096 RVA: 0x0003DC2C File Offset: 0x0003BE2C
// (set) Token: 0x060013E9 RID: 5097 RVA: 0x0003DC34 File Offset: 0x0003BE34
public HttpContinueDelegate ContinueDelegate
{
get
{
return this.continueDelegate;
}
set
{
this.continueDelegate = value;
}
}
/// <summary>Gets or sets the cookies associated with the request.</summary>
/// <returns>A <see cref="T:System.Net.CookieContainer" /> that contains the cookies associated with this request.</returns>
// Token: 0x17000684 RID: 1668
// (get) Token: 0x060013EA RID: 5098 RVA: 0x0003DC40 File Offset: 0x0003BE40
// (set) Token: 0x060013EB RID: 5099 RVA: 0x0003DC48 File Offset: 0x0003BE48
public CookieContainer CookieContainer
{
get
{
return this.cookieContainer;
}
set
{
this.cookieContainer = value;
}
}
/// <summary>Gets or sets authentication information for the request.</summary>
/// <returns>An <see cref="T:System.Net.ICredentials" /> that contains the authentication credentials associated with the request. The default is null.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x17000685 RID: 1669
// (get) Token: 0x060013EC RID: 5100 RVA: 0x0003DC54 File Offset: 0x0003BE54
// (set) Token: 0x060013ED RID: 5101 RVA: 0x0003DC5C File Offset: 0x0003BE5C
public override ICredentials Credentials
{
get
{
return this.credentials;
}
set
{
this.credentials = value;
}
}
/// <summary>Gets or sets the default cache policy for this request.</summary>
/// <returns>A <see cref="T:System.Net.Cache.HttpRequestCachePolicy" /> that specifies the cache policy in effect for this request when no other policy is applicable.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
/// <IPermission class="System.Net.WebPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x17000686 RID: 1670
// (get) Token: 0x060013EE RID: 5102 RVA: 0x0003DC68 File Offset: 0x0003BE68
// (set) Token: 0x060013EF RID: 5103 RVA: 0x0003DC70 File Offset: 0x0003BE70
[global::System.MonoTODO]
public new static global::System.Net.Cache.RequestCachePolicy DefaultCachePolicy
{
get
{
throw HttpWebRequest.GetMustImplement();
}
set
{
throw HttpWebRequest.GetMustImplement();
}
}
/// <summary>Gets or sets the default maximum length of an HTTP error response.</summary>
/// <returns>An integer that represents the default maximum length of an HTTP error response.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value is less than 0 and is not equal to -1. </exception>
// Token: 0x17000687 RID: 1671
// (get) Token: 0x060013F0 RID: 5104 RVA: 0x0003DC78 File Offset: 0x0003BE78
// (set) Token: 0x060013F1 RID: 5105 RVA: 0x0003DC80 File Offset: 0x0003BE80
[global::System.MonoTODO]
public static int DefaultMaximumErrorResponseLength
{
get
{
throw HttpWebRequest.GetMustImplement();
}
set
{
throw HttpWebRequest.GetMustImplement();
}
}
/// <summary>Gets or sets the value of the Expect HTTP header.</summary>
/// <returns>The contents of the Expect HTTP header. The default value is null.Note:The value for this property is stored in <see cref="T:System.Net.WebHeaderCollection" />. If WebHeaderCollection is set, the property value is lost.</returns>
/// <exception cref="T:System.ArgumentException">Expect is set to a string that contains "100-continue" as a substring. </exception>
// Token: 0x17000688 RID: 1672
// (get) Token: 0x060013F2 RID: 5106 RVA: 0x0003DC88 File Offset: 0x0003BE88
// (set) Token: 0x060013F3 RID: 5107 RVA: 0x0003DC9C File Offset: 0x0003BE9C
public string Expect
{
get
{
return this.webHeaders["Expect"];
}
set
{
this.CheckRequestStarted();
string text = value;
if (text != null)
{
text = text.Trim().ToLower();
}
if (text == null || text.Length == 0)
{
this.webHeaders.RemoveInternal("Expect");
return;
}
if (text == "100-continue")
{
throw new ArgumentException("100-Continue cannot be set with this property.", "value");
}
this.webHeaders.RemoveAndAdd("Expect", value);
}
}
/// <summary>Gets a value that indicates whether a response has been received from an Internet resource.</summary>
/// <returns>true if a response has been received; otherwise, false.</returns>
// Token: 0x17000689 RID: 1673
// (get) Token: 0x060013F4 RID: 5108 RVA: 0x0003DD18 File Offset: 0x0003BF18
public bool HaveResponse
{
get
{
return this.haveResponse;
}
}
/// <summary>Specifies a collection of the name/value pairs that make up the HTTP headers.</summary>
/// <returns>A <see cref="T:System.Net.WebHeaderCollection" /> that contains the name/value pairs that make up the headers for the HTTP request.</returns>
/// <exception cref="T:System.InvalidOperationException">The request has been started by calling the <see cref="M:System.Net.HttpWebRequest.GetRequestStream" />, <see cref="M:System.Net.HttpWebRequest.BeginGetRequestStream(System.AsyncCallback,System.Object)" />, <see cref="M:System.Net.HttpWebRequest.GetResponse" />, or <see cref="M:System.Net.HttpWebRequest.BeginGetResponse(System.AsyncCallback,System.Object)" /> method. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x1700068A RID: 1674
// (get) Token: 0x060013F5 RID: 5109 RVA: 0x0003DD20 File Offset: 0x0003BF20
// (set) Token: 0x060013F6 RID: 5110 RVA: 0x0003DD28 File Offset: 0x0003BF28
public override WebHeaderCollection Headers
{
get
{
return this.webHeaders;
}
set
{
this.CheckRequestStarted();
WebHeaderCollection webHeaderCollection = new WebHeaderCollection(true);
int count = value.Count;
for (int i = 0; i < count; i++)
{
webHeaderCollection.Add(value.GetKey(i), value.Get(i));
}
this.webHeaders = webHeaderCollection;
}
}
/// <summary>Gets or sets the value of the If-Modified-Since HTTP header.</summary>
/// <returns>A <see cref="T:System.DateTime" /> that contains the contents of the If-Modified-Since HTTP header. The default value is the current date and time.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x1700068B RID: 1675
// (get) Token: 0x060013F7 RID: 5111 RVA: 0x0003DD78 File Offset: 0x0003BF78
// (set) Token: 0x060013F8 RID: 5112 RVA: 0x0003DDE4 File Offset: 0x0003BFE4
public DateTime IfModifiedSince
{
get
{
string text = this.webHeaders["If-Modified-Since"];
if (text == null)
{
return DateTime.Now;
}
DateTime dateTime;
try
{
dateTime = MonoHttpDate.Parse(text);
}
catch (Exception)
{
dateTime = DateTime.Now;
}
return dateTime;
}
set
{
this.CheckRequestStarted();
this.webHeaders.SetInternal("If-Modified-Since", value.ToUniversalTime().ToString("r", null));
}
}
/// <summary>Gets or sets a value that indicates whether to make a persistent connection to the Internet resource.</summary>
/// <returns>true if the request to the Internet resource should contain a Connection HTTP header with the value Keep-alive; otherwise, false. The default is true.</returns>
// Token: 0x1700068C RID: 1676
// (get) Token: 0x060013F9 RID: 5113 RVA: 0x0003DE1C File Offset: 0x0003C01C
// (set) Token: 0x060013FA RID: 5114 RVA: 0x0003DE24 File Offset: 0x0003C024
public bool KeepAlive
{
get
{
return this.keepAlive;
}
set
{
this.keepAlive = value;
}
}
/// <summary>Gets or sets the maximum number of redirects that the request follows.</summary>
/// <returns>The maximum number of redirection responses that the request follows. The default value is 50.</returns>
/// <exception cref="T:System.ArgumentException">The value is set to 0 or less. </exception>
// Token: 0x1700068D RID: 1677
// (get) Token: 0x060013FB RID: 5115 RVA: 0x0003DE30 File Offset: 0x0003C030
// (set) Token: 0x060013FC RID: 5116 RVA: 0x0003DE38 File Offset: 0x0003C038
public int MaximumAutomaticRedirections
{
get
{
return this.maxAutoRedirect;
}
set
{
if (value <= 0)
{
throw new ArgumentException("Must be > 0", "value");
}
this.maxAutoRedirect = value;
}
}
/// <summary>Gets or sets the maximum allowed length of the response headers.</summary>
/// <returns>The length, in kilobytes (1024 bytes), of the response headers.</returns>
/// <exception cref="T:System.InvalidOperationException">The property is set after the request has already been submitted. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value is less than 0 and is not equal to -1. </exception>
// Token: 0x1700068E RID: 1678
// (get) Token: 0x060013FD RID: 5117 RVA: 0x0003DE58 File Offset: 0x0003C058
// (set) Token: 0x060013FE RID: 5118 RVA: 0x0003DE60 File Offset: 0x0003C060
[global::System.MonoTODO("Use this")]
public int MaximumResponseHeadersLength
{
get
{
return this.maxResponseHeadersLength;
}
set
{
this.maxResponseHeadersLength = value;
}
}
/// <summary>Gets or sets the default for the <see cref="P:System.Net.HttpWebRequest.MaximumResponseHeadersLength" /> property.</summary>
/// <returns>The length, in kilobytes (1024 bytes), of the default maximum for response headers received. The default configuration file sets this value to 64 kilobytes.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value is not equal to -1 and is less than zero. </exception>
/// <PermissionSet>
/// <IPermission class="System.Net.WebPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x1700068F RID: 1679
// (get) Token: 0x060013FF RID: 5119 RVA: 0x0003DE6C File Offset: 0x0003C06C
// (set) Token: 0x06001400 RID: 5120 RVA: 0x0003DE74 File Offset: 0x0003C074
[global::System.MonoTODO("Use this")]
public static int DefaultMaximumResponseHeadersLength
{
get
{
return HttpWebRequest.defaultMaxResponseHeadersLength;
}
set
{
HttpWebRequest.defaultMaxResponseHeadersLength = value;
}
}
/// <summary>Gets or sets a time-out in milliseconds when writing to or reading from a stream.</summary>
/// <returns>The number of milliseconds before the writing or reading times out. The default value is 300,000 milliseconds (5 minutes).</returns>
/// <exception cref="T:System.InvalidOperationException">The request has already been sent. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value specified for a set operation is less than or equal to zero and is not equal to <see cref="F:System.Threading.Timeout.Infinite" /></exception>
// Token: 0x17000690 RID: 1680
// (get) Token: 0x06001401 RID: 5121 RVA: 0x0003DE7C File Offset: 0x0003C07C
// (set) Token: 0x06001402 RID: 5122 RVA: 0x0003DE84 File Offset: 0x0003C084
public int ReadWriteTimeout
{
get
{
return this.readWriteTimeout;
}
set
{
if (this.requestSent)
{
throw new InvalidOperationException("The request has already been sent.");
}
if (value < -1)
{
throw new ArgumentOutOfRangeException("value", "Must be >= -1");
}
this.readWriteTimeout = value;
}
}
/// <summary>Gets or sets the media type of the request.</summary>
/// <returns>The media type of the request. The default value is null.</returns>
// Token: 0x17000691 RID: 1681
// (get) Token: 0x06001403 RID: 5123 RVA: 0x0003DEC8 File Offset: 0x0003C0C8
// (set) Token: 0x06001404 RID: 5124 RVA: 0x0003DED0 File Offset: 0x0003C0D0
public string MediaType
{
get
{
return this.mediaType;
}
set
{
this.mediaType = value;
}
}
/// <summary>Gets or sets the method for the request.</summary>
/// <returns>The request method to use to contact the Internet resource. The default value is GET.</returns>
/// <exception cref="T:System.ArgumentException">No method is supplied.-or- The method string contains invalid characters. </exception>
// Token: 0x17000692 RID: 1682
// (get) Token: 0x06001405 RID: 5125 RVA: 0x0003DEDC File Offset: 0x0003C0DC
// (set) Token: 0x06001406 RID: 5126 RVA: 0x0003DEE4 File Offset: 0x0003C0E4
public override string Method
{
get
{
return this.method;
}
set
{
if (value == null || value.Trim() == string.Empty)
{
throw new ArgumentException("not a valid method");
}
this.method = value;
}
}
/// <summary>Gets or sets a value that indicates whether to pipeline the request to the Internet resource.</summary>
/// <returns>true if the request should be pipelined; otherwise, false. The default is true.</returns>
// Token: 0x17000693 RID: 1683
// (get) Token: 0x06001407 RID: 5127 RVA: 0x0003DF14 File Offset: 0x0003C114
// (set) Token: 0x06001408 RID: 5128 RVA: 0x0003DF1C File Offset: 0x0003C11C
public bool Pipelined
{
get
{
return this.pipelined;
}
set
{
this.pipelined = value;
}
}
/// <summary>Gets or sets a value that indicates whether to send an Authorization header with the request.</summary>
/// <returns>true to send an HTTP Authorization header with requests after authentication has taken place; otherwise, false. The default is false.</returns>
// Token: 0x17000694 RID: 1684
// (get) Token: 0x06001409 RID: 5129 RVA: 0x0003DF28 File Offset: 0x0003C128
// (set) Token: 0x0600140A RID: 5130 RVA: 0x0003DF30 File Offset: 0x0003C130
public override bool PreAuthenticate
{
get
{
return this.preAuthenticate;
}
set
{
this.preAuthenticate = value;
}
}
/// <summary>Gets or sets the version of HTTP to use for the request.</summary>
/// <returns>The HTTP version to use for the request. The default is <see cref="F:System.Net.HttpVersion.Version11" />.</returns>
/// <exception cref="T:System.ArgumentException">The HTTP version is set to a value other than 1.0 or 1.1. </exception>
// Token: 0x17000695 RID: 1685
// (get) Token: 0x0600140B RID: 5131 RVA: 0x0003DF3C File Offset: 0x0003C13C
// (set) Token: 0x0600140C RID: 5132 RVA: 0x0003DF44 File Offset: 0x0003C144
public Version ProtocolVersion
{
get
{
return this.version;
}
set
{
if (value != HttpVersion.Version10 && value != HttpVersion.Version11)
{
throw new ArgumentException("value");
}
this.version = value;
}
}
/// <summary>Gets or sets proxy information for the request.</summary>
/// <returns>The <see cref="T:System.Net.IWebProxy" /> object to use to proxy the request. The default value is set by calling the <see cref="P:System.Net.GlobalProxySelection.Select" /> property.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <see cref="P:System.Net.HttpWebRequest.Proxy" /> is set to null. </exception>
/// <exception cref="T:System.InvalidOperationException">The request has been started by calling <see cref="M:System.Net.HttpWebRequest.GetRequestStream" />, <see cref="M:System.Net.HttpWebRequest.BeginGetRequestStream(System.AsyncCallback,System.Object)" />, <see cref="M:System.Net.HttpWebRequest.GetResponse" />, or <see cref="M:System.Net.HttpWebRequest.BeginGetResponse(System.AsyncCallback,System.Object)" />. </exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have permission for the requested operation. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Net.WebPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x17000696 RID: 1686
// (get) Token: 0x0600140D RID: 5133 RVA: 0x0003DF84 File Offset: 0x0003C184
// (set) Token: 0x0600140E RID: 5134 RVA: 0x0003DF8C File Offset: 0x0003C18C
public override IWebProxy Proxy
{
get
{
return this.proxy;
}
set
{
this.CheckRequestStarted();
this.proxy = value;
this.servicePoint = null;
}
}
/// <summary>Gets or sets the value of the Referer HTTP header.</summary>
/// <returns>The value of the Referer HTTP header. The default value is null.</returns>
// Token: 0x17000697 RID: 1687
// (get) Token: 0x0600140F RID: 5135 RVA: 0x0003DFA4 File Offset: 0x0003C1A4
// (set) Token: 0x06001410 RID: 5136 RVA: 0x0003DFB8 File Offset: 0x0003C1B8
public string Referer
{
get
{
return this.webHeaders["Referer"];
}
set
{
this.CheckRequestStarted();
if (value == null || value.Trim().Length == 0)
{
this.webHeaders.RemoveInternal("Referer");
return;
}
this.webHeaders.SetInternal("Referer", value);
}
}
/// <summary>Gets the original Uniform Resource Identifier (URI) of the request.</summary>
/// <returns>A <see cref="T:System.Uri" /> that contains the URI of the Internet resource passed to the <see cref="M:System.Net.WebRequest.Create(System.String)" /> method.</returns>
// Token: 0x17000698 RID: 1688
// (get) Token: 0x06001411 RID: 5137 RVA: 0x0003E004 File Offset: 0x0003C204
public override global::System.Uri RequestUri
{
get
{
return this.requestUri;
}
}
/// <summary>Gets or sets a value that indicates whether to send data in segments to the Internet resource.</summary>
/// <returns>true to send data to the Internet resource in segments; otherwise, false. The default value is false.</returns>
/// <exception cref="T:System.InvalidOperationException">The request has been started by calling the <see cref="M:System.Net.HttpWebRequest.GetRequestStream" />, <see cref="M:System.Net.HttpWebRequest.BeginGetRequestStream(System.AsyncCallback,System.Object)" />, <see cref="M:System.Net.HttpWebRequest.GetResponse" />, or <see cref="M:System.Net.HttpWebRequest.BeginGetResponse(System.AsyncCallback,System.Object)" /> method. </exception>
// Token: 0x17000699 RID: 1689
// (get) Token: 0x06001412 RID: 5138 RVA: 0x0003E00C File Offset: 0x0003C20C
// (set) Token: 0x06001413 RID: 5139 RVA: 0x0003E014 File Offset: 0x0003C214
public bool SendChunked
{
get
{
return this.sendChunked;
}
set
{
this.CheckRequestStarted();
this.sendChunked = value;
}
}
/// <summary>Gets the service point to use for the request.</summary>
/// <returns>A <see cref="T:System.Net.ServicePoint" /> that represents the network connection to the Internet resource.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x1700069A RID: 1690
// (get) Token: 0x06001414 RID: 5140 RVA: 0x0003E024 File Offset: 0x0003C224
public ServicePoint ServicePoint
{
get
{
return this.GetServicePoint();
}
}
/// <summary>Gets or sets the time-out value in milliseconds for the <see cref="M:System.Net.HttpWebRequest.GetResponse" /> and <see cref="M:System.Net.HttpWebRequest.GetRequestStream" /> methods.</summary>
/// <returns>The number of milliseconds to wait before the request times out. The default value is 100,000 milliseconds (100 seconds).</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value specified is less than zero and is not <see cref="F:System.Threading.Timeout.Infinite" />.</exception>
// Token: 0x1700069B RID: 1691
// (get) Token: 0x06001415 RID: 5141 RVA: 0x0003E02C File Offset: 0x0003C22C
// (set) Token: 0x06001416 RID: 5142 RVA: 0x0003E034 File Offset: 0x0003C234
public override int Timeout
{
get
{
return this.timeout;
}
set
{
if (value < -1)
{
throw new ArgumentOutOfRangeException("value");
}
this.timeout = value;
}
}
/// <summary>Gets or sets the value of the Transfer-encoding HTTP header.</summary>
/// <returns>The value of the Transfer-encoding HTTP header. The default value is null.</returns>
/// <exception cref="T:System.InvalidOperationException">
/// <see cref="P:System.Net.HttpWebRequest.TransferEncoding" /> is set when <see cref="P:System.Net.HttpWebRequest.SendChunked" /> is false. </exception>
/// <exception cref="T:System.ArgumentException">
/// <see cref="P:System.Net.HttpWebRequest.TransferEncoding" /> is set to the value "Chunked". </exception>
// Token: 0x1700069C RID: 1692
// (get) Token: 0x06001417 RID: 5143 RVA: 0x0003E050 File Offset: 0x0003C250
// (set) Token: 0x06001418 RID: 5144 RVA: 0x0003E064 File Offset: 0x0003C264
public string TransferEncoding
{
get
{
return this.webHeaders["Transfer-Encoding"];
}
set
{
this.CheckRequestStarted();
string text = value;
if (text != null)
{
text = text.Trim().ToLower();
}
if (text == null || text.Length == 0)
{
this.webHeaders.RemoveInternal("Transfer-Encoding");
return;
}
if (text == "chunked")
{
throw new ArgumentException("Chunked encoding must be set with the SendChunked property");
}
if (!this.sendChunked)
{
throw new ArgumentException("SendChunked must be True", "value");
}
this.webHeaders.RemoveAndAdd("Transfer-Encoding", value);
}
}
/// <summary>Gets or sets a <see cref="T:System.Boolean" /> value that controls whether default credentials are sent with requests.</summary>
/// <returns>true if the default credentials are used; otherwise false. The default value is false.</returns>
/// <exception cref="T:System.InvalidOperationException">You attempted to set this property after the request was sent.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="USERNAME" />
/// </PermissionSet>
// Token: 0x1700069D RID: 1693
// (get) Token: 0x06001419 RID: 5145 RVA: 0x0003E0F4 File Offset: 0x0003C2F4
// (set) Token: 0x0600141A RID: 5146 RVA: 0x0003E104 File Offset: 0x0003C304
public override bool UseDefaultCredentials
{
get
{
return CredentialCache.DefaultCredentials == this.Credentials;
}
set
{
ICredentials credentials;
if (value)
{
ICredentials defaultCredentials = CredentialCache.DefaultCredentials;
credentials = defaultCredentials;
}
else
{
credentials = null;
}
this.Credentials = credentials;
}
}
/// <summary>Gets or sets the value of the User-agent HTTP header.</summary>
/// <returns>The value of the User-agent HTTP header. The default value is null.Note:The value for this property is stored in <see cref="T:System.Net.WebHeaderCollection" />. If WebHeaderCollection is set, the property value is lost.</returns>
// Token: 0x1700069E RID: 1694
// (get) Token: 0x0600141B RID: 5147 RVA: 0x0003E12C File Offset: 0x0003C32C
// (set) Token: 0x0600141C RID: 5148 RVA: 0x0003E140 File Offset: 0x0003C340
public string UserAgent
{
get
{
return this.webHeaders["User-Agent"];
}
set
{
this.webHeaders.SetInternal("User-Agent", value);
}
}
/// <summary>Gets or sets a value that indicates whether to allow high-speed NTLM-authenticated connection sharing.</summary>
/// <returns>true to keep the authenticated connection open; otherwise, false.</returns>
/// <PermissionSet>
/// <IPermission class="System.Net.WebPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x1700069F RID: 1695
// (get) Token: 0x0600141D RID: 5149 RVA: 0x0003E154 File Offset: 0x0003C354
// (set) Token: 0x0600141E RID: 5150 RVA: 0x0003E15C File Offset: 0x0003C35C
public bool UnsafeAuthenticatedConnectionSharing
{
get
{
return this.unsafe_auth_blah;
}
set
{
this.unsafe_auth_blah = value;
}
}
// Token: 0x170006A0 RID: 1696
// (get) Token: 0x0600141F RID: 5151 RVA: 0x0003E168 File Offset: 0x0003C368
internal bool GotRequestStream
{
get
{
return this.gotRequestStream;
}
}
// Token: 0x170006A1 RID: 1697
// (get) Token: 0x06001420 RID: 5152 RVA: 0x0003E170 File Offset: 0x0003C370
// (set) Token: 0x06001421 RID: 5153 RVA: 0x0003E178 File Offset: 0x0003C378
internal bool ExpectContinue
{
get
{
return this.expectContinue;
}
set
{
this.expectContinue = value;
}
}
// Token: 0x170006A2 RID: 1698
// (get) Token: 0x06001422 RID: 5154 RVA: 0x0003E184 File Offset: 0x0003C384
internal global::System.Uri AuthUri
{
get
{
return this.actualUri;
}
}
// Token: 0x170006A3 RID: 1699
// (get) Token: 0x06001423 RID: 5155 RVA: 0x0003E18C File Offset: 0x0003C38C
internal bool ProxyQuery
{
get
{
return this.servicePoint.UsesProxy && !this.servicePoint.UseConnect;
}
}
// Token: 0x06001424 RID: 5156 RVA: 0x0003E1B0 File Offset: 0x0003C3B0
internal ServicePoint GetServicePoint()
{
object obj = this.locker;
lock (obj)
{
if (this.hostChanged || this.servicePoint == null)
{
this.servicePoint = ServicePointManager.FindServicePoint(this.actualUri, this.proxy);
this.hostChanged = false;
}
}
return this.servicePoint;
}
/// <summary>Adds a byte range header to a request for a specific range from the beginning or end of the requested data.</summary>
/// <param name="range">The starting or ending point of the range. </param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="rangeSpecifier" /> is invalid. </exception>
/// <exception cref="T:System.InvalidOperationException">The range header could not be added. </exception>
// Token: 0x06001425 RID: 5157 RVA: 0x0003E22C File Offset: 0x0003C42C
public void AddRange(int range)
{
this.AddRange("bytes", range);
}
/// <summary>Adds a byte range header to the request for a specified range.</summary>
/// <param name="from">The position at which to start sending data. </param>
/// <param name="to">The position at which to stop sending data. </param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="rangeSpecifier" /> is invalid. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="from" /> is greater than <paramref name="to" />-or- <paramref name="from" /> or <paramref name="to" /> is less than 0. </exception>
/// <exception cref="T:System.InvalidOperationException">The range header could not be added. </exception>
// Token: 0x06001426 RID: 5158 RVA: 0x0003E23C File Offset: 0x0003C43C
public void AddRange(int from, int to)
{
this.AddRange("bytes", from, to);
}
/// <summary>Adds a Range header to a request for a specific range from the beginning or end of the requested data.</summary>
/// <param name="rangeSpecifier">The description of the range. </param>
/// <param name="range">The starting or ending point of the range. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="rangeSpecifier" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="rangeSpecifier" /> is invalid. </exception>
/// <exception cref="T:System.InvalidOperationException">The range header could not be added. </exception>
// Token: 0x06001427 RID: 5159 RVA: 0x0003E24C File Offset: 0x0003C44C
public void AddRange(string rangeSpecifier, int range)
{
if (rangeSpecifier == null)
{
throw new ArgumentNullException("rangeSpecifier");
}
string text = this.webHeaders["Range"];
if (text == null || text.Length == 0)
{
text = rangeSpecifier + "=";
}
else
{
if (!text.ToLower().StartsWith(rangeSpecifier.ToLower() + "="))
{
throw new InvalidOperationException("rangeSpecifier");
}
text += ",";
}
this.webHeaders.RemoveAndAdd("Range", text + range + "-");
}
/// <summary>Adds a range header to a request for a specified range.</summary>
/// <param name="rangeSpecifier">The description of the range. </param>
/// <param name="from">The position at which to start sending data. </param>
/// <param name="to">The position at which to stop sending data. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="rangeSpecifier" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="from" /> is greater than <paramref name="to" />-or- <paramref name="from" /> or <paramref name="to" /> is less than 0. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="rangeSpecifier" /> is invalid. </exception>
/// <exception cref="T:System.InvalidOperationException">The range header could not be added. </exception>
// Token: 0x06001428 RID: 5160 RVA: 0x0003E2FC File Offset: 0x0003C4FC
public void AddRange(string rangeSpecifier, int from, int to)
{
if (rangeSpecifier == null)
{
throw new ArgumentNullException("rangeSpecifier");
}
if (from < 0 || to < 0 || from > to)
{
throw new ArgumentOutOfRangeException();
}
string text = this.webHeaders["Range"];
if (text == null || text.Length == 0)
{
text = rangeSpecifier + "=";
}
else
{
if (!text.ToLower().StartsWith(rangeSpecifier.ToLower() + "="))
{
throw new InvalidOperationException("rangeSpecifier");
}
text += ",";
}
this.webHeaders.RemoveAndAdd("Range", string.Concat(new object[] { text, from, "-", to }));
}
/// <summary>Begins an asynchronous request for a <see cref="T:System.IO.Stream" /> object to use to write data.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> that references the asynchronous request.</returns>
/// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate. </param>
/// <param name="state">The state object for this request. </param>
/// <exception cref="T:System.Net.ProtocolViolationException">The <see cref="P:System.Net.HttpWebRequest.Method" /> property is GET or HEAD.-or- <see cref="P:System.Net.HttpWebRequest.KeepAlive" /> is true, <see cref="P:System.Net.HttpWebRequest.AllowWriteStreamBuffering" /> is false, <see cref="P:System.Net.HttpWebRequest.ContentLength" /> is -1, <see cref="P:System.Net.HttpWebRequest.SendChunked" /> is false, and <see cref="P:System.Net.HttpWebRequest.Method" /> is POST or PUT. </exception>
/// <exception cref="T:System.InvalidOperationException">The stream is being used by a previous call to <see cref="M:System.Net.HttpWebRequest.BeginGetRequestStream(System.AsyncCallback,System.Object)" />-or- <see cref="P:System.Net.HttpWebRequest.TransferEncoding" /> is set to a value and <see cref="P:System.Net.HttpWebRequest.SendChunked" /> is false.-or- The thread pool is running out of threads. </exception>
/// <exception cref="T:System.NotSupportedException">The request cache validator indicated that the response for this request can be served from the cache; however, requests that write data must not use the cache. This exception can occur if you are using a custom cache validator that is incorrectly implemented. </exception>
/// <exception cref="T:System.Net.WebException">
/// <see cref="M:System.Net.HttpWebRequest.Abort" /> was previously called. </exception>
/// <exception cref="T:System.ObjectDisposedException">In a .NET Compact Framework application, a request stream with zero content length was not obtained and closed correctly. For more information about handling zero content length requests, see Network Programming in the .NET Compact Framework.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.DnsPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.WebPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06001429 RID: 5161 RVA: 0x0003E3E0 File Offset: 0x0003C5E0
public override IAsyncResult BeginGetRequestStream(AsyncCallback callback, object state)
{
if (this.Aborted)
{
throw new WebException("The request was canceled.", WebExceptionStatus.RequestCanceled);
}
bool flag = !(this.method == "GET") && !(this.method == "CONNECT") && !(this.method == "HEAD") && !(this.method == "TRACE") && !(this.method == "DELETE");
if (this.method == null || !flag)
{
throw new ProtocolViolationException("Cannot send data when method is: " + this.method);
}
if (this.contentLength == -1L && !this.sendChunked && !this.allowBuffering && this.KeepAlive)
{
throw new ProtocolViolationException("Content-Length not set");
}
string transferEncoding = this.TransferEncoding;
if (!this.sendChunked && transferEncoding != null && transferEncoding.Trim() != string.Empty)
{
throw new ProtocolViolationException("SendChunked should be true.");
}
object obj = this.locker;
IAsyncResult asyncResult;
lock (obj)
{
if (this.asyncWrite != null)
{
throw new InvalidOperationException("Cannot re-call start of asynchronous method while a previous call is still in progress.");
}
this.asyncWrite = new WebAsyncResult(this, callback, state);
this.initialMethod = this.method;
if (this.haveRequest && this.writeStream != null)
{
this.asyncWrite.SetCompleted(true, this.writeStream);
this.asyncWrite.DoCallback();
asyncResult = this.asyncWrite;
}
else
{
this.gotRequestStream = true;
WebAsyncResult webAsyncResult = this.asyncWrite;
if (!this.requestSent)
{
this.requestSent = true;
this.redirects = 0;
this.servicePoint = this.GetServicePoint();
this.abortHandler = this.servicePoint.SendRequest(this, this.connectionGroup);
}
asyncResult = webAsyncResult;
}
}
return asyncResult;
}
/// <summary>Ends an asynchronous request for a <see cref="T:System.IO.Stream" /> object to use to write data.</summary>
/// <returns>A <see cref="T:System.IO.Stream" /> to use to write request data.</returns>
/// <param name="asyncResult">The pending request for a stream. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is null. </exception>
/// <exception cref="T:System.IO.IOException">The request did not complete, and no stream is available. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="asyncResult" /> was not returned by the current instance from a call to <see cref="M:System.Net.HttpWebRequest.BeginGetRequestStream(System.AsyncCallback,System.Object)" />. </exception>
/// <exception cref="T:System.InvalidOperationException">This method was called previously using <paramref name="asyncResult" />. </exception>
/// <exception cref="T:System.Net.WebException">
/// <see cref="M:System.Net.HttpWebRequest.Abort" /> was previously called.-or- An error occurred while processing the request. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x0600142A RID: 5162 RVA: 0x0003E604 File Offset: 0x0003C804
public override Stream EndGetRequestStream(IAsyncResult asyncResult)
{
if (asyncResult == null)
{
throw new ArgumentNullException("asyncResult");
}
WebAsyncResult webAsyncResult = asyncResult as WebAsyncResult;
if (webAsyncResult == null)
{
throw new ArgumentException("Invalid IAsyncResult");
}
this.asyncWrite = webAsyncResult;
webAsyncResult.WaitUntilComplete();
Exception exception = webAsyncResult.Exception;
if (exception != null)
{
throw exception;
}
return webAsyncResult.WriteStream;
}
/// <summary>Gets a <see cref="T:System.IO.Stream" /> object to use to write request data.</summary>
/// <returns>A <see cref="T:System.IO.Stream" /> to use to write request data.</returns>
/// <exception cref="T:System.Net.ProtocolViolationException">The <see cref="P:System.Net.HttpWebRequest.Method" /> property is GET or HEAD.-or- <see cref="P:System.Net.HttpWebRequest.KeepAlive" /> is true, <see cref="P:System.Net.HttpWebRequest.AllowWriteStreamBuffering" /> is false, <see cref="P:System.Net.HttpWebRequest.ContentLength" /> is -1, <see cref="P:System.Net.HttpWebRequest.SendChunked" /> is false, and <see cref="P:System.Net.HttpWebRequest.Method" /> is POST or PUT. </exception>
/// <exception cref="T:System.InvalidOperationException">The <see cref="M:System.Net.HttpWebRequest.GetRequestStream" /> method is called more than once.-or- <see cref="P:System.Net.HttpWebRequest.TransferEncoding" /> is set to a value and <see cref="P:System.Net.HttpWebRequest.SendChunked" /> is false. </exception>
/// <exception cref="T:System.NotSupportedException">The request cache validator indicated that the response for this request can be served from the cache; however, requests that write data must not use the cache. This exception can occur if you are using a custom cache validator that is incorrectly implemented. </exception>
/// <exception cref="T:System.Net.WebException">
/// <see cref="M:System.Net.HttpWebRequest.Abort" /> was previously called.-or- The time-out period for the request expired.-or- An error occurred while processing the request. </exception>
/// <exception cref="T:System.ObjectDisposedException">In a .NET Compact Framework application, a request stream with zero content length was not obtained and closed correctly. For more information about handling zero content length requests, see Network Programming in the .NET Compact Framework.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.DnsPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.WebPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x0600142B RID: 5163 RVA: 0x0003E65C File Offset: 0x0003C85C
public override Stream GetRequestStream()
{
IAsyncResult asyncResult = this.asyncWrite;
if (asyncResult == null)
{
asyncResult = this.BeginGetRequestStream(null, null);
this.asyncWrite = (WebAsyncResult)asyncResult;
}
if (!asyncResult.IsCompleted && !asyncResult.AsyncWaitHandle.WaitOne(this.timeout, false))
{
this.Abort();
throw new WebException("The request timed out", WebExceptionStatus.Timeout);
}
return this.EndGetRequestStream(asyncResult);
}
// Token: 0x0600142C RID: 5164 RVA: 0x0003E6C8 File Offset: 0x0003C8C8
private void CheckIfForceWrite()
{
if (this.writeStream == null || this.writeStream.RequestWritten || this.contentLength < 0L || !this.InternalAllowBuffering)
{
return;
}
if ((long)this.writeStream.WriteBufferLength == this.contentLength)
{
this.writeStream.WriteRequest();
}
}
/// <summary>Begins an asynchronous request to an Internet resource.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> that references the asynchronous request for a response.</returns>
/// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate </param>
/// <param name="state">The state object for this request. </param>
/// <exception cref="T:System.InvalidOperationException">The stream is already in use by a previous call to <see cref="M:System.Net.HttpWebRequest.BeginGetResponse(System.AsyncCallback,System.Object)" />-or- <see cref="P:System.Net.HttpWebRequest.TransferEncoding" /> is set to a value and <see cref="P:System.Net.HttpWebRequest.SendChunked" /> is false.-or- The thread pool is running out of threads. </exception>
/// <exception cref="T:System.Net.ProtocolViolationException">
/// <see cref="P:System.Net.HttpWebRequest.Method" /> is GET or HEAD, and either <see cref="P:System.Net.HttpWebRequest.ContentLength" /> is greater than zero or <see cref="P:System.Net.HttpWebRequest.SendChunked" /> is true.-or- <see cref="P:System.Net.HttpWebRequest.KeepAlive" /> is true, <see cref="P:System.Net.HttpWebRequest.AllowWriteStreamBuffering" /> is false, and either <see cref="P:System.Net.HttpWebRequest.ContentLength" /> is -1, <see cref="P:System.Net.HttpWebRequest.SendChunked" /> is false and <see cref="P:System.Net.HttpWebRequest.Method" /> is POST or PUT. </exception>
/// <exception cref="T:System.Net.WebException">
/// <see cref="M:System.Net.HttpWebRequest.Abort" /> was previously called. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.DnsPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.WebPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x0600142D RID: 5165 RVA: 0x0003E72C File Offset: 0x0003C92C
public override IAsyncResult BeginGetResponse(AsyncCallback callback, object state)
{
if (this.Aborted)
{
throw new WebException("The request was canceled.", WebExceptionStatus.RequestCanceled);
}
if (this.method == null)
{
throw new ProtocolViolationException("Method is null.");
}
string transferEncoding = this.TransferEncoding;
if (!this.sendChunked && transferEncoding != null && transferEncoding.Trim() != string.Empty)
{
throw new ProtocolViolationException("SendChunked should be true.");
}
Monitor.Enter(this.locker);
this.getResponseCalled = true;
if (this.asyncRead != null && !this.haveResponse)
{
Monitor.Exit(this.locker);
throw new InvalidOperationException("Cannot re-call start of asynchronous method while a previous call is still in progress.");
}
this.CheckIfForceWrite();
this.asyncRead = new WebAsyncResult(this, callback, state);
WebAsyncResult webAsyncResult = this.asyncRead;
this.initialMethod = this.method;
if (this.haveResponse)
{
Exception ex = this.saved_exc;
if (this.webResponse != null)
{
Monitor.Exit(this.locker);
if (ex == null)
{
webAsyncResult.SetCompleted(true, this.webResponse);
}
else
{
webAsyncResult.SetCompleted(true, ex);
}
webAsyncResult.DoCallback();
return webAsyncResult;
}
if (ex != null)
{
Monitor.Exit(this.locker);
webAsyncResult.SetCompleted(true, ex);
webAsyncResult.DoCallback();
return webAsyncResult;
}
}
if (!this.requestSent)
{
this.requestSent = true;
this.redirects = 0;
this.servicePoint = this.GetServicePoint();
this.abortHandler = this.servicePoint.SendRequest(this, this.connectionGroup);
}
Monitor.Exit(this.locker);
return webAsyncResult;
}
/// <summary>Ends an asynchronous request to an Internet resource.</summary>
/// <returns>A <see cref="T:System.Net.WebResponse" /> that contains the response from the Internet resource.</returns>
/// <param name="asyncResult">The pending request for a response. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is null. </exception>
/// <exception cref="T:System.InvalidOperationException">This method was called previously using <paramref name="asyncResult." />-or- The <see cref="P:System.Net.HttpWebRequest.ContentLength" /> property is greater than 0 but the data has not been written to the request stream. </exception>
/// <exception cref="T:System.Net.WebException">
/// <see cref="M:System.Net.HttpWebRequest.Abort" /> was previously called.-or- An error occurred while processing the request. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="asyncResult" /> was not returned by the current instance from a call to <see cref="M:System.Net.HttpWebRequest.BeginGetResponse(System.AsyncCallback,System.Object)" />. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x0600142E RID: 5166 RVA: 0x0003E8C0 File Offset: 0x0003CAC0
public override WebResponse EndGetResponse(IAsyncResult asyncResult)
{
if (asyncResult == null)
{
throw new ArgumentNullException("asyncResult");
}
WebAsyncResult webAsyncResult = asyncResult as WebAsyncResult;
if (webAsyncResult == null)
{
throw new ArgumentException("Invalid IAsyncResult", "asyncResult");
}
if (!webAsyncResult.WaitUntilComplete(this.timeout, false))
{
this.Abort();
throw new WebException("The request timed out", WebExceptionStatus.Timeout);
}
if (webAsyncResult.GotException)
{
throw webAsyncResult.Exception;
}
return webAsyncResult.Response;
}
/// <summary>Returns a response from an Internet resource.</summary>
/// <returns>A <see cref="T:System.Net.WebResponse" /> that contains the response from the Internet resource.</returns>
/// <exception cref="T:System.InvalidOperationException">The stream is already in use by a previous call to <see cref="M:System.Net.HttpWebRequest.BeginGetResponse(System.AsyncCallback,System.Object)" />.-or- <see cref="P:System.Net.HttpWebRequest.TransferEncoding" /> is set to a value and <see cref="P:System.Net.HttpWebRequest.SendChunked" /> is false. </exception>
/// <exception cref="T:System.Net.ProtocolViolationException">
/// <see cref="P:System.Net.HttpWebRequest.Method" /> is GET or HEAD, and either <see cref="P:System.Net.HttpWebRequest.ContentLength" /> is greater or equal to zero or <see cref="P:System.Net.HttpWebRequest.SendChunked" /> is true.-or- <see cref="P:System.Net.HttpWebRequest.KeepAlive" /> is true, <see cref="P:System.Net.HttpWebRequest.AllowWriteStreamBuffering" /> is false, <see cref="P:System.Net.HttpWebRequest.ContentLength" /> is -1, <see cref="P:System.Net.HttpWebRequest.SendChunked" /> is false, and <see cref="P:System.Net.HttpWebRequest.Method" /> is POST or PUT. </exception>
/// <exception cref="T:System.NotSupportedException">The request cache validator indicated that the response for this request can be served from the cache; however, this request includes data to be sent to the server. Requests that send data must not use the cache. This exception can occur if you are using a custom cache validator that is incorrectly implemented. </exception>
/// <exception cref="T:System.Net.WebException">
/// <see cref="M:System.Net.HttpWebRequest.Abort" /> was previously called.-or- The time-out period for the request expired.-or- An error occurred while processing the request. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.DnsPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.WebPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x0600142F RID: 5167 RVA: 0x0003E938 File Offset: 0x0003CB38
public override WebResponse GetResponse()
{
WebAsyncResult webAsyncResult = (WebAsyncResult)this.BeginGetResponse(null, null);
return this.EndGetResponse(webAsyncResult);
}
// Token: 0x170006A4 RID: 1700
// (get) Token: 0x06001430 RID: 5168 RVA: 0x0003E95C File Offset: 0x0003CB5C
// (set) Token: 0x06001431 RID: 5169 RVA: 0x0003E964 File Offset: 0x0003CB64
internal bool FinishedReading
{
get
{
return this.finished_reading;
}
set
{
this.finished_reading = value;
}
}
// Token: 0x170006A5 RID: 1701
// (get) Token: 0x06001432 RID: 5170 RVA: 0x0003E970 File Offset: 0x0003CB70
internal bool Aborted
{
get
{
return Interlocked.CompareExchange(ref this.aborted, 0, 0) == 1;
}
}
/// <summary>Cancels a request to an Internet resource.</summary>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06001433 RID: 5171 RVA: 0x0003E984 File Offset: 0x0003CB84
public override void Abort()
{
if (Interlocked.CompareExchange(ref this.aborted, 1, 0) == 1)
{
return;
}
if (this.haveResponse && this.finished_reading)
{
return;
}
this.haveResponse = true;
if (this.abortHandler != null)
{
try
{
this.abortHandler(this, EventArgs.Empty);
}
catch (Exception)
{
}
this.abortHandler = null;
}
if (this.asyncWrite != null)
{
WebAsyncResult webAsyncResult = this.asyncWrite;
if (!webAsyncResult.IsCompleted)
{
try
{
WebException ex = new WebException("Aborted.", WebExceptionStatus.RequestCanceled);
webAsyncResult.SetCompleted(false, ex);
webAsyncResult.DoCallback();
}
catch
{
}
}
this.asyncWrite = null;
}
if (this.asyncRead != null)
{
WebAsyncResult webAsyncResult2 = this.asyncRead;
if (!webAsyncResult2.IsCompleted)
{
try
{
WebException ex2 = new WebException("Aborted.", WebExceptionStatus.RequestCanceled);
webAsyncResult2.SetCompleted(false, ex2);
webAsyncResult2.DoCallback();
}
catch
{
}
}
this.asyncRead = null;
}
if (this.writeStream != null)
{
try
{
this.writeStream.Close();
this.writeStream = null;
}
catch
{
}
}
if (this.webResponse != null)
{
try
{
this.webResponse.Close();
this.webResponse = null;
}
catch
{
}
}
}
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with the data required to serialize the target object.</summary>
/// <param name="serializationInfo">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> to populate with data. </param>
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> that specifies the destination for this serialization.</param>
// Token: 0x06001434 RID: 5172 RVA: 0x0003EB50 File Offset: 0x0003CD50
protected override void GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
serializationInfo.AddValue("requestUri", this.requestUri, typeof(global::System.Uri));
serializationInfo.AddValue("actualUri", this.actualUri, typeof(global::System.Uri));
serializationInfo.AddValue("allowAutoRedirect", this.allowAutoRedirect);
serializationInfo.AddValue("allowBuffering", this.allowBuffering);
serializationInfo.AddValue("certificates", this.certificates, typeof(global::System.Security.Cryptography.X509Certificates.X509CertificateCollection));
serializationInfo.AddValue("connectionGroup", this.connectionGroup);
serializationInfo.AddValue("contentLength", this.contentLength);
serializationInfo.AddValue("webHeaders", this.webHeaders, typeof(WebHeaderCollection));
serializationInfo.AddValue("keepAlive", this.keepAlive);
serializationInfo.AddValue("maxAutoRedirect", this.maxAutoRedirect);
serializationInfo.AddValue("mediaType", this.mediaType);
serializationInfo.AddValue("method", this.method);
serializationInfo.AddValue("initialMethod", this.initialMethod);
serializationInfo.AddValue("pipelined", this.pipelined);
serializationInfo.AddValue("version", this.version, typeof(Version));
serializationInfo.AddValue("proxy", this.proxy, typeof(IWebProxy));
serializationInfo.AddValue("sendChunked", this.sendChunked);
serializationInfo.AddValue("timeout", this.timeout);
serializationInfo.AddValue("redirects", this.redirects);
}
// Token: 0x06001435 RID: 5173 RVA: 0x0003ECE0 File Offset: 0x0003CEE0
private void CheckRequestStarted()
{
if (this.requestSent)
{
throw new InvalidOperationException("request started");
}
}
// Token: 0x06001436 RID: 5174 RVA: 0x0003ECF8 File Offset: 0x0003CEF8
internal void DoContinueDelegate(int statusCode, WebHeaderCollection headers)
{
if (this.continueDelegate != null)
{
this.continueDelegate(statusCode, headers);
}
}
// Token: 0x06001437 RID: 5175 RVA: 0x0003ED14 File Offset: 0x0003CF14
private bool Redirect(WebAsyncResult result, HttpStatusCode code)
{
this.redirects++;
Exception ex = null;
string text = null;
switch (code)
{
case HttpStatusCode.MultipleChoices:
ex = new WebException("Ambiguous redirect.");
goto IL_E4;
case HttpStatusCode.MovedPermanently:
case HttpStatusCode.Found:
case HttpStatusCode.TemporaryRedirect:
this.contentLength = -1L;
this.bodyBufferLength = 0;
this.bodyBuffer = null;
this.method = "GET";
text = this.webResponse.Headers["Location"];
goto IL_E4;
case HttpStatusCode.SeeOther:
this.method = "GET";
text = this.webResponse.Headers["Location"];
goto IL_E4;
case HttpStatusCode.NotModified:
return false;
case HttpStatusCode.UseProxy:
ex = new NotImplementedException("Proxy support not available.");
goto IL_E4;
}
ex = new ProtocolViolationException("Invalid status code: " + (int)code);
IL_E4:
if (ex != null)
{
throw ex;
}
if (text == null)
{
throw new WebException("No Location header found for " + (int)code, WebExceptionStatus.ProtocolError);
}
global::System.Uri uri = this.actualUri;
try
{
this.actualUri = new global::System.Uri(this.actualUri, text);
}
catch (Exception)
{
throw new WebException(string.Format("Invalid URL ({0}) for {1}", text, (int)code), WebExceptionStatus.ProtocolError);
}
this.hostChanged = this.actualUri.Scheme != uri.Scheme || this.actualUri.Host != uri.Host || this.actualUri.Port != uri.Port;
return true;
}
// Token: 0x06001438 RID: 5176 RVA: 0x0003EED8 File Offset: 0x0003D0D8
private string GetHeaders()
{
bool flag = false;
if (this.sendChunked)
{
flag = true;
this.webHeaders.RemoveAndAdd("Transfer-Encoding", "chunked");
this.webHeaders.RemoveInternal("Content-Length");
}
else if (this.contentLength != -1L)
{
if (this.contentLength > 0L)
{
flag = true;
}
this.webHeaders.SetInternal("Content-Length", this.contentLength.ToString());
this.webHeaders.RemoveInternal("Transfer-Encoding");
}
if (this.actualVersion == HttpVersion.Version11 && flag && this.servicePoint.SendContinue)
{
this.webHeaders.RemoveAndAdd("Expect", "100-continue");
this.expectContinue = true;
}
else
{
this.webHeaders.RemoveInternal("Expect");
this.expectContinue = false;
}
bool proxyQuery = this.ProxyQuery;
string text = ((!proxyQuery) ? "Connection" : "Proxy-Connection");
this.webHeaders.RemoveInternal(proxyQuery ? "Connection" : "Proxy-Connection");
Version protocolVersion = this.servicePoint.ProtocolVersion;
bool flag2 = protocolVersion == null || protocolVersion == HttpVersion.Version10;
if (this.keepAlive && (this.version == HttpVersion.Version10 || flag2))
{
this.webHeaders.RemoveAndAdd(text, "keep-alive");
}
else if (!this.keepAlive && this.version == HttpVersion.Version11)
{
this.webHeaders.RemoveAndAdd(text, "close");
}
this.webHeaders.SetInternal("Host", this.actualUri.Authority);
if (this.cookieContainer != null)
{
string cookieHeader = this.cookieContainer.GetCookieHeader(this.actualUri);
if (cookieHeader != string.Empty)
{
this.webHeaders.SetInternal("Cookie", cookieHeader);
}
}
string text2 = null;
if ((this.auto_decomp & DecompressionMethods.GZip) != DecompressionMethods.None)
{
text2 = "gzip";
}
if ((this.auto_decomp & DecompressionMethods.Deflate) != DecompressionMethods.None)
{
text2 = ((text2 == null) ? "deflate" : "gzip, deflate");
}
if (text2 != null)
{
this.webHeaders.RemoveAndAdd("Accept-Encoding", text2);
}
if (!this.usedPreAuth && this.preAuthenticate)
{
this.DoPreAuthenticate();
}
return this.webHeaders.ToString();
}
// Token: 0x06001439 RID: 5177 RVA: 0x0003F174 File Offset: 0x0003D374
private void DoPreAuthenticate()
{
bool flag = this.proxy != null && !this.proxy.IsBypassed(this.actualUri);
ICredentials credentials2;
if (!flag || this.credentials != null)
{
ICredentials credentials = this.credentials;
credentials2 = credentials;
}
else
{
credentials2 = this.proxy.Credentials;
}
ICredentials credentials3 = credentials2;
Authorization authorization = AuthenticationManager.PreAuthenticate(this, credentials3);
if (authorization == null)
{
return;
}
this.webHeaders.RemoveInternal("Proxy-Authorization");
this.webHeaders.RemoveInternal("Authorization");
string text = ((!flag || this.credentials != null) ? "Authorization" : "Proxy-Authorization");
this.webHeaders[text] = authorization.Message;
this.usedPreAuth = true;
}
// Token: 0x0600143A RID: 5178 RVA: 0x0003F23C File Offset: 0x0003D43C
internal void SetWriteStreamError(WebExceptionStatus status, Exception exc)
{
if (this.Aborted)
{
return;
}
WebAsyncResult webAsyncResult = this.asyncWrite;
if (webAsyncResult == null)
{
webAsyncResult = this.asyncRead;
}
if (webAsyncResult != null)
{
WebException ex;
if (exc == null)
{
string text = "Error: " + status;
ex = new WebException(text, status);
}
else
{
string text = string.Format("Error: {0} ({1})", status, exc.Message);
ex = new WebException(text, exc, status);
}
webAsyncResult.SetCompleted(false, ex);
webAsyncResult.DoCallback();
}
}
// Token: 0x0600143B RID: 5179 RVA: 0x0003F2C4 File Offset: 0x0003D4C4
internal void SendRequestHeaders(bool propagate_error)
{
StringBuilder stringBuilder = new StringBuilder();
string text;
if (!this.ProxyQuery)
{
text = this.actualUri.PathAndQuery;
}
else if (this.actualUri.IsDefaultPort)
{
text = string.Format("{0}://{1}{2}", this.actualUri.Scheme, this.actualUri.Host, this.actualUri.PathAndQuery);
}
else
{
text = string.Format("{0}://{1}:{2}{3}", new object[]
{
this.actualUri.Scheme,
this.actualUri.Host,
this.actualUri.Port,
this.actualUri.PathAndQuery
});
}
if (this.servicePoint.ProtocolVersion != null && this.servicePoint.ProtocolVersion < this.version)
{
this.actualVersion = this.servicePoint.ProtocolVersion;
}
else
{
this.actualVersion = this.version;
}
stringBuilder.AppendFormat("{0} {1} HTTP/{2}.{3}\r\n", new object[]
{
this.method,
text,
this.actualVersion.Major,
this.actualVersion.Minor
});
stringBuilder.Append(this.GetHeaders());
string text2 = stringBuilder.ToString();
byte[] bytes = Encoding.UTF8.GetBytes(text2);
try
{
this.writeStream.SetHeaders(bytes);
}
catch (WebException ex)
{
this.SetWriteStreamError(ex.Status, ex);
if (propagate_error)
{
throw;
}
}
catch (Exception ex2)
{
this.SetWriteStreamError(WebExceptionStatus.SendFailure, ex2);
if (propagate_error)
{
throw;
}
}
}
// Token: 0x0600143C RID: 5180 RVA: 0x0003F4B8 File Offset: 0x0003D6B8
internal void SetWriteStream(WebConnectionStream stream)
{
if (this.Aborted)
{
return;
}
this.writeStream = stream;
if (this.bodyBuffer != null)
{
this.webHeaders.RemoveInternal("Transfer-Encoding");
this.contentLength = (long)this.bodyBufferLength;
this.writeStream.SendChunked = false;
}
this.SendRequestHeaders(false);
this.haveRequest = true;
if (this.bodyBuffer != null)
{
this.writeStream.Write(this.bodyBuffer, 0, this.bodyBufferLength);
this.bodyBuffer = null;
this.writeStream.Close();
}
else if (this.method != "HEAD" && this.method != "GET" && this.method != "MKCOL" && this.method != "CONNECT" && this.method != "DELETE" && this.method != "TRACE" && this.getResponseCalled && !this.writeStream.RequestWritten)
{
this.writeStream.WriteRequest();
}
if (this.asyncWrite != null)
{
this.asyncWrite.SetCompleted(false, stream);
this.asyncWrite.DoCallback();
this.asyncWrite = null;
}
}
// Token: 0x0600143D RID: 5181 RVA: 0x0003F624 File Offset: 0x0003D824
internal void SetResponseError(WebExceptionStatus status, Exception e, string where)
{
if (this.Aborted)
{
return;
}
object obj = this.locker;
lock (obj)
{
string text = string.Format("Error getting response stream ({0}): {1}", where, status);
WebAsyncResult webAsyncResult = this.asyncRead;
if (webAsyncResult == null)
{
webAsyncResult = this.asyncWrite;
}
WebException ex;
if (e is WebException)
{
ex = (WebException)e;
}
else
{
ex = new WebException(text, e, status, null);
}
if (webAsyncResult != null)
{
if (!webAsyncResult.IsCompleted)
{
webAsyncResult.SetCompleted(false, ex);
webAsyncResult.DoCallback();
}
else if (webAsyncResult == this.asyncWrite)
{
this.saved_exc = ex;
}
this.haveResponse = true;
this.asyncRead = null;
this.asyncWrite = null;
}
else
{
this.haveResponse = true;
this.saved_exc = ex;
}
}
}
// Token: 0x0600143E RID: 5182 RVA: 0x0003F718 File Offset: 0x0003D918
private void CheckSendError(WebConnectionData data)
{
int statusCode = data.StatusCode;
if (statusCode < 400 || statusCode == 401 || statusCode == 407)
{
return;
}
if (this.writeStream != null && this.asyncRead == null && !this.writeStream.CompleteRequestWritten)
{
this.saved_exc = new WebException(data.StatusDescription, null, WebExceptionStatus.ProtocolError, this.webResponse);
this.webResponse.ReadAll();
}
}
// Token: 0x0600143F RID: 5183 RVA: 0x0003F798 File Offset: 0x0003D998
private void HandleNtlmAuth(WebAsyncResult r)
{
WebConnectionStream webConnectionStream = this.webResponse.GetResponseStream() as WebConnectionStream;
if (webConnectionStream != null)
{
WebConnection connection = webConnectionStream.Connection;
connection.PriorityRequest = this;
ICredentials credentials2;
if (this.proxy == null || this.proxy.IsBypassed(this.actualUri))
{
ICredentials credentials = this.credentials;
credentials2 = credentials;
}
else
{
credentials2 = this.proxy.Credentials;
}
ICredentials credentials3 = credentials2;
if (credentials3 != null)
{
connection.NtlmCredential = credentials3.GetCredential(this.requestUri, "NTLM");
connection.UnsafeAuthenticatedConnectionSharing = this.unsafe_auth_blah;
}
}
r.Reset();
this.haveResponse = false;
this.webResponse.ReadAll();
this.webResponse = null;
}
// Token: 0x06001440 RID: 5184 RVA: 0x0003F858 File Offset: 0x0003DA58
internal void SetResponseData(WebConnectionData data)
{
object obj = this.locker;
lock (obj)
{
if (this.Aborted)
{
if (data.stream != null)
{
data.stream.Close();
}
}
else
{
WebException ex = null;
try
{
this.webResponse = new HttpWebResponse(this.actualUri, this.method, data, this.cookieContainer);
}
catch (Exception ex2)
{
ex = new WebException(ex2.Message, ex2, WebExceptionStatus.ProtocolError, null);
if (data.stream != null)
{
data.stream.Close();
}
}
if (ex == null && (this.method == "POST" || this.method == "PUT"))
{
object obj2 = this.locker;
lock (obj2)
{
this.CheckSendError(data);
if (this.saved_exc != null)
{
ex = (WebException)this.saved_exc;
}
}
}
WebAsyncResult webAsyncResult = this.asyncRead;
bool flag = false;
if (webAsyncResult == null && this.webResponse != null)
{
flag = true;
webAsyncResult = new WebAsyncResult(null, null);
webAsyncResult.SetCompleted(false, this.webResponse);
}
if (webAsyncResult != null)
{
if (ex != null)
{
webAsyncResult.SetCompleted(false, ex);
webAsyncResult.DoCallback();
}
else
{
try
{
if (!this.CheckFinalStatus(webAsyncResult))
{
if (this.is_ntlm_auth && this.authCompleted && this.webResponse != null && this.webResponse.StatusCode < HttpStatusCode.BadRequest)
{
WebConnectionStream webConnectionStream = this.webResponse.GetResponseStream() as WebConnectionStream;
if (webConnectionStream != null)
{
WebConnection connection = webConnectionStream.Connection;
connection.NtlmAuthenticated = true;
}
}
if (this.writeStream != null)
{
this.writeStream.KillBuffer();
}
this.haveResponse = true;
webAsyncResult.SetCompleted(false, this.webResponse);
webAsyncResult.DoCallback();
}
else
{
if (this.webResponse != null)
{
if (this.is_ntlm_auth)
{
this.HandleNtlmAuth(webAsyncResult);
return;
}
this.webResponse.Close();
}
this.finished_reading = false;
this.haveResponse = false;
this.webResponse = null;
webAsyncResult.Reset();
this.servicePoint = this.GetServicePoint();
this.abortHandler = this.servicePoint.SendRequest(this, this.connectionGroup);
}
}
catch (WebException ex3)
{
if (flag)
{
this.saved_exc = ex3;
this.haveResponse = true;
}
webAsyncResult.SetCompleted(false, ex3);
webAsyncResult.DoCallback();
}
catch (Exception ex4)
{
ex = new WebException(ex4.Message, ex4, WebExceptionStatus.ProtocolError, null);
if (flag)
{
this.saved_exc = ex;
this.haveResponse = true;
}
webAsyncResult.SetCompleted(false, ex);
webAsyncResult.DoCallback();
}
}
}
}
}
}
// Token: 0x06001441 RID: 5185 RVA: 0x0003FBC0 File Offset: 0x0003DDC0
private bool CheckAuthorization(WebResponse response, HttpStatusCode code)
{
this.authCompleted = false;
if (code == HttpStatusCode.Unauthorized && this.credentials == null)
{
return false;
}
bool flag = code == HttpStatusCode.ProxyAuthenticationRequired;
if (flag && (this.proxy == null || this.proxy.Credentials == null))
{
return false;
}
string[] values = response.Headers.GetValues((!flag) ? "WWW-Authenticate" : "Proxy-Authenticate");
if (values == null || values.Length == 0)
{
return false;
}
ICredentials credentials2;
if (!flag)
{
ICredentials credentials = this.credentials;
credentials2 = credentials;
}
else
{
credentials2 = this.proxy.Credentials;
}
ICredentials credentials3 = credentials2;
Authorization authorization = null;
foreach (string text in values)
{
authorization = AuthenticationManager.Authenticate(text, this, credentials3);
if (authorization != null)
{
break;
}
}
if (authorization == null)
{
return false;
}
this.webHeaders[(!flag) ? "Authorization" : "Proxy-Authorization"] = authorization.Message;
this.authCompleted = authorization.Complete;
this.is_ntlm_auth = authorization.Module.AuthenticationType == "NTLM";
return true;
}
// Token: 0x06001442 RID: 5186 RVA: 0x0003FCFC File Offset: 0x0003DEFC
private bool CheckFinalStatus(WebAsyncResult result)
{
if (result.GotException)
{
throw result.Exception;
}
Exception ex = result.Exception;
this.bodyBuffer = null;
HttpWebResponse response = result.Response;
WebExceptionStatus webExceptionStatus = WebExceptionStatus.ProtocolError;
HttpStatusCode httpStatusCode = (HttpStatusCode)0;
if (ex == null && this.webResponse != null)
{
httpStatusCode = this.webResponse.StatusCode;
if (!this.authCompleted && ((httpStatusCode == HttpStatusCode.Unauthorized && this.credentials != null) || (this.ProxyQuery && httpStatusCode == HttpStatusCode.ProxyAuthenticationRequired)) && !this.usedPreAuth && this.CheckAuthorization(this.webResponse, httpStatusCode))
{
if (this.InternalAllowBuffering)
{
this.bodyBuffer = this.writeStream.WriteBuffer;
this.bodyBufferLength = this.writeStream.WriteBufferLength;
return true;
}
if (this.method != "PUT" && this.method != "POST")
{
return true;
}
this.writeStream.InternalClose();
this.writeStream = null;
this.webResponse.Close();
this.webResponse = null;
throw new WebException("This request requires buffering of data for authentication or redirection to be sucessful.");
}
else if (httpStatusCode >= HttpStatusCode.BadRequest)
{
string text = string.Format("The remote server returned an error: ({0}) {1}.", (int)httpStatusCode, this.webResponse.StatusDescription);
ex = new WebException(text, null, webExceptionStatus, this.webResponse);
this.webResponse.ReadAll();
}
else if (httpStatusCode == HttpStatusCode.NotModified && this.allowAutoRedirect)
{
string text2 = string.Format("The remote server returned an error: ({0}) {1}.", (int)httpStatusCode, this.webResponse.StatusDescription);
ex = new WebException(text2, null, webExceptionStatus, this.webResponse);
}
else if (httpStatusCode >= HttpStatusCode.MultipleChoices && this.allowAutoRedirect && this.redirects >= this.maxAutoRedirect)
{
ex = new WebException("Max. redirections exceeded.", null, webExceptionStatus, this.webResponse);
this.webResponse.ReadAll();
}
}
if (ex == null)
{
bool flag = false;
int num = (int)httpStatusCode;
if (this.allowAutoRedirect && num >= 300)
{
if (this.InternalAllowBuffering && this.writeStream.WriteBufferLength > 0)
{
this.bodyBuffer = this.writeStream.WriteBuffer;
this.bodyBufferLength = this.writeStream.WriteBufferLength;
}
flag = this.Redirect(result, httpStatusCode);
}
if (response != null && num >= 300 && num != 304)
{
response.ReadAll();
}
return flag;
}
if (this.writeStream != null)
{
this.writeStream.InternalClose();
this.writeStream = null;
}
this.webResponse = null;
throw ex;
}
// Token: 0x04001124 RID: 4388
private global::System.Uri requestUri;
// Token: 0x04001125 RID: 4389
private global::System.Uri actualUri;
// Token: 0x04001126 RID: 4390
private bool hostChanged;
// Token: 0x04001127 RID: 4391
private bool allowAutoRedirect = true;
// Token: 0x04001128 RID: 4392
private bool allowBuffering = true;
// Token: 0x04001129 RID: 4393
private global::System.Security.Cryptography.X509Certificates.X509CertificateCollection certificates;
// Token: 0x0400112A RID: 4394
private string connectionGroup;
// Token: 0x0400112B RID: 4395
private long contentLength = -1L;
// Token: 0x0400112C RID: 4396
private HttpContinueDelegate continueDelegate;
// Token: 0x0400112D RID: 4397
private CookieContainer cookieContainer;
// Token: 0x0400112E RID: 4398
private ICredentials credentials;
// Token: 0x0400112F RID: 4399
private bool haveResponse;
// Token: 0x04001130 RID: 4400
private bool haveRequest;
// Token: 0x04001131 RID: 4401
private bool requestSent;
// Token: 0x04001132 RID: 4402
private WebHeaderCollection webHeaders = new WebHeaderCollection(true);
// Token: 0x04001133 RID: 4403
private bool keepAlive = true;
// Token: 0x04001134 RID: 4404
private int maxAutoRedirect = 50;
// Token: 0x04001135 RID: 4405
private string mediaType = string.Empty;
// Token: 0x04001136 RID: 4406
private string method = "GET";
// Token: 0x04001137 RID: 4407
private string initialMethod = "GET";
// Token: 0x04001138 RID: 4408
private bool pipelined = true;
// Token: 0x04001139 RID: 4409
private bool preAuthenticate;
// Token: 0x0400113A RID: 4410
private bool usedPreAuth;
// Token: 0x0400113B RID: 4411
private Version version = HttpVersion.Version11;
// Token: 0x0400113C RID: 4412
private Version actualVersion;
// Token: 0x0400113D RID: 4413
private IWebProxy proxy;
// Token: 0x0400113E RID: 4414
private bool sendChunked;
// Token: 0x0400113F RID: 4415
private ServicePoint servicePoint;
// Token: 0x04001140 RID: 4416
private int timeout = 100000;
// Token: 0x04001141 RID: 4417
private WebConnectionStream writeStream;
// Token: 0x04001142 RID: 4418
private HttpWebResponse webResponse;
// Token: 0x04001143 RID: 4419
private WebAsyncResult asyncWrite;
// Token: 0x04001144 RID: 4420
private WebAsyncResult asyncRead;
// Token: 0x04001145 RID: 4421
private EventHandler abortHandler;
// Token: 0x04001146 RID: 4422
private int aborted;
// Token: 0x04001147 RID: 4423
private bool gotRequestStream;
// Token: 0x04001148 RID: 4424
private int redirects;
// Token: 0x04001149 RID: 4425
private bool expectContinue;
// Token: 0x0400114A RID: 4426
private bool authCompleted;
// Token: 0x0400114B RID: 4427
private byte[] bodyBuffer;
// Token: 0x0400114C RID: 4428
private int bodyBufferLength;
// Token: 0x0400114D RID: 4429
private bool getResponseCalled;
// Token: 0x0400114E RID: 4430
private Exception saved_exc;
// Token: 0x0400114F RID: 4431
private object locker = new object();
// Token: 0x04001150 RID: 4432
private bool is_ntlm_auth;
// Token: 0x04001151 RID: 4433
private bool finished_reading;
// Token: 0x04001152 RID: 4434
internal WebConnection WebConnection;
// Token: 0x04001153 RID: 4435
private DecompressionMethods auto_decomp;
// Token: 0x04001154 RID: 4436
private int maxResponseHeadersLength;
// Token: 0x04001155 RID: 4437
private static int defaultMaxResponseHeadersLength = 65536;
// Token: 0x04001156 RID: 4438
private int readWriteTimeout = 300000;
// Token: 0x04001157 RID: 4439
private bool unsafe_auth_blah;
}
}
+647
View File
@@ -0,0 +1,647 @@
using System;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Runtime.Serialization;
namespace System.Net
{
/// <summary>Provides an HTTP-specific implementation of the <see cref="T:System.Net.WebResponse" /> class.</summary>
// Token: 0x02000239 RID: 569
[Serializable]
public class HttpWebResponse : WebResponse, IDisposable, ISerializable
{
// Token: 0x06001443 RID: 5187 RVA: 0x0003FFBC File Offset: 0x0003E1BC
internal HttpWebResponse(global::System.Uri uri, string method, WebConnectionData data, CookieContainer container)
{
this.uri = uri;
this.method = method;
this.webHeaders = data.Headers;
this.version = data.Version;
this.statusCode = (HttpStatusCode)data.StatusCode;
this.statusDescription = data.StatusDescription;
this.stream = data.stream;
this.contentLength = -1L;
try
{
string text = this.webHeaders["Content-Length"];
if (string.IsNullOrEmpty(text) || !long.TryParse(text, out this.contentLength))
{
this.contentLength = -1L;
}
}
catch (Exception)
{
this.contentLength = -1L;
}
if (container != null)
{
this.cookie_container = container;
this.FillCookies();
}
string text2 = this.webHeaders["Content-Encoding"];
if (text2 == "gzip" && (data.request.AutomaticDecompression & DecompressionMethods.GZip) != DecompressionMethods.None)
{
this.stream = new global::System.IO.Compression.GZipStream(this.stream, global::System.IO.Compression.CompressionMode.Decompress);
}
else if (text2 == "deflate" && (data.request.AutomaticDecompression & DecompressionMethods.Deflate) != DecompressionMethods.None)
{
this.stream = new global::System.IO.Compression.DeflateStream(this.stream, global::System.IO.Compression.CompressionMode.Decompress);
}
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.HttpWebResponse" /> class from the specified <see cref="T:System.Runtime.Serialization.SerializationInfo" /> and <see cref="T:System.Runtime.Serialization.StreamingContext" /> instances.</summary>
/// <param name="serializationInfo">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that contains the information required to serialize the new <see cref="T:System.Net.HttpWebRequest" />. </param>
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains the source of the serialized stream that is associated with the new <see cref="T:System.Net.HttpWebRequest" />. </param>
// Token: 0x06001444 RID: 5188 RVA: 0x0004013C File Offset: 0x0003E33C
[Obsolete("Serialization is obsoleted for this type", false)]
protected HttpWebResponse(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
this.uri = (global::System.Uri)serializationInfo.GetValue("uri", typeof(global::System.Uri));
this.contentLength = serializationInfo.GetInt64("contentLength");
this.contentType = serializationInfo.GetString("contentType");
this.method = serializationInfo.GetString("method");
this.statusDescription = serializationInfo.GetString("statusDescription");
this.cookieCollection = (CookieCollection)serializationInfo.GetValue("cookieCollection", typeof(CookieCollection));
this.version = (Version)serializationInfo.GetValue("version", typeof(Version));
this.statusCode = (HttpStatusCode)((int)serializationInfo.GetValue("statusCode", typeof(HttpStatusCode)));
}
/// <summary>Serializes this instance into the specified <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object.</summary>
/// <param name="serializationInfo">The object into which this <see cref="T:System.Net.HttpWebResponse" /> will be serialized. </param>
/// <param name="streamingContext">The destination of the serialization. </param>
// Token: 0x06001445 RID: 5189 RVA: 0x0004023C File Offset: 0x0003E43C
void ISerializable.GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
this.GetObjectData(serializationInfo, streamingContext);
}
/// <summary>Releases all resources used by the <see cref="T:System.Net.HttpWebResponse" />.</summary>
// Token: 0x06001446 RID: 5190 RVA: 0x00040248 File Offset: 0x0003E448
void IDisposable.Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>Gets the character set of the response.</summary>
/// <returns>A string that contains the character set of the response.</returns>
/// <exception cref="T:System.ObjectDisposedException">The current instance has been disposed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
/// </PermissionSet>
// Token: 0x170006A6 RID: 1702
// (get) Token: 0x06001447 RID: 5191 RVA: 0x00040258 File Offset: 0x0003E458
public string CharacterSet
{
get
{
string text = this.ContentType;
if (text == null)
{
return "ISO-8859-1";
}
string text2 = text.ToLower();
int num = text2.IndexOf("charset=");
if (num == -1)
{
return "ISO-8859-1";
}
num += 8;
int num2 = text2.IndexOf(';', num);
return (num2 != -1) ? text.Substring(num, num2 - num) : text.Substring(num);
}
}
/// <summary>Gets the method that is used to encode the body of the response.</summary>
/// <returns>A string that describes the method that is used to encode the body of the response.</returns>
/// <exception cref="T:System.ObjectDisposedException">The current instance has been disposed. </exception>
// Token: 0x170006A7 RID: 1703
// (get) Token: 0x06001448 RID: 5192 RVA: 0x000402C4 File Offset: 0x0003E4C4
public string ContentEncoding
{
get
{
this.CheckDisposed();
string text = this.webHeaders["Content-Encoding"];
return (text == null) ? string.Empty : text;
}
}
/// <summary>Gets the length of the content returned by the request.</summary>
/// <returns>The number of bytes returned by the request. Content length does not include header information.</returns>
/// <exception cref="T:System.ObjectDisposedException">The current instance has been disposed. </exception>
// Token: 0x170006A8 RID: 1704
// (get) Token: 0x06001449 RID: 5193 RVA: 0x000402FC File Offset: 0x0003E4FC
public override long ContentLength
{
get
{
return this.contentLength;
}
}
/// <summary>Gets the content type of the response.</summary>
/// <returns>A string that contains the content type of the response.</returns>
/// <exception cref="T:System.ObjectDisposedException">The current instance has been disposed. </exception>
// Token: 0x170006A9 RID: 1705
// (get) Token: 0x0600144A RID: 5194 RVA: 0x00040304 File Offset: 0x0003E504
public override string ContentType
{
get
{
this.CheckDisposed();
if (this.contentType == null)
{
this.contentType = this.webHeaders["Content-Type"];
}
return this.contentType;
}
}
/// <summary>Gets or sets the cookies that are associated with this response.</summary>
/// <returns>A <see cref="T:System.Net.CookieCollection" /> that contains the cookies that are associated with this response.</returns>
/// <exception cref="T:System.ObjectDisposedException">The current instance has been disposed. </exception>
// Token: 0x170006AA RID: 1706
// (get) Token: 0x0600144B RID: 5195 RVA: 0x00040334 File Offset: 0x0003E534
// (set) Token: 0x0600144C RID: 5196 RVA: 0x00040364 File Offset: 0x0003E564
public CookieCollection Cookies
{
get
{
this.CheckDisposed();
if (this.cookieCollection == null)
{
this.cookieCollection = new CookieCollection();
}
return this.cookieCollection;
}
set
{
this.CheckDisposed();
this.cookieCollection = value;
}
}
/// <summary>Gets the headers that are associated with this response from the server.</summary>
/// <returns>A <see cref="T:System.Net.WebHeaderCollection" /> that contains the header information returned with the response.</returns>
/// <exception cref="T:System.ObjectDisposedException">The current instance has been disposed. </exception>
// Token: 0x170006AB RID: 1707
// (get) Token: 0x0600144D RID: 5197 RVA: 0x00040374 File Offset: 0x0003E574
public override WebHeaderCollection Headers
{
get
{
return this.webHeaders;
}
}
// Token: 0x0600144E RID: 5198 RVA: 0x0004037C File Offset: 0x0003E57C
private static Exception GetMustImplement()
{
return new NotImplementedException();
}
/// <summary>Gets a <see cref="T:System.Boolean" /> value that indicates whether both client and server were authenticated.</summary>
/// <returns>true if mutual authentication occurred; otherwise, false.</returns>
// Token: 0x170006AC RID: 1708
// (get) Token: 0x0600144F RID: 5199 RVA: 0x00040384 File Offset: 0x0003E584
[global::System.MonoTODO]
public override bool IsMutuallyAuthenticated
{
get
{
throw HttpWebResponse.GetMustImplement();
}
}
/// <summary>Gets the last date and time that the contents of the response were modified.</summary>
/// <returns>A <see cref="T:System.DateTime" /> that contains the date and time that the contents of the response were modified.</returns>
/// <exception cref="T:System.ObjectDisposedException">The current instance has been disposed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x170006AD RID: 1709
// (get) Token: 0x06001450 RID: 5200 RVA: 0x0004038C File Offset: 0x0003E58C
public DateTime LastModified
{
get
{
this.CheckDisposed();
DateTime dateTime;
try
{
string text = this.webHeaders["Last-Modified"];
dateTime = MonoHttpDate.Parse(text);
}
catch (Exception)
{
dateTime = DateTime.Now;
}
return dateTime;
}
}
/// <summary>Gets the method that is used to return the response.</summary>
/// <returns>A string that contains the HTTP method that is used to return the response.</returns>
/// <exception cref="T:System.ObjectDisposedException">The current instance has been disposed. </exception>
// Token: 0x170006AE RID: 1710
// (get) Token: 0x06001451 RID: 5201 RVA: 0x000403F0 File Offset: 0x0003E5F0
public string Method
{
get
{
this.CheckDisposed();
return this.method;
}
}
/// <summary>Gets the version of the HTTP protocol that is used in the response.</summary>
/// <returns>A <see cref="T:System.Version" /> that contains the HTTP protocol version of the response.</returns>
/// <exception cref="T:System.ObjectDisposedException">The current instance has been disposed. </exception>
// Token: 0x170006AF RID: 1711
// (get) Token: 0x06001452 RID: 5202 RVA: 0x00040400 File Offset: 0x0003E600
public Version ProtocolVersion
{
get
{
this.CheckDisposed();
return this.version;
}
}
/// <summary>Gets the URI of the Internet resource that responded to the request.</summary>
/// <returns>A <see cref="T:System.Uri" /> that contains the URI of the Internet resource that responded to the request.</returns>
/// <exception cref="T:System.ObjectDisposedException">The current instance has been disposed. </exception>
// Token: 0x170006B0 RID: 1712
// (get) Token: 0x06001453 RID: 5203 RVA: 0x00040410 File Offset: 0x0003E610
public override global::System.Uri ResponseUri
{
get
{
this.CheckDisposed();
return this.uri;
}
}
/// <summary>Gets the name of the server that sent the response.</summary>
/// <returns>A string that contains the name of the server that sent the response.</returns>
/// <exception cref="T:System.ObjectDisposedException">The current instance has been disposed. </exception>
// Token: 0x170006B1 RID: 1713
// (get) Token: 0x06001454 RID: 5204 RVA: 0x00040420 File Offset: 0x0003E620
public string Server
{
get
{
this.CheckDisposed();
return this.webHeaders["Server"];
}
}
/// <summary>Gets the status of the response.</summary>
/// <returns>One of the <see cref="T:System.Net.HttpStatusCode" /> values.</returns>
/// <exception cref="T:System.ObjectDisposedException">The current instance has been disposed. </exception>
// Token: 0x170006B2 RID: 1714
// (get) Token: 0x06001455 RID: 5205 RVA: 0x00040438 File Offset: 0x0003E638
public HttpStatusCode StatusCode
{
get
{
return this.statusCode;
}
}
/// <summary>Gets the status description returned with the response.</summary>
/// <returns>A string that describes the status of the response.</returns>
/// <exception cref="T:System.ObjectDisposedException">The current instance has been disposed. </exception>
// Token: 0x170006B3 RID: 1715
// (get) Token: 0x06001456 RID: 5206 RVA: 0x00040440 File Offset: 0x0003E640
public string StatusDescription
{
get
{
this.CheckDisposed();
return this.statusDescription;
}
}
/// <summary>Gets the contents of a header that was returned with the response.</summary>
/// <returns>The contents of the specified header.</returns>
/// <param name="headerName">The header value to return. </param>
/// <exception cref="T:System.ObjectDisposedException">The current instance has been disposed. </exception>
// Token: 0x06001457 RID: 5207 RVA: 0x00040450 File Offset: 0x0003E650
public string GetResponseHeader(string headerName)
{
this.CheckDisposed();
string text = this.webHeaders[headerName];
return (text == null) ? string.Empty : text;
}
// Token: 0x06001458 RID: 5208 RVA: 0x00040484 File Offset: 0x0003E684
internal void ReadAll()
{
WebConnectionStream webConnectionStream = this.stream as WebConnectionStream;
if (webConnectionStream == null)
{
return;
}
try
{
webConnectionStream.ReadAll();
}
catch
{
}
}
/// <summary>Gets the stream that is used to read the body of the response from the server.</summary>
/// <returns>A <see cref="T:System.IO.Stream" /> containing the body of the response.</returns>
/// <exception cref="T:System.Net.ProtocolViolationException">There is no response stream. </exception>
/// <exception cref="T:System.ObjectDisposedException">The current instance has been disposed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06001459 RID: 5209 RVA: 0x000404D4 File Offset: 0x0003E6D4
public override Stream GetResponseStream()
{
this.CheckDisposed();
if (this.stream == null)
{
return Stream.Null;
}
if (string.Compare(this.method, "HEAD", true) == 0)
{
return Stream.Null;
}
return this.stream;
}
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with the data needed to serialize the target object.</summary>
/// <param name="serializationInfo">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> to populate with data. </param>
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> that specifies the destination for this serialization.</param>
// Token: 0x0600145A RID: 5210 RVA: 0x00040510 File Offset: 0x0003E710
protected override void GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
serializationInfo.AddValue("uri", this.uri);
serializationInfo.AddValue("contentLength", this.contentLength);
serializationInfo.AddValue("contentType", this.contentType);
serializationInfo.AddValue("method", this.method);
serializationInfo.AddValue("statusDescription", this.statusDescription);
serializationInfo.AddValue("cookieCollection", this.cookieCollection);
serializationInfo.AddValue("version", this.version);
serializationInfo.AddValue("statusCode", this.statusCode);
}
/// <summary>Closes the response stream.</summary>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x0600145B RID: 5211 RVA: 0x000405AC File Offset: 0x0003E7AC
public override void Close()
{
((IDisposable)this).Dispose();
}
/// <summary>Releases the unmanaged resources used by the <see cref="T:System.Net.HttpWebResponse" />, and optionally disposes of the managed resources.</summary>
/// <param name="disposing">true to release both managed and unmanaged resources; false to releases only unmanaged resources. </param>
// Token: 0x0600145C RID: 5212 RVA: 0x000405B4 File Offset: 0x0003E7B4
private void Dispose(bool disposing)
{
if (this.disposed)
{
return;
}
this.disposed = true;
if (disposing)
{
this.uri = null;
this.cookieCollection = null;
this.method = null;
this.version = null;
this.statusDescription = null;
}
Stream stream = this.stream;
this.stream = null;
if (stream != null)
{
stream.Close();
}
}
// Token: 0x0600145D RID: 5213 RVA: 0x00040618 File Offset: 0x0003E818
private void CheckDisposed()
{
if (this.disposed)
{
throw new ObjectDisposedException(base.GetType().FullName);
}
}
// Token: 0x0600145E RID: 5214 RVA: 0x00040638 File Offset: 0x0003E838
private void FillCookies()
{
if (this.webHeaders == null)
{
return;
}
string[] array = this.webHeaders.GetValues("Set-Cookie");
if (array != null)
{
foreach (string text in array)
{
this.SetCookie(text);
}
}
array = this.webHeaders.GetValues("Set-Cookie2");
if (array != null)
{
foreach (string text2 in array)
{
this.SetCookie2(text2);
}
}
}
// Token: 0x0600145F RID: 5215 RVA: 0x000406CC File Offset: 0x0003E8CC
private void SetCookie(string header)
{
Cookie cookie = null;
CookieParser cookieParser = new CookieParser(header);
string text;
string text2;
while (cookieParser.GetNextNameValue(out text, out text2))
{
if ((text != null && !(text == string.Empty)) || cookie != null)
{
if (cookie == null)
{
cookie = new Cookie(text, text2);
}
else
{
text = text.ToUpper();
string text3 = text;
switch (text3)
{
case "COMMENT":
if (cookie.Comment == null)
{
cookie.Comment = text2;
}
break;
case "COMMENTURL":
if (cookie.CommentUri == null)
{
cookie.CommentUri = new global::System.Uri(text2);
}
break;
case "DISCARD":
cookie.Discard = true;
break;
case "DOMAIN":
if (cookie.Domain == string.Empty)
{
cookie.Domain = text2;
}
break;
case "HTTPONLY":
cookie.HttpOnly = true;
break;
case "MAX-AGE":
if (cookie.Expires == DateTime.MinValue)
{
try
{
cookie.Expires = cookie.TimeStamp.AddSeconds(uint.Parse(text2));
}
catch
{
}
}
break;
case "EXPIRES":
if (!(cookie.Expires != DateTime.MinValue))
{
cookie.Expires = this.TryParseCookieExpires(text2);
}
break;
case "PATH":
cookie.Path = text2;
break;
case "PORT":
if (cookie.Port == null)
{
cookie.Port = text2;
}
break;
case "SECURE":
cookie.Secure = true;
break;
case "VERSION":
try
{
cookie.Version = (int)uint.Parse(text2);
}
catch
{
}
break;
}
}
}
}
if (cookie == null)
{
return;
}
if (this.cookieCollection == null)
{
this.cookieCollection = new CookieCollection();
}
if (cookie.Domain == string.Empty)
{
cookie.Domain = this.uri.Host;
}
this.cookieCollection.Add(cookie);
if (this.cookie_container != null)
{
this.cookie_container.Add(this.uri, cookie);
}
}
// Token: 0x06001460 RID: 5216 RVA: 0x000409FC File Offset: 0x0003EBFC
private void SetCookie2(string cookies_str)
{
string[] array = cookies_str.Split(new char[] { ',' });
foreach (string text in array)
{
this.SetCookie(text);
}
}
// Token: 0x06001461 RID: 5217 RVA: 0x00040A3C File Offset: 0x0003EC3C
private DateTime TryParseCookieExpires(string value)
{
if (value == null || value.Length == 0)
{
return DateTime.MinValue;
}
for (int i = 0; i < this.cookieExpiresFormats.Length; i++)
{
try
{
DateTime dateTime = DateTime.ParseExact(value, this.cookieExpiresFormats[i], CultureInfo.InvariantCulture);
dateTime = DateTime.SpecifyKind(dateTime, DateTimeKind.Utc);
return TimeZone.CurrentTimeZone.ToLocalTime(dateTime);
}
catch
{
}
}
return DateTime.MinValue;
}
// Token: 0x04001158 RID: 4440
private global::System.Uri uri;
// Token: 0x04001159 RID: 4441
private WebHeaderCollection webHeaders;
// Token: 0x0400115A RID: 4442
private CookieCollection cookieCollection;
// Token: 0x0400115B RID: 4443
private string method;
// Token: 0x0400115C RID: 4444
private Version version;
// Token: 0x0400115D RID: 4445
private HttpStatusCode statusCode;
// Token: 0x0400115E RID: 4446
private string statusDescription;
// Token: 0x0400115F RID: 4447
private long contentLength;
// Token: 0x04001160 RID: 4448
private string contentType;
// Token: 0x04001161 RID: 4449
private CookieContainer cookie_container;
// Token: 0x04001162 RID: 4450
private bool disposed;
// Token: 0x04001163 RID: 4451
private Stream stream;
// Token: 0x04001164 RID: 4452
private string[] cookieExpiresFormats = new string[] { "r", "ddd, dd'-'MMM'-'yyyy HH':'mm':'ss 'GMT'", "ddd, dd'-'MMM'-'yy HH':'mm':'ss 'GMT'" };
}
}
+36
View File
@@ -0,0 +1,36 @@
using System;
namespace System.Net
{
/// <summary>Provides the base authentication interface for Web client authentication modules.</summary>
// Token: 0x0200023B RID: 571
public interface IAuthenticationModule
{
/// <summary>Returns an instance of the <see cref="T:System.Net.Authorization" /> class in respose to an authentication challenge from a server.</summary>
/// <returns>An <see cref="T:System.Net.Authorization" /> instance containing the authorization message for the request, or null if the challenge cannot be handled.</returns>
/// <param name="challenge">The authentication challenge sent by the server. </param>
/// <param name="request">The <see cref="T:System.Net.WebRequest" /> instance associated with the challenge. </param>
/// <param name="credentials">The credentials associated with the challenge. </param>
// Token: 0x06001467 RID: 5223
Authorization Authenticate(string challenge, WebRequest request, ICredentials credentials);
/// <summary>Returns an instance of the <see cref="T:System.Net.Authorization" /> class for an authentication request to a server.</summary>
/// <returns>An <see cref="T:System.Net.Authorization" /> instance containing the authorization message for the request.</returns>
/// <param name="request">The <see cref="T:System.Net.WebRequest" /> instance associated with the authentication request. </param>
/// <param name="credentials">The credentials associated with the authentication request. </param>
// Token: 0x06001468 RID: 5224
Authorization PreAuthenticate(WebRequest request, ICredentials credentials);
/// <summary>Gets the authentication type provided by this authentication module.</summary>
/// <returns>A string indicating the authentication type provided by this authentication module.</returns>
// Token: 0x170006B4 RID: 1716
// (get) Token: 0x06001469 RID: 5225
string AuthenticationType { get; }
/// <summary>Gets a value indicating whether the authentication module supports preauthentication.</summary>
/// <returns>true if the authorization module supports preauthentication; otherwise false.</returns>
// Token: 0x170006B5 RID: 1717
// (get) Token: 0x0600146A RID: 5226
bool CanPreAuthenticate { get; }
}
}
+19
View File
@@ -0,0 +1,19 @@
using System;
using System.Security.Cryptography.X509Certificates;
namespace System.Net
{
/// <summary>Validates a server certificate.</summary>
// Token: 0x0200023C RID: 572
public interface ICertificatePolicy
{
/// <summary>Validates a server certificate.</summary>
/// <returns>true if the certificate should be honored; otherwise, false.</returns>
/// <param name="srvPoint">The <see cref="T:System.Net.ServicePoint" /> that will use the certificate. </param>
/// <param name="certificate">The certificate to validate. </param>
/// <param name="request">The request that received the certificate. </param>
/// <param name="certificateProblem">The problem that was encountered when using the certificate. </param>
// Token: 0x0600146B RID: 5227
bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem);
}
}
+18
View File
@@ -0,0 +1,18 @@
using System;
namespace System.Net
{
/// <summary>Defines the credential policy to be used for resource requests that are made using <see cref="T:System.Net.WebRequest" /> and its derived classes.</summary>
// Token: 0x0200023E RID: 574
public interface ICredentialPolicy
{
/// <summary>Returns a <see cref="T:System.Boolean" /> that indicates whether the client's credentials are sent with a resource request made using an instance of the <see cref="T:System.Net.WebRequest" /> class.</summary>
/// <returns>true if the credentials are sent with the request; otherwise, false.</returns>
/// <param name="challengeUri">The <see cref="T:System.Uri" /> that will receive the request. For more information, see the Remarks section.</param>
/// <param name="request">The <see cref="T:System.Net.WebRequest" /> that represents the resource being requested.</param>
/// <param name="credential">The <see cref="T:System.Net.NetworkCredential" /> that will be sent with the request if this method returns true. </param>
/// <param name="authenticationModule">The <see cref="T:System.Net.IAuthenticationModule" /> that will conduct the authentication, if authentication is required.</param>
// Token: 0x0600146D RID: 5229
bool ShouldSendCredential(global::System.Uri challengeUri, WebRequest request, NetworkCredential credential, IAuthenticationModule authenticationModule);
}
}
+16
View File
@@ -0,0 +1,16 @@
using System;
namespace System.Net
{
/// <summary>Provides the base authentication interface for retrieving credentials for Web client authentication.</summary>
// Token: 0x0200023D RID: 573
public interface ICredentials
{
/// <summary>Returns a <see cref="T:System.Net.NetworkCredential" /> object that is associated with the specified URI, and authentication type.</summary>
/// <returns>The <see cref="T:System.Net.NetworkCredential" /> that is associated with the specified URI and authentication type, or, if no credentials are available, null.</returns>
/// <param name="uri">The <see cref="T:System.Uri" /> that the client is providing authentication for. </param>
/// <param name="authType">The type of authentication, as defined in the <see cref="P:System.Net.IAuthenticationModule.AuthenticationType" /> property. </param>
// Token: 0x0600146C RID: 5228
NetworkCredential GetCredential(global::System.Uri uri, string authType);
}
}
+17
View File
@@ -0,0 +1,17 @@
using System;
namespace System.Net
{
/// <summary>Provides the interface for retrieving credentials for a host, port, and authentication type.</summary>
// Token: 0x0200023F RID: 575
public interface ICredentialsByHost
{
/// <summary>Returns the credential for the specified host, port, and authentication protocol.</summary>
/// <returns>A <see cref="T:System.Net.NetworkCredential" /> for the specified host, port, and authentication protocol, or null if there are no credentials available for the specified host, port, and authentication protocol.</returns>
/// <param name="host">The host computer that is authenticating the client.</param>
/// <param name="port">The port on <paramref name="host " />that the client will communicate with.</param>
/// <param name="authenticationType">The authentication protocol.</param>
// Token: 0x0600146E RID: 5230
NetworkCredential GetCredential(string host, int port, string authType);
}
}
+630
View File
@@ -0,0 +1,630 @@
using System;
using System.Globalization;
using System.Net.Sockets;
namespace System.Net
{
/// <summary>Provides an Internet Protocol (IP) address.</summary>
// Token: 0x02000240 RID: 576
[Serializable]
public class IPAddress
{
/// <summary>Initializes a new instance of the <see cref="T:System.Net.IPAddress" /> class with the address specified as an <see cref="T:System.Int64" />.</summary>
/// <param name="newAddress">The long value of the IP address. For example, the value 0x2414188f in big-endian format would be the IP address "143.24.20.36". </param>
// Token: 0x0600146F RID: 5231 RVA: 0x00040D64 File Offset: 0x0003EF64
public IPAddress(long addr)
{
this.m_Address = addr;
this.m_Family = global::System.Net.Sockets.AddressFamily.InterNetwork;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.IPAddress" /> class with the address specified as a <see cref="T:System.Byte" /> array.</summary>
/// <param name="address">The byte array value of the IP address. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="address" /> is null. </exception>
// Token: 0x06001470 RID: 5232 RVA: 0x00040D7C File Offset: 0x0003EF7C
public IPAddress(byte[] address)
{
if (address == null)
{
throw new ArgumentNullException("address");
}
int num = address.Length;
if (num != 16 && num != 4)
{
throw new ArgumentException("An invalid IP address was specified.", "address");
}
if (num == 16)
{
this.m_Numbers = new ushort[8];
Buffer.BlockCopy(address, 0, this.m_Numbers, 0, 16);
this.m_Family = global::System.Net.Sockets.AddressFamily.InterNetworkV6;
this.m_ScopeId = 0L;
}
else
{
this.m_Address = (long)((ulong)((ulong)address[3] << 24) + (ulong)((long)((long)address[2] << 16)) + (ulong)((long)((long)address[1] << 8)) + (ulong)((long)address[0]));
this.m_Family = global::System.Net.Sockets.AddressFamily.InterNetwork;
}
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.IPAddress" /> class with the address specified as a <see cref="T:System.Byte" /> array and the specified scope identifier.</summary>
/// <param name="address">The byte array value of the IP address. </param>
/// <param name="scopeid">The long value of the scope identifier. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="address" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="scopeid" /> &lt; 0 or <paramref name="scopeid" /> &gt; 0x00000000FFFFFFFF </exception>
// Token: 0x06001471 RID: 5233 RVA: 0x00040E24 File Offset: 0x0003F024
public IPAddress(byte[] address, long scopeId)
{
if (address == null)
{
throw new ArgumentNullException("address");
}
if (address.Length != 16)
{
throw new ArgumentException("An invalid IP address was specified.", "address");
}
this.m_Numbers = new ushort[8];
Buffer.BlockCopy(address, 0, this.m_Numbers, 0, 16);
this.m_Family = global::System.Net.Sockets.AddressFamily.InterNetworkV6;
this.m_ScopeId = scopeId;
}
// Token: 0x06001472 RID: 5234 RVA: 0x00040E90 File Offset: 0x0003F090
internal IPAddress(ushort[] address, long scopeId)
{
this.m_Numbers = address;
for (int i = 0; i < 8; i++)
{
this.m_Numbers[i] = (ushort)IPAddress.HostToNetworkOrder((short)this.m_Numbers[i]);
}
this.m_Family = global::System.Net.Sockets.AddressFamily.InterNetworkV6;
this.m_ScopeId = scopeId;
}
// Token: 0x06001474 RID: 5236 RVA: 0x00040F58 File Offset: 0x0003F158
private static short SwapShort(short number)
{
return (short)(((number >> 8) & 255) | (((int)number << 8) & 65280));
}
// Token: 0x06001475 RID: 5237 RVA: 0x00040F70 File Offset: 0x0003F170
private static int SwapInt(int number)
{
return ((number >> 24) & 255) | ((number >> 8) & 65280) | ((number << 8) & 16711680) | (number << 24);
}
// Token: 0x06001476 RID: 5238 RVA: 0x00040F98 File Offset: 0x0003F198
private static long SwapLong(long number)
{
return ((number >> 56) & 255L) | ((number >> 40) & 65280L) | ((number >> 24) & 16711680L) | ((number >> 8) & (long)((ulong)(-16777216))) | ((number << 8) & 1095216660480L) | ((number << 24) & 280375465082880L) | ((number << 40) & 71776119061217280L) | (number << 56);
}
/// <summary>Converts a short value from host byte order to network byte order.</summary>
/// <returns>A short value, expressed in network byte order.</returns>
/// <param name="host">The number to convert, expressed in host byte order. </param>
// Token: 0x06001477 RID: 5239 RVA: 0x00041004 File Offset: 0x0003F204
public static short HostToNetworkOrder(short host)
{
if (!BitConverter.IsLittleEndian)
{
return host;
}
return IPAddress.SwapShort(host);
}
/// <summary>Converts an integer value from host byte order to network byte order.</summary>
/// <returns>An integer value, expressed in network byte order.</returns>
/// <param name="host">The number to convert, expressed in host byte order. </param>
// Token: 0x06001478 RID: 5240 RVA: 0x00041018 File Offset: 0x0003F218
public static int HostToNetworkOrder(int host)
{
if (!BitConverter.IsLittleEndian)
{
return host;
}
return IPAddress.SwapInt(host);
}
/// <summary>Converts a long value from host byte order to network byte order.</summary>
/// <returns>A long value, expressed in network byte order.</returns>
/// <param name="host">The number to convert, expressed in host byte order. </param>
// Token: 0x06001479 RID: 5241 RVA: 0x0004102C File Offset: 0x0003F22C
public static long HostToNetworkOrder(long host)
{
if (!BitConverter.IsLittleEndian)
{
return host;
}
return IPAddress.SwapLong(host);
}
/// <summary>Converts a short value from network byte order to host byte order.</summary>
/// <returns>A short value, expressed in host byte order.</returns>
/// <param name="network">The number to convert, expressed in network byte order. </param>
// Token: 0x0600147A RID: 5242 RVA: 0x00041040 File Offset: 0x0003F240
public static short NetworkToHostOrder(short network)
{
if (!BitConverter.IsLittleEndian)
{
return network;
}
return IPAddress.SwapShort(network);
}
/// <summary>Converts an integer value from network byte order to host byte order.</summary>
/// <returns>An integer value, expressed in host byte order.</returns>
/// <param name="network">The number to convert, expressed in network byte order. </param>
// Token: 0x0600147B RID: 5243 RVA: 0x00041054 File Offset: 0x0003F254
public static int NetworkToHostOrder(int network)
{
if (!BitConverter.IsLittleEndian)
{
return network;
}
return IPAddress.SwapInt(network);
}
/// <summary>Converts a long value from network byte order to host byte order.</summary>
/// <returns>A long value, expressed in host byte order.</returns>
/// <param name="network">The number to convert, expressed in network byte order. </param>
// Token: 0x0600147C RID: 5244 RVA: 0x00041068 File Offset: 0x0003F268
public static long NetworkToHostOrder(long network)
{
if (!BitConverter.IsLittleEndian)
{
return network;
}
return IPAddress.SwapLong(network);
}
/// <summary>Converts an IP address string to an <see cref="T:System.Net.IPAddress" /> instance.</summary>
/// <returns>An <see cref="T:System.Net.IPAddress" /> instance.</returns>
/// <param name="ipString">A string that contains an IP address in dotted-quad notation for IPv4 and in colon-hexadecimal notation for IPv6. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="ipString" /> is null. </exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="ipString" /> is not a valid IP address. </exception>
// Token: 0x0600147D RID: 5245 RVA: 0x0004107C File Offset: 0x0003F27C
public static IPAddress Parse(string ipString)
{
IPAddress ipaddress;
if (IPAddress.TryParse(ipString, out ipaddress))
{
return ipaddress;
}
throw new FormatException("An invalid IP address was specified.");
}
/// <summary>Determines whether a string is a valid IP address.</summary>
/// <returns>true if <paramref name="ipString" /> is a valid IP address; otherwise, false.</returns>
/// <param name="ipString">The string to validate.</param>
/// <param name="address">The <see cref="T:System.Net.IPAddress" /> version of the string.</param>
// Token: 0x0600147E RID: 5246 RVA: 0x000410A4 File Offset: 0x0003F2A4
public static bool TryParse(string ipString, out IPAddress address)
{
if (ipString == null)
{
throw new ArgumentNullException("ipString");
}
IPAddress ipaddress;
address = (ipaddress = IPAddress.ParseIPV4(ipString));
if (ipaddress == null)
{
address = (ipaddress = IPAddress.ParseIPV6(ipString));
if (ipaddress == null)
{
return false;
}
}
return true;
}
// Token: 0x0600147F RID: 5247 RVA: 0x000410E8 File Offset: 0x0003F2E8
private static IPAddress ParseIPV4(string ip)
{
int num = ip.IndexOf(' ');
if (num != -1)
{
string[] array = ip.Substring(num + 1).Split(new char[] { '.' });
if (array.Length > 0)
{
string text = array[array.Length - 1];
if (text.Length == 0)
{
return null;
}
foreach (char c in text.ToCharArray())
{
if (!global::System.Uri.IsHexDigit(c))
{
return null;
}
}
}
ip = ip.Substring(0, num);
}
if (ip.Length == 0 || ip[ip.Length - 1] == '.')
{
return null;
}
string[] array3 = ip.Split(new char[] { '.' });
if (array3.Length > 4)
{
return null;
}
IPAddress ipaddress;
try
{
long num2 = 0L;
long num3 = 0L;
for (int j = 0; j < array3.Length; j++)
{
string text2 = array3[j];
if (3 <= text2.Length && text2.Length <= 4 && text2[0] == '0' && (text2[1] == 'x' || text2[1] == 'X'))
{
if (text2.Length == 3)
{
num3 = (long)((byte)global::System.Uri.FromHex(text2[2]));
}
else
{
num3 = (long)((byte)((global::System.Uri.FromHex(text2[2]) << 4) | global::System.Uri.FromHex(text2[3])));
}
}
else
{
if (text2.Length == 0)
{
return null;
}
if (text2[0] == '0')
{
num3 = 0L;
for (int k = 1; k < text2.Length; k++)
{
if ('0' > text2[k] || text2[k] > '7')
{
return null;
}
num3 = (num3 << 3) + (long)text2[k] - 48L;
}
}
else if (!long.TryParse(text2, NumberStyles.None, null, out num3))
{
return null;
}
}
if (j == array3.Length - 1)
{
j = 3;
}
else if (num3 > 255L)
{
return null;
}
int num4 = 0;
while (num3 > 0L)
{
num2 |= (num3 & 255L) << (j - num4 << 3);
num4++;
num3 /= 256L;
}
}
ipaddress = new IPAddress(num2);
}
catch (Exception)
{
ipaddress = null;
}
return ipaddress;
}
// Token: 0x06001480 RID: 5248 RVA: 0x000413C0 File Offset: 0x0003F5C0
private static IPAddress ParseIPV6(string ip)
{
IPv6Address pv6Address;
if (IPv6Address.TryParse(ip, out pv6Address))
{
return new IPAddress(pv6Address.Address, pv6Address.ScopeId);
}
return null;
}
/// <summary>An Internet Protocol (IP) address.</summary>
/// <returns>The long value of the IP address.</returns>
// Token: 0x170006B6 RID: 1718
// (get) Token: 0x06001481 RID: 5249 RVA: 0x000413F0 File Offset: 0x0003F5F0
// (set) Token: 0x06001482 RID: 5250 RVA: 0x00041410 File Offset: 0x0003F610
[Obsolete("This property is obsolete. Use GetAddressBytes.")]
public long Address
{
get
{
if (this.m_Family != global::System.Net.Sockets.AddressFamily.InterNetwork)
{
throw new Exception("The attempted operation is not supported for the type of object referenced");
}
return this.m_Address;
}
set
{
if (this.m_Family != global::System.Net.Sockets.AddressFamily.InterNetwork)
{
throw new Exception("The attempted operation is not supported for the type of object referenced");
}
this.m_Address = value;
}
}
// Token: 0x170006B7 RID: 1719
// (get) Token: 0x06001483 RID: 5251 RVA: 0x00041430 File Offset: 0x0003F630
internal long InternalIPv4Address
{
get
{
return this.m_Address;
}
}
/// <summary>Gets whether the address is an IPv6 link local address.</summary>
/// <returns>true if the IP address is an IPv6 link local address; otherwise, false.</returns>
// Token: 0x170006B8 RID: 1720
// (get) Token: 0x06001484 RID: 5252 RVA: 0x00041438 File Offset: 0x0003F638
public bool IsIPv6LinkLocal
{
get
{
if (this.m_Family == global::System.Net.Sockets.AddressFamily.InterNetwork)
{
return false;
}
int num = (int)IPAddress.NetworkToHostOrder((short)this.m_Numbers[0]) & 65520;
return 65152 <= num && num < 65216;
}
}
/// <summary>Gets whether the address is an IPv6 site local address.</summary>
/// <returns>true if the IP address is an IPv6 site local address; otherwise, false.</returns>
// Token: 0x170006B9 RID: 1721
// (get) Token: 0x06001485 RID: 5253 RVA: 0x00041480 File Offset: 0x0003F680
public bool IsIPv6SiteLocal
{
get
{
if (this.m_Family == global::System.Net.Sockets.AddressFamily.InterNetwork)
{
return false;
}
int num = (int)IPAddress.NetworkToHostOrder((short)this.m_Numbers[0]) & 65520;
return 65216 <= num && num < 65280;
}
}
/// <summary>Gets whether the address is an IPv6 multicast global address.</summary>
/// <returns>true if the IP address is an IPv6 multicast global address; otherwise, false.</returns>
// Token: 0x170006BA RID: 1722
// (get) Token: 0x06001486 RID: 5254 RVA: 0x000414C8 File Offset: 0x0003F6C8
public bool IsIPv6Multicast
{
get
{
return this.m_Family != global::System.Net.Sockets.AddressFamily.InterNetwork && ((ushort)IPAddress.NetworkToHostOrder((short)this.m_Numbers[0]) & 65280) == 65280;
}
}
/// <summary>Gets or sets the IPv6 address scope identifier.</summary>
/// <returns>A long integer that specifies the scope of the address.</returns>
/// <exception cref="T:System.Net.Sockets.SocketException">AddressFamily = InterNetwork. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="scopeId" /> &lt; 0- or -<paramref name="scopeId" /> &gt; 0x00000000FFFFFFFF </exception>
// Token: 0x170006BB RID: 1723
// (get) Token: 0x06001487 RID: 5255 RVA: 0x000414F8 File Offset: 0x0003F6F8
// (set) Token: 0x06001488 RID: 5256 RVA: 0x00041518 File Offset: 0x0003F718
public long ScopeId
{
get
{
if (this.m_Family != global::System.Net.Sockets.AddressFamily.InterNetworkV6)
{
throw new Exception("The attempted operation is not supported for the type of object referenced");
}
return this.m_ScopeId;
}
set
{
if (this.m_Family != global::System.Net.Sockets.AddressFamily.InterNetworkV6)
{
throw new Exception("The attempted operation is not supported for the type of object referenced");
}
this.m_ScopeId = value;
}
}
/// <summary>Provides a copy of the <see cref="T:System.Net.IPAddress" /> as an array of bytes.</summary>
/// <returns>A <see cref="T:System.Byte" /> array.</returns>
// Token: 0x06001489 RID: 5257 RVA: 0x0004153C File Offset: 0x0003F73C
public byte[] GetAddressBytes()
{
if (this.m_Family == global::System.Net.Sockets.AddressFamily.InterNetworkV6)
{
byte[] array = new byte[16];
Buffer.BlockCopy(this.m_Numbers, 0, array, 0, 16);
return array;
}
return new byte[]
{
(byte)(this.m_Address & 255L),
(byte)((this.m_Address >> 8) & 255L),
(byte)((this.m_Address >> 16) & 255L),
(byte)(this.m_Address >> 24)
};
}
/// <summary>Gets the address family of the IP address.</summary>
/// <returns>Returns <see cref="F:System.Net.Sockets.AddressFamily.InterNetwork" /> for IPv4 or <see cref="F:System.Net.Sockets.AddressFamily.InterNetworkV6" /> for IPv6.</returns>
// Token: 0x170006BC RID: 1724
// (get) Token: 0x0600148A RID: 5258 RVA: 0x000415BC File Offset: 0x0003F7BC
public global::System.Net.Sockets.AddressFamily AddressFamily
{
get
{
return this.m_Family;
}
}
/// <summary>Indicates whether the specified IP address is the loopback address.</summary>
/// <returns>true if <paramref name="address" /> is the loopback address; otherwise, false.</returns>
/// <param name="address">An IP address. </param>
// Token: 0x0600148B RID: 5259 RVA: 0x000415C4 File Offset: 0x0003F7C4
public static bool IsLoopback(IPAddress addr)
{
if (addr.m_Family == global::System.Net.Sockets.AddressFamily.InterNetwork)
{
return (addr.m_Address & 255L) == 127L;
}
for (int i = 0; i < 6; i++)
{
if (addr.m_Numbers[i] != 0)
{
return false;
}
}
return IPAddress.NetworkToHostOrder((short)addr.m_Numbers[7]) == 1;
}
/// <summary>Converts an Internet address to its standard notation.</summary>
/// <returns>A string that contains the IP address in either IPv4 dotted-quad or in IPv6 colon-hexadecimal notation.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x0600148C RID: 5260 RVA: 0x00041624 File Offset: 0x0003F824
public override string ToString()
{
if (this.m_Family == global::System.Net.Sockets.AddressFamily.InterNetwork)
{
return IPAddress.ToString(this.m_Address);
}
ushort[] array = this.m_Numbers.Clone() as ushort[];
for (int i = 0; i < array.Length; i++)
{
array[i] = (ushort)IPAddress.NetworkToHostOrder((short)array[i]);
}
return new IPv6Address(array)
{
ScopeId = this.ScopeId
}.ToString();
}
// Token: 0x0600148D RID: 5261 RVA: 0x00041694 File Offset: 0x0003F894
private static string ToString(long addr)
{
return string.Concat(new string[]
{
(addr & 255L).ToString(),
".",
((addr >> 8) & 255L).ToString(),
".",
((addr >> 16) & 255L).ToString(),
".",
((addr >> 24) & 255L).ToString()
});
}
/// <summary>Compares two IP addresses.</summary>
/// <returns>true if the two addresses are equal; otherwise, false.</returns>
/// <param name="comparand">An <see cref="T:System.Net.IPAddress" /> instance to compare to the current instance. </param>
// Token: 0x0600148E RID: 5262 RVA: 0x00041718 File Offset: 0x0003F918
public override bool Equals(object other)
{
IPAddress ipaddress = other as IPAddress;
if (ipaddress == null)
{
return false;
}
if (this.AddressFamily != ipaddress.AddressFamily)
{
return false;
}
if (this.AddressFamily == global::System.Net.Sockets.AddressFamily.InterNetwork)
{
return this.m_Address == ipaddress.m_Address;
}
ushort[] numbers = ipaddress.m_Numbers;
for (int i = 0; i < 8; i++)
{
if (this.m_Numbers[i] != numbers[i])
{
return false;
}
}
return true;
}
/// <summary>Returns a hash value for an IP address.</summary>
/// <returns>An integer hash value.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x0600148F RID: 5263 RVA: 0x00041790 File Offset: 0x0003F990
public override int GetHashCode()
{
if (this.m_Family == global::System.Net.Sockets.AddressFamily.InterNetwork)
{
return (int)this.m_Address;
}
return IPAddress.Hash(((int)this.m_Numbers[0] << 16) + (int)this.m_Numbers[1], ((int)this.m_Numbers[2] << 16) + (int)this.m_Numbers[3], ((int)this.m_Numbers[4] << 16) + (int)this.m_Numbers[5], ((int)this.m_Numbers[6] << 16) + (int)this.m_Numbers[7]);
}
// Token: 0x06001490 RID: 5264 RVA: 0x00041808 File Offset: 0x0003FA08
private static int Hash(int i, int j, int k, int l)
{
return i ^ ((j << 13) | (j >> 19)) ^ ((k << 26) | (k >> 6)) ^ ((l << 7) | (l >> 25));
}
// Token: 0x04001169 RID: 4457
private long m_Address;
// Token: 0x0400116A RID: 4458
private global::System.Net.Sockets.AddressFamily m_Family;
// Token: 0x0400116B RID: 4459
private ushort[] m_Numbers;
// Token: 0x0400116C RID: 4460
private long m_ScopeId;
/// <summary>Provides an IP address that indicates that the server must listen for client activity on all network interfaces. This field is read-only.</summary>
// Token: 0x0400116D RID: 4461
public static readonly IPAddress Any = new IPAddress(0L);
/// <summary>Provides the IP broadcast address. This field is read-only.</summary>
// Token: 0x0400116E RID: 4462
public static readonly IPAddress Broadcast = IPAddress.Parse("255.255.255.255");
/// <summary>Provides the IP loopback address. This field is read-only.</summary>
// Token: 0x0400116F RID: 4463
public static readonly IPAddress Loopback = IPAddress.Parse("127.0.0.1");
/// <summary>Provides an IP address that indicates that no network interface should be used. This field is read-only.</summary>
// Token: 0x04001170 RID: 4464
public static readonly IPAddress None = IPAddress.Parse("255.255.255.255");
/// <summary>The <see cref="M:System.Net.Sockets.Socket.Bind(System.Net.EndPoint)" /> method uses the <see cref="F:System.Net.IPAddress.IPv6Any" /> field to indicate that a <see cref="T:System.Net.Sockets.Socket" /> must listen for client activity on all network interfaces.</summary>
// Token: 0x04001171 RID: 4465
public static readonly IPAddress IPv6Any = IPAddress.ParseIPV6("::");
/// <summary>Provides the IP loopback address. This property is read-only.</summary>
// Token: 0x04001172 RID: 4466
public static readonly IPAddress IPv6Loopback = IPAddress.ParseIPV6("::1");
/// <summary>Provides an IP address that indicates that no network interface should be used. This property is read-only.</summary>
// Token: 0x04001173 RID: 4467
public static readonly IPAddress IPv6None = IPAddress.ParseIPV6("::");
// Token: 0x04001174 RID: 4468
private int m_HashCode;
}
}
+229
View File
@@ -0,0 +1,229 @@
using System;
using System.Net.Sockets;
namespace System.Net
{
/// <summary>Represents a network endpoint as an IP address and a port number.</summary>
// Token: 0x02000241 RID: 577
[Serializable]
public class IPEndPoint : EndPoint
{
/// <summary>Initializes a new instance of the <see cref="T:System.Net.IPEndPoint" /> class with the specified address and port number.</summary>
/// <param name="address">An <see cref="T:System.Net.IPAddress" />. </param>
/// <param name="port">The port number associated with the <paramref name="address" />, or 0 to specify any available port. <paramref name="port" /> is in host order.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="port" /> is less than <see cref="F:System.Net.IPEndPoint.MinPort" />.-or- <paramref name="port" /> is greater than <see cref="F:System.Net.IPEndPoint.MaxPort" />.-or- <paramref name="address" /> is less than 0 or greater than 0x00000000FFFFFFFF. </exception>
// Token: 0x06001491 RID: 5265 RVA: 0x00041828 File Offset: 0x0003FA28
public IPEndPoint(IPAddress address, int port)
{
if (address == null)
{
throw new ArgumentNullException("address");
}
this.Address = address;
this.Port = port;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.IPEndPoint" /> class with the specified address and port number.</summary>
/// <param name="address">The IP address of the Internet host. </param>
/// <param name="port">The port number associated with the <paramref name="address" />, or 0 to specify any available port. <paramref name="port" /> is in host order.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="port" /> is less than <see cref="F:System.Net.IPEndPoint.MinPort" />.-or- <paramref name="port" /> is greater than <see cref="F:System.Net.IPEndPoint.MaxPort" />.-or- <paramref name="address" /> is less than 0 or greater than 0x00000000FFFFFFFF. </exception>
// Token: 0x06001492 RID: 5266 RVA: 0x00041850 File Offset: 0x0003FA50
public IPEndPoint(long iaddr, int port)
{
this.Address = new IPAddress(iaddr);
this.Port = port;
}
/// <summary>Gets or sets the IP address of the endpoint.</summary>
/// <returns>An <see cref="T:System.Net.IPAddress" /> instance containing the IP address of the endpoint.</returns>
// Token: 0x170006BD RID: 1725
// (get) Token: 0x06001493 RID: 5267 RVA: 0x0004186C File Offset: 0x0003FA6C
// (set) Token: 0x06001494 RID: 5268 RVA: 0x00041874 File Offset: 0x0003FA74
public IPAddress Address
{
get
{
return this.address;
}
set
{
this.address = value;
}
}
/// <summary>Gets the Internet Protocol (IP) address family.</summary>
/// <returns>Returns <see cref="F:System.Net.Sockets.AddressFamily.InterNetwork" />.</returns>
// Token: 0x170006BE RID: 1726
// (get) Token: 0x06001495 RID: 5269 RVA: 0x00041880 File Offset: 0x0003FA80
public override global::System.Net.Sockets.AddressFamily AddressFamily
{
get
{
return this.address.AddressFamily;
}
}
/// <summary>Gets or sets the port number of the endpoint.</summary>
/// <returns>An integer value in the range <see cref="F:System.Net.IPEndPoint.MinPort" /> to <see cref="F:System.Net.IPEndPoint.MaxPort" /> indicating the port number of the endpoint.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value that was specified for a set operation is less than <see cref="F:System.Net.IPEndPoint.MinPort" /> or greater than <see cref="F:System.Net.IPEndPoint.MaxPort" />. </exception>
// Token: 0x170006BF RID: 1727
// (get) Token: 0x06001496 RID: 5270 RVA: 0x00041890 File Offset: 0x0003FA90
// (set) Token: 0x06001497 RID: 5271 RVA: 0x00041898 File Offset: 0x0003FA98
public int Port
{
get
{
return this.port;
}
set
{
if (value < 0 || value > 65535)
{
throw new ArgumentOutOfRangeException("Invalid port");
}
this.port = value;
}
}
/// <summary>Creates an endpoint from a socket address.</summary>
/// <returns>An <see cref="T:System.Net.EndPoint" /> instance using the specified socket address.</returns>
/// <param name="socketAddress">The <see cref="T:System.Net.SocketAddress" /> to use for the endpoint. </param>
/// <exception cref="T:System.ArgumentException">The AddressFamily of <paramref name="socketAddress" /> is not equal to the AddressFamily of the current instance.-or- <paramref name="socketAddress" />.Size &lt; 8. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06001498 RID: 5272 RVA: 0x000418CC File Offset: 0x0003FACC
public override EndPoint Create(SocketAddress socketAddress)
{
if (socketAddress == null)
{
throw new ArgumentNullException("socketAddress");
}
if (socketAddress.Family != this.AddressFamily)
{
throw new ArgumentException(string.Concat(new object[] { "The IPEndPoint was created using ", this.AddressFamily, " AddressFamily but SocketAddress contains ", socketAddress.Family, " instead, please use the same type." }));
}
int size = socketAddress.Size;
global::System.Net.Sockets.AddressFamily family = socketAddress.Family;
global::System.Net.Sockets.AddressFamily addressFamily = family;
IPEndPoint ipendPoint;
if (addressFamily != global::System.Net.Sockets.AddressFamily.InterNetwork)
{
if (addressFamily != global::System.Net.Sockets.AddressFamily.InterNetworkV6)
{
return null;
}
if (size < 28)
{
return null;
}
int num = ((int)socketAddress[2] << 8) + (int)socketAddress[3];
int num2 = (int)socketAddress[24] + ((int)socketAddress[25] << 8) + ((int)socketAddress[26] << 16) + ((int)socketAddress[27] << 24);
ushort[] array = new ushort[8];
for (int i = 0; i < 8; i++)
{
array[i] = (ushort)(((int)socketAddress[8 + i * 2] << 8) + (int)socketAddress[8 + i * 2 + 1]);
}
ipendPoint = new IPEndPoint(new IPAddress(array, (long)num2), num);
}
else
{
if (size < 8)
{
return null;
}
int num = ((int)socketAddress[2] << 8) + (int)socketAddress[3];
long num3 = ((long)socketAddress[7] << 24) + ((long)socketAddress[6] << 16) + ((long)socketAddress[5] << 8) + (long)socketAddress[4];
ipendPoint = new IPEndPoint(num3, num);
}
return ipendPoint;
}
/// <summary>Serializes endpoint information into a <see cref="T:System.Net.SocketAddress" /> instance.</summary>
/// <returns>A <see cref="T:System.Net.SocketAddress" /> instance containing the socket address for the endpoint.</returns>
// Token: 0x06001499 RID: 5273 RVA: 0x00041A68 File Offset: 0x0003FC68
public override SocketAddress Serialize()
{
SocketAddress socketAddress = null;
global::System.Net.Sockets.AddressFamily addressFamily = this.address.AddressFamily;
if (addressFamily != global::System.Net.Sockets.AddressFamily.InterNetwork)
{
if (addressFamily == global::System.Net.Sockets.AddressFamily.InterNetworkV6)
{
socketAddress = new SocketAddress(global::System.Net.Sockets.AddressFamily.InterNetworkV6, 28);
socketAddress[2] = (byte)((this.port >> 8) & 255);
socketAddress[3] = (byte)(this.port & 255);
byte[] addressBytes = this.address.GetAddressBytes();
for (int i = 0; i < 16; i++)
{
socketAddress[8 + i] = addressBytes[i];
}
socketAddress[24] = (byte)(this.address.ScopeId & 255L);
socketAddress[25] = (byte)((this.address.ScopeId >> 8) & 255L);
socketAddress[26] = (byte)((this.address.ScopeId >> 16) & 255L);
socketAddress[27] = (byte)((this.address.ScopeId >> 24) & 255L);
}
}
else
{
socketAddress = new SocketAddress(global::System.Net.Sockets.AddressFamily.InterNetwork, 16);
socketAddress[2] = (byte)((this.port >> 8) & 255);
socketAddress[3] = (byte)(this.port & 255);
long internalIPv4Address = this.address.InternalIPv4Address;
socketAddress[4] = (byte)(internalIPv4Address & 255L);
socketAddress[5] = (byte)((internalIPv4Address >> 8) & 255L);
socketAddress[6] = (byte)((internalIPv4Address >> 16) & 255L);
socketAddress[7] = (byte)((internalIPv4Address >> 24) & 255L);
}
return socketAddress;
}
/// <summary>Returns the IP address and port number of the specified endpoint.</summary>
/// <returns>A string containing the IP address and the port number of the specified endpoint (for example, 192.168.1.2:80).</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x0600149A RID: 5274 RVA: 0x00041C00 File Offset: 0x0003FE00
public override string ToString()
{
return this.address.ToString() + ":" + this.port;
}
/// <summary>Determines whether the specified <see cref="T:System.Object" /> is equal to the current <see cref="T:System.Net.IPEndPoint" /> instance.</summary>
/// <returns>true if the specified <see cref="T:System.Object" /> is equal to the current <see cref="T:System.Object" />; otherwise, false.</returns>
/// <param name="comparand">The specified <see cref="T:System.Object" /> to compare with the current <see cref="T:System.Net.IPEndPoint" /> instance.</param>
// Token: 0x0600149B RID: 5275 RVA: 0x00041C30 File Offset: 0x0003FE30
public override bool Equals(object obj)
{
IPEndPoint ipendPoint = obj as IPEndPoint;
return ipendPoint != null && ipendPoint.port == this.port && ipendPoint.address.Equals(this.address);
}
/// <summary>Returns a hash value for a <see cref="T:System.Net.IPEndPoint" /> instance.</summary>
/// <returns>An integer hash value.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x0600149C RID: 5276 RVA: 0x00041C70 File Offset: 0x0003FE70
public override int GetHashCode()
{
return this.address.GetHashCode() + this.port;
}
/// <summary>Specifies the maximum value that can be assigned to the <see cref="P:System.Net.IPEndPoint.Port" /> property. The MaxPort value is set to 0x0000FFFF. This field is read-only.</summary>
// Token: 0x04001175 RID: 4469
public const int MaxPort = 65535;
/// <summary>Specifies the minimum value that can be assigned to the <see cref="P:System.Net.IPEndPoint.Port" /> property. This field is read-only.</summary>
// Token: 0x04001176 RID: 4470
public const int MinPort = 0;
// Token: 0x04001177 RID: 4471
private IPAddress address;
// Token: 0x04001178 RID: 4472
private int port;
}
}
+69
View File
@@ -0,0 +1,69 @@
using System;
namespace System.Net
{
/// <summary>Provides a container class for Internet host address information.</summary>
// Token: 0x02000242 RID: 578
public class IPHostEntry
{
/// <summary>Gets or sets a list of IP addresses that are associated with a host.</summary>
/// <returns>An array of type <see cref="T:System.Net.IPAddress" /> that contains IP addresses that resolve to the host names that are contained in the <see cref="P:System.Net.IPHostEntry.Aliases" /> property.</returns>
// Token: 0x170006C0 RID: 1728
// (get) Token: 0x0600149E RID: 5278 RVA: 0x00041C8C File Offset: 0x0003FE8C
// (set) Token: 0x0600149F RID: 5279 RVA: 0x00041C94 File Offset: 0x0003FE94
public IPAddress[] AddressList
{
get
{
return this.addressList;
}
set
{
this.addressList = value;
}
}
/// <summary>Gets or sets a list of aliases that are associated with a host.</summary>
/// <returns>An array of strings that contain DNS names that resolve to the IP addresses in the <see cref="P:System.Net.IPHostEntry.AddressList" /> property.</returns>
// Token: 0x170006C1 RID: 1729
// (get) Token: 0x060014A0 RID: 5280 RVA: 0x00041CA0 File Offset: 0x0003FEA0
// (set) Token: 0x060014A1 RID: 5281 RVA: 0x00041CA8 File Offset: 0x0003FEA8
public string[] Aliases
{
get
{
return this.aliases;
}
set
{
this.aliases = value;
}
}
/// <summary>Gets or sets the DNS name of the host.</summary>
/// <returns>A string that contains the primary host name for the server.</returns>
// Token: 0x170006C2 RID: 1730
// (get) Token: 0x060014A2 RID: 5282 RVA: 0x00041CB4 File Offset: 0x0003FEB4
// (set) Token: 0x060014A3 RID: 5283 RVA: 0x00041CBC File Offset: 0x0003FEBC
public string HostName
{
get
{
return this.hostName;
}
set
{
this.hostName = value;
}
}
// Token: 0x04001179 RID: 4473
private IPAddress[] addressList;
// Token: 0x0400117A RID: 4474
private string[] aliases;
// Token: 0x0400117B RID: 4475
private string hostName;
}
}
+521
View File
@@ -0,0 +1,521 @@
using System;
using System.Globalization;
using System.Net.Sockets;
using System.Text;
namespace System.Net
{
// Token: 0x02000243 RID: 579
[Serializable]
internal class IPv6Address
{
// Token: 0x060014A4 RID: 5284 RVA: 0x00041CC8 File Offset: 0x0003FEC8
public IPv6Address(ushort[] addr)
{
if (addr == null)
{
throw new ArgumentNullException("addr");
}
if (addr.Length != 8)
{
throw new ArgumentException("addr");
}
this.address = addr;
}
// Token: 0x060014A5 RID: 5285 RVA: 0x00041D08 File Offset: 0x0003FF08
public IPv6Address(ushort[] addr, int prefixLength)
: this(addr)
{
if (prefixLength < 0 || prefixLength > 128)
{
throw new ArgumentException("prefixLength");
}
this.prefixLength = prefixLength;
}
// Token: 0x060014A6 RID: 5286 RVA: 0x00041D38 File Offset: 0x0003FF38
public IPv6Address(ushort[] addr, int prefixLength, int scopeId)
: this(addr, prefixLength)
{
this.scopeId = (long)scopeId;
}
// Token: 0x060014A8 RID: 5288 RVA: 0x00041D6C File Offset: 0x0003FF6C
public static IPv6Address Parse(string ipString)
{
if (ipString == null)
{
throw new ArgumentNullException("ipString");
}
IPv6Address pv6Address;
if (IPv6Address.TryParse(ipString, out pv6Address))
{
return pv6Address;
}
throw new FormatException("Not a valid IPv6 address");
}
// Token: 0x060014A9 RID: 5289 RVA: 0x00041DA4 File Offset: 0x0003FFA4
private static int Fill(ushort[] addr, string ipString)
{
int num = 0;
int num2 = 0;
if (ipString.Length == 0)
{
return 0;
}
if (ipString.IndexOf("::") != -1)
{
return -1;
}
for (int i = 0; i < ipString.Length; i++)
{
char c = ipString[i];
if (c == ':')
{
if (i == ipString.Length - 1)
{
return -1;
}
if (num2 == 8)
{
return -1;
}
addr[num2++] = (ushort)num;
num = 0;
}
else
{
int num3;
if ('0' <= c && c <= '9')
{
num3 = (int)(c - '0');
}
else if ('a' <= c && c <= 'f')
{
num3 = (int)(c - 'a' + '\n');
}
else
{
if ('A' > c || c > 'F')
{
return -1;
}
num3 = (int)(c - 'A' + '\n');
}
num = (num << 4) + num3;
if (num > 65535)
{
return -1;
}
}
}
if (num2 == 8)
{
return -1;
}
addr[num2++] = (ushort)num;
return num2;
}
// Token: 0x060014AA RID: 5290 RVA: 0x00041EA8 File Offset: 0x000400A8
private static bool TryParse(string prefix, out int res)
{
return int.TryParse(prefix, NumberStyles.Integer, CultureInfo.InvariantCulture, out res);
}
// Token: 0x060014AB RID: 5291 RVA: 0x00041EB8 File Offset: 0x000400B8
public static bool TryParse(string ipString, out IPv6Address result)
{
result = null;
if (ipString == null)
{
return false;
}
if (ipString.Length > 2 && ipString[0] == '[' && ipString[ipString.Length - 1] == ']')
{
ipString = ipString.Substring(1, ipString.Length - 2);
}
if (ipString.Length < 2)
{
return false;
}
int num = 0;
int num2 = 0;
int num3 = ipString.LastIndexOf('/');
if (num3 != -1)
{
string text = ipString.Substring(num3 + 1);
if (!IPv6Address.TryParse(text, out num))
{
num = -1;
}
if (num < 0 || num > 128)
{
return false;
}
ipString = ipString.Substring(0, num3);
}
else
{
num3 = ipString.LastIndexOf('%');
if (num3 != -1)
{
string text2 = ipString.Substring(num3 + 1);
if (!IPv6Address.TryParse(text2, out num2))
{
num2 = 0;
}
ipString = ipString.Substring(0, num3);
}
}
ushort[] array = new ushort[8];
bool flag = false;
int num4 = ipString.LastIndexOf(':');
if (num4 == -1)
{
return false;
}
int num5 = 0;
if (num4 < ipString.Length - 1)
{
string text3 = ipString.Substring(num4 + 1);
if (text3.IndexOf('.') != -1)
{
IPAddress ipaddress;
if (!IPAddress.TryParse(text3, out ipaddress))
{
return false;
}
long internalIPv4Address = ipaddress.InternalIPv4Address;
array[6] = (ushort)(((int)(internalIPv4Address & 255L) << 8) + (int)((internalIPv4Address >> 8) & 255L));
array[7] = (ushort)(((int)((internalIPv4Address >> 16) & 255L) << 8) + (int)((internalIPv4Address >> 24) & 255L));
if (num4 > 0 && ipString[num4 - 1] == ':')
{
ipString = ipString.Substring(0, num4 + 1);
}
else
{
ipString = ipString.Substring(0, num4);
}
flag = true;
num5 = 2;
}
}
int num6 = ipString.IndexOf("::");
if (num6 != -1)
{
int num7 = IPv6Address.Fill(array, ipString.Substring(num6 + 2));
if (num7 == -1)
{
return false;
}
if (num7 + num5 > 8)
{
return false;
}
int num8 = 8 - num5 - num7;
for (int i = num7; i > 0; i--)
{
array[i + num8 - 1] = array[i - 1];
array[i - 1] = 0;
}
int num9 = IPv6Address.Fill(array, ipString.Substring(0, num6));
if (num9 == -1)
{
return false;
}
if (num9 + num7 + num5 > 7)
{
return false;
}
}
else if (IPv6Address.Fill(array, ipString) != 8 - num5)
{
return false;
}
bool flag2 = false;
for (int j = 0; j < num5; j++)
{
if (array[j] != 0 || (j == 5 && array[j] != 65535))
{
flag2 = true;
}
}
if (flag && !flag2)
{
for (int k = 0; k < 5; k++)
{
if (array[k] != 0)
{
return false;
}
}
if (array[5] != 0 && array[5] != 65535)
{
return false;
}
}
result = new IPv6Address(array, num, num2);
return true;
}
// Token: 0x170006C3 RID: 1731
// (get) Token: 0x060014AC RID: 5292 RVA: 0x000421D4 File Offset: 0x000403D4
public ushort[] Address
{
get
{
return this.address;
}
}
// Token: 0x170006C4 RID: 1732
// (get) Token: 0x060014AD RID: 5293 RVA: 0x000421DC File Offset: 0x000403DC
public int PrefixLength
{
get
{
return this.prefixLength;
}
}
// Token: 0x170006C5 RID: 1733
// (get) Token: 0x060014AE RID: 5294 RVA: 0x000421E4 File Offset: 0x000403E4
// (set) Token: 0x060014AF RID: 5295 RVA: 0x000421EC File Offset: 0x000403EC
public long ScopeId
{
get
{
return this.scopeId;
}
set
{
this.scopeId = value;
}
}
// Token: 0x170006C6 RID: 1734
public ushort this[int index]
{
get
{
return this.address[index];
}
}
// Token: 0x170006C7 RID: 1735
// (get) Token: 0x060014B1 RID: 5297 RVA: 0x00042204 File Offset: 0x00040404
public global::System.Net.Sockets.AddressFamily AddressFamily
{
get
{
return global::System.Net.Sockets.AddressFamily.InterNetworkV6;
}
}
// Token: 0x060014B2 RID: 5298 RVA: 0x00042208 File Offset: 0x00040408
public static bool IsLoopback(IPv6Address addr)
{
if (addr.address[7] != 1)
{
return false;
}
int num = addr.address[6] >> 8;
if (num != 127 && num != 0)
{
return false;
}
for (int i = 0; i < 4; i++)
{
if (addr.address[i] != 0)
{
return false;
}
}
return addr.address[5] == 0 || addr.address[5] == ushort.MaxValue;
}
// Token: 0x060014B3 RID: 5299 RVA: 0x00042284 File Offset: 0x00040484
private static ushort SwapUShort(ushort number)
{
return (ushort)(((number >> 8) & 255) + (((int)number << 8) & 65280));
}
// Token: 0x060014B4 RID: 5300 RVA: 0x0004229C File Offset: 0x0004049C
private int AsIPv4Int()
{
return ((int)IPv6Address.SwapUShort(this.address[7]) << 16) + (int)IPv6Address.SwapUShort(this.address[6]);
}
// Token: 0x060014B5 RID: 5301 RVA: 0x000422BC File Offset: 0x000404BC
public bool IsIPv4Compatible()
{
for (int i = 0; i < 6; i++)
{
if (this.address[i] != 0)
{
return false;
}
}
return this.AsIPv4Int() > 1;
}
// Token: 0x060014B6 RID: 5302 RVA: 0x000422F4 File Offset: 0x000404F4
public bool IsIPv4Mapped()
{
for (int i = 0; i < 5; i++)
{
if (this.address[i] != 0)
{
return false;
}
}
return this.address[5] == ushort.MaxValue;
}
// Token: 0x060014B7 RID: 5303 RVA: 0x00042334 File Offset: 0x00040534
public override string ToString()
{
StringBuilder stringBuilder = new StringBuilder();
if (this.IsIPv4Compatible() || this.IsIPv4Mapped())
{
stringBuilder.Append("::");
if (this.IsIPv4Mapped())
{
stringBuilder.Append("ffff:");
}
stringBuilder.Append(new IPAddress((long)this.AsIPv4Int()).ToString());
return stringBuilder.ToString();
}
int num = -1;
int num2 = 0;
int num3 = 0;
for (int i = 0; i < 8; i++)
{
if (this.address[i] != 0)
{
if (num3 > num2 && num3 > 1)
{
num2 = num3;
num = i - num3;
}
num3 = 0;
}
else
{
num3++;
}
}
if (num3 > num2 && num3 > 1)
{
num2 = num3;
num = 8 - num3;
}
if (num == 0)
{
stringBuilder.Append(":");
}
for (int j = 0; j < 8; j++)
{
if (j == num)
{
stringBuilder.Append(":");
j += num2 - 1;
}
else
{
stringBuilder.AppendFormat("{0:x}", this.address[j]);
if (j < 7)
{
stringBuilder.Append(':');
}
}
}
if (this.scopeId != 0L)
{
stringBuilder.Append('%').Append(this.scopeId);
}
return stringBuilder.ToString();
}
// Token: 0x060014B8 RID: 5304 RVA: 0x00042498 File Offset: 0x00040698
public string ToString(bool fullLength)
{
if (!fullLength)
{
return this.ToString();
}
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < this.address.Length - 1; i++)
{
stringBuilder.AppendFormat("{0:X4}:", this.address[i]);
}
stringBuilder.AppendFormat("{0:X4}", this.address[this.address.Length - 1]);
return stringBuilder.ToString();
}
// Token: 0x060014B9 RID: 5305 RVA: 0x00042514 File Offset: 0x00040714
public override bool Equals(object other)
{
IPv6Address pv6Address = other as IPv6Address;
if (pv6Address != null)
{
for (int i = 0; i < 8; i++)
{
if (this.address[i] != pv6Address.address[i])
{
return false;
}
}
return true;
}
IPAddress ipaddress = other as IPAddress;
if (ipaddress == null)
{
return false;
}
for (int j = 0; j < 5; j++)
{
if (this.address[j] != 0)
{
return false;
}
}
if (this.address[5] != 0 && this.address[5] != 65535)
{
return false;
}
long internalIPv4Address = ipaddress.InternalIPv4Address;
return this.address[6] == (ushort)(((int)(internalIPv4Address & 255L) << 8) + (int)((internalIPv4Address >> 8) & 255L)) && this.address[7] == (ushort)(((int)((internalIPv4Address >> 16) & 255L) << 8) + (int)((internalIPv4Address >> 24) & 255L));
}
// Token: 0x060014BA RID: 5306 RVA: 0x00042608 File Offset: 0x00040808
public override int GetHashCode()
{
return IPv6Address.Hash(((int)this.address[0] << 16) + (int)this.address[1], ((int)this.address[2] << 16) + (int)this.address[3], ((int)this.address[4] << 16) + (int)this.address[5], ((int)this.address[6] << 16) + (int)this.address[7]);
}
// Token: 0x060014BB RID: 5307 RVA: 0x0004266C File Offset: 0x0004086C
private static int Hash(int i, int j, int k, int l)
{
return i ^ ((j << 13) | (j >> 19)) ^ ((k << 26) | (k >> 6)) ^ ((l << 7) | (l >> 25));
}
// Token: 0x0400117C RID: 4476
private ushort[] address;
// Token: 0x0400117D RID: 4477
private int prefixLength;
// Token: 0x0400117E RID: 4478
private long scopeId;
// Token: 0x0400117F RID: 4479
public static readonly IPv6Address Loopback = IPv6Address.Parse("::1");
// Token: 0x04001180 RID: 4480
public static readonly IPv6Address Unspecified = IPv6Address.Parse("::");
}
}
+28
View File
@@ -0,0 +1,28 @@
using System;
namespace System.Net
{
/// <summary>Provides the base interface for implementation of proxy access for the <see cref="T:System.Net.WebRequest" /> class.</summary>
// Token: 0x02000244 RID: 580
public interface IWebProxy
{
/// <summary>The credentials to submit to the proxy server for authentication.</summary>
/// <returns>An <see cref="T:System.Net.ICredentials" /> instance that contains the credentials that are needed to authenticate a request to the proxy server.</returns>
// Token: 0x170006C8 RID: 1736
// (get) Token: 0x060014BC RID: 5308
// (set) Token: 0x060014BD RID: 5309
ICredentials Credentials { get; set; }
/// <summary>Returns the URI of a proxy.</summary>
/// <returns>A <see cref="T:System.Uri" /> instance that contains the URI of the proxy used to contact <paramref name="destination" />.</returns>
/// <param name="destination">A <see cref="T:System.Uri" /> that specifies the requested Internet resource. </param>
// Token: 0x060014BE RID: 5310
global::System.Uri GetProxy(global::System.Uri destination);
/// <summary>Indicates that the proxy should not be used for the specified host.</summary>
/// <returns>true if the proxy server should not be used for <paramref name="host" />; otherwise, false.</returns>
/// <param name="host">The <see cref="T:System.Uri" /> of the host to check for proxy use. </param>
// Token: 0x060014BF RID: 5311
bool IsBypassed(global::System.Uri host);
}
}
+28
View File
@@ -0,0 +1,28 @@
using System;
namespace System.Net
{
/// <summary>Provides the base interface to load and execute scripts for automatic proxy detection.</summary>
// Token: 0x02000245 RID: 581
public interface IWebProxyScript
{
/// <summary>Closes a script.</summary>
// Token: 0x060014C0 RID: 5312
void Close();
/// <summary>Loads a script.</summary>
/// <returns>A <see cref="T:System.Boolean" /> indicating whether the script was successfully loaded.</returns>
/// <param name="scriptLocation">Internal only.</param>
/// <param name="script">Internal only.</param>
/// <param name="helperType">Internal only.</param>
// Token: 0x060014C1 RID: 5313
bool Load(global::System.Uri scriptLocation, string Script, Type helperType);
/// <summary>Runs a script.</summary>
/// <returns>A <see cref="T:System.String" />.</returns>
/// <param name="url">Internal only.</param>
/// <param name="host">Internal only.</param>
// Token: 0x060014C2 RID: 5314
string Run(string url, string host);
}
}
+19
View File
@@ -0,0 +1,19 @@
using System;
namespace System.Net
{
/// <summary>Provides the base interface for creating <see cref="T:System.Net.WebRequest" /> instances.</summary>
// Token: 0x02000246 RID: 582
public interface IWebRequestCreate
{
/// <summary>Creates a <see cref="T:System.Net.WebRequest" /> instance.</summary>
/// <returns>A <see cref="T:System.Net.WebRequest" /> instance.</returns>
/// <param name="uri">The uniform resource identifier (URI) of the Web resource. </param>
/// <exception cref="T:System.NotSupportedException">The request scheme specified in <paramref name="uri" /> is not supported by this <see cref="T:System.Net.IWebRequestCreate" /> instance. </exception>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="uri" /> is null. </exception>
/// <exception cref="T:System.UriFormatException">The URI specified in <paramref name="uri" /> is not a valid URI. </exception>
// Token: 0x060014C3 RID: 5315
WebRequest Create(global::System.Uri uri);
}
}
+231
View File
@@ -0,0 +1,231 @@
using System;
using System.Threading;
namespace System.Net
{
// Token: 0x02000247 RID: 583
internal class ListenerAsyncResult : IAsyncResult
{
// Token: 0x060014C4 RID: 5316 RVA: 0x0004268C File Offset: 0x0004088C
public ListenerAsyncResult(AsyncCallback cb, object state)
{
this.cb = cb;
this.state = state;
}
// Token: 0x060014C5 RID: 5317 RVA: 0x000426B0 File Offset: 0x000408B0
internal void Complete(string error)
{
if (this.forward != null)
{
this.forward.Complete(error);
return;
}
this.exception = new HttpListenerException(0, error);
object obj = this.locker;
lock (obj)
{
this.completed = true;
if (this.handle != null)
{
this.handle.Set();
}
if (this.cb != null)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(ListenerAsyncResult.InvokeCallback), this);
}
}
}
// Token: 0x060014C6 RID: 5318 RVA: 0x00042754 File Offset: 0x00040954
private static void InvokeCallback(object o)
{
ListenerAsyncResult listenerAsyncResult = (ListenerAsyncResult)o;
if (listenerAsyncResult.forward != null)
{
listenerAsyncResult.forward.cb(listenerAsyncResult);
return;
}
listenerAsyncResult.cb(listenerAsyncResult);
}
// Token: 0x060014C7 RID: 5319 RVA: 0x00042794 File Offset: 0x00040994
internal void Complete(HttpListenerContext context)
{
this.Complete(context, false);
}
// Token: 0x060014C8 RID: 5320 RVA: 0x000427A0 File Offset: 0x000409A0
internal void Complete(HttpListenerContext context, bool synch)
{
if (this.forward != null)
{
this.forward.Complete(context, synch);
return;
}
this.synch = synch;
this.context = context;
object obj = this.locker;
lock (obj)
{
AuthenticationSchemes authenticationSchemes = context.Listener.SelectAuthenticationScheme(context);
if ((authenticationSchemes == AuthenticationSchemes.Basic || context.Listener.AuthenticationSchemes == AuthenticationSchemes.Negotiate) && context.Request.Headers["Authorization"] == null)
{
context.Response.StatusCode = 401;
context.Response.Headers["WWW-Authenticate"] = string.Concat(new object[]
{
authenticationSchemes,
" realm=\"",
context.Listener.Realm,
"\""
});
context.Response.OutputStream.Close();
IAsyncResult asyncResult = context.Listener.BeginGetContext(this.cb, this.state);
this.forward = (ListenerAsyncResult)asyncResult;
object obj2 = this.forward.locker;
lock (obj2)
{
if (this.handle != null)
{
this.forward.handle = this.handle;
}
}
ListenerAsyncResult listenerAsyncResult = this.forward;
int num = 0;
while (listenerAsyncResult.forward != null)
{
if (num > 20)
{
this.Complete("Too many authentication errors");
}
listenerAsyncResult = listenerAsyncResult.forward;
num++;
}
}
else
{
this.completed = true;
if (this.handle != null)
{
this.handle.Set();
}
if (this.cb != null)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(ListenerAsyncResult.InvokeCallback), this);
}
}
}
}
// Token: 0x060014C9 RID: 5321 RVA: 0x000429A8 File Offset: 0x00040BA8
internal HttpListenerContext GetContext()
{
if (this.forward != null)
{
return this.forward.GetContext();
}
if (this.exception != null)
{
throw this.exception;
}
return this.context;
}
// Token: 0x170006C9 RID: 1737
// (get) Token: 0x060014CA RID: 5322 RVA: 0x000429DC File Offset: 0x00040BDC
public object AsyncState
{
get
{
if (this.forward != null)
{
return this.forward.AsyncState;
}
return this.state;
}
}
// Token: 0x170006CA RID: 1738
// (get) Token: 0x060014CB RID: 5323 RVA: 0x000429FC File Offset: 0x00040BFC
public WaitHandle AsyncWaitHandle
{
get
{
if (this.forward != null)
{
return this.forward.AsyncWaitHandle;
}
object obj = this.locker;
lock (obj)
{
if (this.handle == null)
{
this.handle = new ManualResetEvent(this.completed);
}
}
return this.handle;
}
}
// Token: 0x170006CB RID: 1739
// (get) Token: 0x060014CC RID: 5324 RVA: 0x00042A78 File Offset: 0x00040C78
public bool CompletedSynchronously
{
get
{
if (this.forward != null)
{
return this.forward.CompletedSynchronously;
}
return this.synch;
}
}
// Token: 0x170006CC RID: 1740
// (get) Token: 0x060014CD RID: 5325 RVA: 0x00042A98 File Offset: 0x00040C98
public bool IsCompleted
{
get
{
if (this.forward != null)
{
return this.forward.IsCompleted;
}
object obj = this.locker;
bool flag;
lock (obj)
{
flag = this.completed;
}
return flag;
}
}
// Token: 0x04001181 RID: 4481
private ManualResetEvent handle;
// Token: 0x04001182 RID: 4482
private bool synch;
// Token: 0x04001183 RID: 4483
private bool completed;
// Token: 0x04001184 RID: 4484
private AsyncCallback cb;
// Token: 0x04001185 RID: 4485
private object state;
// Token: 0x04001186 RID: 4486
private Exception exception;
// Token: 0x04001187 RID: 4487
private HttpListenerContext context;
// Token: 0x04001188 RID: 4488
private object locker = new object();
// Token: 0x04001189 RID: 4489
private ListenerAsyncResult forward;
}
}
+202
View File
@@ -0,0 +1,202 @@
using System;
namespace System.Net
{
// Token: 0x02000248 RID: 584
internal sealed class ListenerPrefix
{
// Token: 0x060014CE RID: 5326 RVA: 0x00042B00 File Offset: 0x00040D00
public ListenerPrefix(string prefix)
{
this.original = prefix;
this.Parse(prefix);
}
// Token: 0x060014CF RID: 5327 RVA: 0x00042B18 File Offset: 0x00040D18
public override string ToString()
{
return this.original;
}
// Token: 0x170006CD RID: 1741
// (get) Token: 0x060014D0 RID: 5328 RVA: 0x00042B20 File Offset: 0x00040D20
// (set) Token: 0x060014D1 RID: 5329 RVA: 0x00042B28 File Offset: 0x00040D28
public IPAddress[] Addresses
{
get
{
return this.addresses;
}
set
{
this.addresses = value;
}
}
// Token: 0x170006CE RID: 1742
// (get) Token: 0x060014D2 RID: 5330 RVA: 0x00042B34 File Offset: 0x00040D34
public bool Secure
{
get
{
return this.secure;
}
}
// Token: 0x170006CF RID: 1743
// (get) Token: 0x060014D3 RID: 5331 RVA: 0x00042B3C File Offset: 0x00040D3C
public string Host
{
get
{
return this.host;
}
}
// Token: 0x170006D0 RID: 1744
// (get) Token: 0x060014D4 RID: 5332 RVA: 0x00042B44 File Offset: 0x00040D44
public int Port
{
get
{
return (int)this.port;
}
}
// Token: 0x170006D1 RID: 1745
// (get) Token: 0x060014D5 RID: 5333 RVA: 0x00042B4C File Offset: 0x00040D4C
public string Path
{
get
{
return this.path;
}
}
// Token: 0x060014D6 RID: 5334 RVA: 0x00042B54 File Offset: 0x00040D54
public override bool Equals(object o)
{
ListenerPrefix listenerPrefix = o as ListenerPrefix;
return listenerPrefix != null && this.original == listenerPrefix.original;
}
// Token: 0x060014D7 RID: 5335 RVA: 0x00042B84 File Offset: 0x00040D84
public override int GetHashCode()
{
return this.original.GetHashCode();
}
// Token: 0x060014D8 RID: 5336 RVA: 0x00042B94 File Offset: 0x00040D94
private void Parse(string uri)
{
int num = ((!uri.StartsWith("http://")) ? (-1) : 80);
if (num == -1)
{
int num2 = ((!uri.StartsWith("https://")) ? (-1) : 443);
this.secure = true;
}
int length = uri.Length;
int num3 = uri.IndexOf(':') + 3;
if (num3 >= length)
{
throw new ArgumentException("No host specified.");
}
int num4 = uri.IndexOf(':', num3, length - num3);
if (num4 > 0)
{
this.host = uri.Substring(num3, num4 - num3);
int num5 = uri.IndexOf('/', num4, length - num4);
this.port = (ushort)int.Parse(uri.Substring(num4 + 1, num5 - num4 - 1));
this.path = uri.Substring(num5);
}
else
{
int num5 = uri.IndexOf('/', num3, length - num3);
this.host = uri.Substring(num3, num5 - num3);
this.path = uri.Substring(num5);
}
}
// Token: 0x060014D9 RID: 5337 RVA: 0x00042C98 File Offset: 0x00040E98
public static void CheckUri(string uri)
{
if (uri == null)
{
throw new ArgumentNullException("uriPrefix");
}
int num = ((!uri.StartsWith("http://")) ? (-1) : 80);
if (num == -1)
{
num = ((!uri.StartsWith("https://")) ? (-1) : 443);
}
if (num == -1)
{
throw new ArgumentException("Only 'http' and 'https' schemes are supported.");
}
int length = uri.Length;
int num2 = uri.IndexOf(':') + 3;
if (num2 >= length)
{
throw new ArgumentException("No host specified.");
}
int num3 = uri.IndexOf(':', num2, length - num2);
if (num2 == num3)
{
throw new ArgumentException("No host specified.");
}
if (num3 > 0)
{
int num4 = uri.IndexOf('/', num3, length - num3);
if (num4 == -1)
{
throw new ArgumentException("No path specified.");
}
try
{
int num5 = int.Parse(uri.Substring(num3 + 1, num4 - num3 - 1));
if (num5 <= 0 || num5 >= 65536)
{
throw new Exception();
}
}
catch
{
throw new ArgumentException("Invalid port.");
}
}
else
{
int num4 = uri.IndexOf('/', num2, length - num2);
if (num4 == -1)
{
throw new ArgumentException("No path specified.");
}
}
if (uri[uri.Length - 1] != '/')
{
throw new ArgumentException("The prefix must end with '/'");
}
}
// Token: 0x0400118A RID: 4490
private string original;
// Token: 0x0400118B RID: 4491
private string host;
// Token: 0x0400118C RID: 4492
private ushort port;
// Token: 0x0400118D RID: 4493
private string path;
// Token: 0x0400118E RID: 4494
private bool secure;
// Token: 0x0400118F RID: 4495
private IPAddress[] addresses;
// Token: 0x04001190 RID: 4496
public HttpListener Listener;
}
}
+224
View File
@@ -0,0 +1,224 @@
using System;
using System.IO;
using System.Net.Mime;
using System.Text;
namespace System.Net.Mail
{
/// <summary>Represents the format to view an email message.</summary>
// Token: 0x02000135 RID: 309
public class AlternateView : AttachmentBase
{
/// <summary>Initializes a new instance of <see cref="T:System.Net.Mail.AlternateView" /> with the specified file name.</summary>
/// <param name="fileName">The name of the file that contains the content for this alternate view.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="fileName" /> is null.</exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission.</exception>
/// <exception cref="T:System.IO.IOException">An I/O error occurred, such as a disk error.</exception>
/// <exception cref="T:System.UnauthorizedAccessException">The access requested is not permitted by the operating system for the specified file handle, such as when access is Write or ReadWrite and the file handle is set for read-only access.</exception>
// Token: 0x06000A82 RID: 2690 RVA: 0x0001DA6C File Offset: 0x0001BC6C
public AlternateView(string fileName)
: base(fileName)
{
if (fileName == null)
{
throw new ArgumentNullException();
}
}
/// <summary>Initializes a new instance of <see cref="T:System.Net.Mail.AlternateView" /> with the specified file name and content type.</summary>
/// <param name="fileName">The name of the file that contains the content for this alternate view.</param>
/// <param name="contentType">The type of the content.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="fileName" /> is null.</exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="contentType" /> is not a valid value.</exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission.</exception>
/// <exception cref="T:System.IO.IOException">An I/O error occurred, such as a disk error.</exception>
/// <exception cref="T:System.UnauthorizedAccessException">The access requested is not permitted by the operating system for the specified file handle, such as when access is Write or ReadWrite and the file handle is set for read-only access.</exception>
// Token: 0x06000A83 RID: 2691 RVA: 0x0001DA8C File Offset: 0x0001BC8C
public AlternateView(string fileName, global::System.Net.Mime.ContentType contentType)
: base(fileName, contentType)
{
if (fileName == null)
{
throw new ArgumentNullException();
}
}
/// <summary>Initializes a new instance of <see cref="T:System.Net.Mail.AlternateView" /> with the specified file name and media type.</summary>
/// <param name="fileName">The name of the file that contains the content for this alternate view.</param>
/// <param name="mediaType">The MIME media type of the content.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="fileName" /> is null.</exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="mediaType" /> is not a valid value.</exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission.</exception>
/// <exception cref="T:System.IO.IOException">An I/O error occurred, such as a disk error.</exception>
/// <exception cref="T:System.UnauthorizedAccessException">The access requested is not permitted by the operating system for the specified file handle, such as when access is Write or ReadWrite and the file handle is set for read-only access.</exception>
// Token: 0x06000A84 RID: 2692 RVA: 0x0001DAB0 File Offset: 0x0001BCB0
public AlternateView(string fileName, string mediaType)
: base(fileName, mediaType)
{
if (fileName == null)
{
throw new ArgumentNullException();
}
}
/// <summary>Initializes a new instance of <see cref="T:System.Net.Mail.AlternateView" /> with the specified <see cref="T:System.IO.Stream" />.</summary>
/// <param name="contentStream">A stream that contains the content for this view.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="contentStream" /> is null.</exception>
// Token: 0x06000A85 RID: 2693 RVA: 0x0001DAD4 File Offset: 0x0001BCD4
public AlternateView(Stream contentStream)
: base(contentStream)
{
}
/// <summary>Initializes a new instance of <see cref="T:System.Net.Mail.AlternateView" /> with the specified <see cref="T:System.IO.Stream" /> and media type.</summary>
/// <param name="contentStream">A stream that contains the content for this attachment.</param>
/// <param name="mediaType">The MIME media type of the content.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="contentStream" /> is null.</exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="mediaType" /> is not a valid value.</exception>
// Token: 0x06000A86 RID: 2694 RVA: 0x0001DAE8 File Offset: 0x0001BCE8
public AlternateView(Stream contentStream, string mediaType)
: base(contentStream, mediaType)
{
}
/// <summary>Initializes a new instance of <see cref="T:System.Net.Mail.AlternateView" /> with the specified <see cref="T:System.IO.Stream" /> and <see cref="T:System.Net.Mime.ContentType" />.</summary>
/// <param name="contentStream">A stream that contains the content for this attachment.</param>
/// <param name="contentType">The type of the content.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="contentStream" /> is null.</exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="contentType" /> is not a valid value.</exception>
// Token: 0x06000A87 RID: 2695 RVA: 0x0001DB00 File Offset: 0x0001BD00
public AlternateView(Stream contentStream, global::System.Net.Mime.ContentType contentType)
: base(contentStream, contentType)
{
}
/// <summary>Gets or sets the Base URI to use for resolving relative URIs in the <see cref="T:System.Net.Mail.AlternateView" />.</summary>
/// <returns>A <see cref="T:System.Uri" />.</returns>
// Token: 0x170002AB RID: 683
// (get) Token: 0x06000A88 RID: 2696 RVA: 0x0001DB18 File Offset: 0x0001BD18
// (set) Token: 0x06000A89 RID: 2697 RVA: 0x0001DB20 File Offset: 0x0001BD20
public global::System.Uri BaseUri
{
get
{
return this.baseUri;
}
set
{
this.baseUri = value;
}
}
/// <summary>Gets the set of embedded resources referred to by this attachment.</summary>
/// <returns>A <see cref="T:System.Net.Mail.LinkedResourceCollection" /> object that stores the collection of linked resources to be sent as part of an e-mail message.</returns>
// Token: 0x170002AC RID: 684
// (get) Token: 0x06000A8A RID: 2698 RVA: 0x0001DB2C File Offset: 0x0001BD2C
public LinkedResourceCollection LinkedResources
{
get
{
return this.linkedResources;
}
}
/// <summary>Creates a <see cref="T:System.Net.Mail.AlternateView" /> of an email message using the content specified in a <see cref="System.String" />.</summary>
/// <returns>An <see cref="T:System.Net.Mail.AlternateView" /> object that represents an alternate view of an email message.</returns>
/// <param name="content">The <see cref="T:System.String" /> that contains the content of the email message.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="content" /> is null.</exception>
// Token: 0x06000A8B RID: 2699 RVA: 0x0001DB34 File Offset: 0x0001BD34
public static AlternateView CreateAlternateViewFromString(string content)
{
if (content == null)
{
throw new ArgumentNullException();
}
MemoryStream memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(content));
return new AlternateView(memoryStream)
{
TransferEncoding = global::System.Net.Mime.TransferEncoding.QuotedPrintable
};
}
/// <summary>Creates an <see cref="T:System.Net.Mail.AlternateView" /> of an email message using the content specified in a <see cref="System.String" /> and the specified MIME media type of the content.</summary>
/// <returns>An <see cref="T:System.Net.Mail.AlternateView" /> object that represents an alternate view of an email message.</returns>
/// <param name="content">A <see cref="T:System.String" /> that contains the content for this attachment.</param>
/// <param name="contentType">A <see cref="T:System.Net.Mime.ContentType" /> that describes the data in <paramref name="string" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="content" /> is null.</exception>
// Token: 0x06000A8C RID: 2700 RVA: 0x0001DB70 File Offset: 0x0001BD70
public static AlternateView CreateAlternateViewFromString(string content, global::System.Net.Mime.ContentType contentType)
{
if (content == null)
{
throw new ArgumentNullException("content");
}
Encoding encoding = ((contentType.CharSet == null) ? Encoding.UTF8 : Encoding.GetEncoding(contentType.CharSet));
MemoryStream memoryStream = new MemoryStream(encoding.GetBytes(content));
return new AlternateView(memoryStream, contentType)
{
TransferEncoding = global::System.Net.Mime.TransferEncoding.QuotedPrintable
};
}
/// <summary>Creates an <see cref="T:System.Net.Mail.AlternateView" /> of an email message using the content specified in a <see cref="System.String" />, the specified text encoding, and MIME media type of the content.</summary>
/// <returns>An <see cref="T:System.Net.Mail.AlternateView" /> object that represents an alternate view of an email message.</returns>
/// <param name="content">A <see cref="T:System.String" /> that contains the content for this attachment.</param>
/// <param name="contentEncoding">An <see cref="T:System.Text.Encoding" />. This value can be null.</param>
/// <param name="mediaType">The MIME media type of the content.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="content" /> is null.</exception>
// Token: 0x06000A8D RID: 2701 RVA: 0x0001DBCC File Offset: 0x0001BDCC
public static AlternateView CreateAlternateViewFromString(string content, Encoding encoding, string mediaType)
{
if (content == null)
{
throw new ArgumentNullException("content");
}
if (encoding == null)
{
encoding = Encoding.UTF8;
}
MemoryStream memoryStream = new MemoryStream(encoding.GetBytes(content));
return new AlternateView(memoryStream, new global::System.Net.Mime.ContentType
{
MediaType = mediaType,
CharSet = encoding.HeaderName
})
{
TransferEncoding = global::System.Net.Mime.TransferEncoding.QuotedPrintable
};
}
/// <summary>Releases the unmanaged resources used by the <see cref="T:System.Net.Mail.AlternateView" /> and optionally releases the managed resources. </summary>
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources. </param>
// Token: 0x06000A8E RID: 2702 RVA: 0x0001DC30 File Offset: 0x0001BE30
protected override void Dispose(bool disposing)
{
if (disposing)
{
foreach (LinkedResource linkedResource in this.linkedResources)
{
linkedResource.Dispose();
}
}
base.Dispose(disposing);
}
// Token: 0x04000AF7 RID: 2807
private global::System.Uri baseUri;
// Token: 0x04000AF8 RID: 2808
private LinkedResourceCollection linkedResources = new LinkedResourceCollection();
}
}
@@ -0,0 +1,45 @@
using System;
using System.Collections.ObjectModel;
namespace System.Net.Mail
{
/// <summary>Represents a collection of <see cref="T:System.Net.Mail.AlternateView" /> objects.</summary>
// Token: 0x02000136 RID: 310
public sealed class AlternateViewCollection : Collection<AlternateView>, IDisposable
{
// Token: 0x06000A8F RID: 2703 RVA: 0x0001DCA0 File Offset: 0x0001BEA0
internal AlternateViewCollection()
{
}
/// <summary>Releases all resources used by the <see cref="T:System.Net.Mail.AlternateViewCollection" />.</summary>
// Token: 0x06000A90 RID: 2704 RVA: 0x0001DCA8 File Offset: 0x0001BEA8
public void Dispose()
{
}
// Token: 0x06000A91 RID: 2705 RVA: 0x0001DCAC File Offset: 0x0001BEAC
protected override void ClearItems()
{
base.ClearItems();
}
// Token: 0x06000A92 RID: 2706 RVA: 0x0001DCB4 File Offset: 0x0001BEB4
protected override void InsertItem(int index, AlternateView item)
{
base.InsertItem(index, item);
}
// Token: 0x06000A93 RID: 2707 RVA: 0x0001DCC0 File Offset: 0x0001BEC0
protected override void RemoveItem(int index)
{
base.RemoveItem(index);
}
// Token: 0x06000A94 RID: 2708 RVA: 0x0001DCCC File Offset: 0x0001BECC
protected override void SetItem(int index, AlternateView item)
{
base.SetItem(index, item);
}
}
}
+228
View File
@@ -0,0 +1,228 @@
using System;
using System.IO;
using System.Net.Mime;
using System.Text;
namespace System.Net.Mail
{
/// <summary>Represents an attachment to an e-mail.</summary>
// Token: 0x02000137 RID: 311
public class Attachment : AttachmentBase
{
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.Attachment" /> class with the specified content string. </summary>
/// <param name="fileName">A <see cref="T:System.String" /> that contains a file path to use to create this attachment.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="fileName" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="fileName" /> is empty.</exception>
// Token: 0x06000A95 RID: 2709 RVA: 0x0001DCD8 File Offset: 0x0001BED8
public Attachment(string fileName)
: base(fileName)
{
this.InitName(fileName);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.Attachment" /> class with the specified content string and MIME type information. </summary>
/// <param name="fileName">A <see cref="T:System.String" /> that contains the content for this attachment.</param>
/// <param name="mediaType">A <see cref="T:System.String" /> that contains the MIME Content-Header information for this attachment. This value can be null.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="fileName" /> is null.</exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="mediaType" /> is not in the correct format.</exception>
// Token: 0x06000A96 RID: 2710 RVA: 0x0001DCF4 File Offset: 0x0001BEF4
public Attachment(string fileName, string mediaType)
: base(fileName, mediaType)
{
this.InitName(fileName);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.Attachment" /> class with the specified content string and <see cref="T:System.Net.Mime.ContentType" />.</summary>
/// <param name="fileName">A <see cref="T:System.String" /> that contains a file path to use to create this attachment.</param>
/// <param name="contentType">A <see cref="T:System.Net.Mime.ContentType" /> that describes the data in <paramref name="string" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="fileName" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="mediaType" /> is not in the correct format.</exception>
// Token: 0x06000A97 RID: 2711 RVA: 0x0001DD10 File Offset: 0x0001BF10
public Attachment(string fileName, global::System.Net.Mime.ContentType contentType)
: base(fileName, contentType)
{
this.InitName(fileName);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.Attachment" /> class with the specified stream and content type. </summary>
/// <param name="contentStream">A readable <see cref="T:System.IO.Stream" /> that contains the content for this attachment.</param>
/// <param name="contentType">A <see cref="T:System.Net.Mime.ContentType" /> that describes the data in <paramref name="stream" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="contentType" /> is null.-or-<paramref name="contentStream" /> is null.</exception>
// Token: 0x06000A98 RID: 2712 RVA: 0x0001DD2C File Offset: 0x0001BF2C
public Attachment(Stream contentStream, global::System.Net.Mime.ContentType contentType)
: base(contentStream, contentType)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.Attachment" /> class with the specified stream and name.</summary>
/// <param name="contentStream">A readable <see cref="T:System.IO.Stream" /> that contains the content for this attachment.</param>
/// <param name="name">A <see cref="T:System.String" /> that contains the value for the <see cref="P:System.Net.Mime.ContentType.Name" /> property of the <see cref="T:System.Net.Mime.ContentType" /> associated with this attachment. This value can be null.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="contentStream" /> is null.</exception>
// Token: 0x06000A99 RID: 2713 RVA: 0x0001DD44 File Offset: 0x0001BF44
public Attachment(Stream contentStream, string name)
: base(contentStream)
{
this.Name = name;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.Attachment" /> class with the specified stream, name, and MIME type information. </summary>
/// <param name="contentStream">A readable <see cref="T:System.IO.Stream" /> that contains the content for this attachment.</param>
/// <param name="name">A <see cref="T:System.String" /> that contains the value for the <see cref="P:System.Net.Mime.ContentType.Name" /> property of the <see cref="T:System.Net.Mime.ContentType" /> associated with this attachment. This value can be null.</param>
/// <param name="mediaType">A <see cref="T:System.String" /> that contains the MIME Content-Header information for this attachment. This value can be null.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="stream" /> is null.</exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="mediaType" /> is not in the correct format.</exception>
// Token: 0x06000A9A RID: 2714 RVA: 0x0001DD60 File Offset: 0x0001BF60
public Attachment(Stream contentStream, string name, string mediaType)
: base(contentStream, mediaType)
{
this.Name = name;
}
/// <summary>Gets the MIME content disposition for this attachment.</summary>
/// <returns>A <see cref="T:System.Net.Mime.ContentDisposition" /> that provides the presentation information for this attachment. </returns>
// Token: 0x170002AD RID: 685
// (get) Token: 0x06000A9B RID: 2715 RVA: 0x0001DD7C File Offset: 0x0001BF7C
public global::System.Net.Mime.ContentDisposition ContentDisposition
{
get
{
return this.contentDisposition;
}
}
/// <summary>Gets or sets the MIME content type name value in the content type associated with this attachment.</summary>
/// <returns>A <see cref="T:System.String" /> that contains the value for the content type <paramref name="name" /> represented by the <see cref="P:System.Net.Mime.ContentType.Name" /> property.</returns>
/// <exception cref="T:System.ArgumentNullException">The value specified for a set operation is null.</exception>
/// <exception cref="T:System.ArgumentException">The value specified for a set operation is <see cref="F:System.String.Empty" /> ("").</exception>
// Token: 0x170002AE RID: 686
// (get) Token: 0x06000A9C RID: 2716 RVA: 0x0001DD84 File Offset: 0x0001BF84
// (set) Token: 0x06000A9D RID: 2717 RVA: 0x0001DD94 File Offset: 0x0001BF94
public string Name
{
get
{
return base.ContentType.Name;
}
set
{
base.ContentType.Name = value;
}
}
/// <summary>Specifies the encoding for the <see cref="T:System.Net.Mail.Attachment" /><see cref="P:System.Net.Mail.Attachment.Name" />.</summary>
/// <returns>An <see cref="T:System.Text.Encoding" /> value that specifies the type of name encoding. The default value is determined from the name of the attachment.</returns>
// Token: 0x170002AF RID: 687
// (get) Token: 0x06000A9E RID: 2718 RVA: 0x0001DDA4 File Offset: 0x0001BFA4
// (set) Token: 0x06000A9F RID: 2719 RVA: 0x0001DDAC File Offset: 0x0001BFAC
public Encoding NameEncoding
{
get
{
return this.nameEncoding;
}
set
{
this.nameEncoding = value;
}
}
/// <summary>Creates a mail attachment using the content from the specified string, and the specified <see cref="T:System.Net.Mime.ContentType" />.</summary>
/// <returns>An object of type <see cref="T:System.Net.Mail.Attachment" />.</returns>
/// <param name="content">A <see cref="T:System.String" /> that contains the content for this attachment.</param>
/// <param name="contentType">A <see cref="T:System.Net.Mime.ContentType" /> object that represents the Multipurpose Internet Mail Exchange (MIME) protocol Content-Type header to be used.</param>
// Token: 0x06000AA0 RID: 2720 RVA: 0x0001DDB8 File Offset: 0x0001BFB8
public static Attachment CreateAttachmentFromString(string content, global::System.Net.Mime.ContentType contentType)
{
if (content == null)
{
throw new ArgumentNullException("content");
}
MemoryStream memoryStream = new MemoryStream();
StreamWriter streamWriter = new StreamWriter(memoryStream);
streamWriter.Write(content);
streamWriter.Flush();
memoryStream.Position = 0L;
return new Attachment(memoryStream, contentType)
{
TransferEncoding = global::System.Net.Mime.TransferEncoding.QuotedPrintable
};
}
/// <summary>Creates a mail attachment using the content from the specified string, and the specified MIME content type name.</summary>
/// <returns>An object of type <see cref="T:System.Net.Mail.Attachment" />.</returns>
/// <param name="content">A <see cref="T:System.String" /> that contains the content for this attachment.</param>
/// <param name="name">The MIME content type name value in the content type associated with this attachment.</param>
// Token: 0x06000AA1 RID: 2721 RVA: 0x0001DE08 File Offset: 0x0001C008
public static Attachment CreateAttachmentFromString(string content, string name)
{
if (content == null)
{
throw new ArgumentNullException("content");
}
MemoryStream memoryStream = new MemoryStream();
StreamWriter streamWriter = new StreamWriter(memoryStream);
streamWriter.Write(content);
streamWriter.Flush();
memoryStream.Position = 0L;
return new Attachment(memoryStream, new global::System.Net.Mime.ContentType("text/plain"))
{
TransferEncoding = global::System.Net.Mime.TransferEncoding.QuotedPrintable,
Name = name
};
}
/// <summary>Creates a mail attachment using the content from the specified string, the specified MIME content type name, character encoding, and MIME header information for the attachment.</summary>
/// <returns>An object of type <see cref="T:System.Net.Mail.Attachment" />.</returns>
/// <param name="content">A <see cref="T:System.String" /> that contains the content for this attachment.</param>
/// <param name="name">The MIME content type name value in the content type associated with this attachment.</param>
/// <param name="contentEncoding">An <see cref="T:System.Text.Encoding" />. This value can be null.</param>
/// <param name="mediaType">A <see cref="T:System.String" /> that contains the MIME Content-Header information for this attachment. This value can be null.</param>
// Token: 0x06000AA2 RID: 2722 RVA: 0x0001DE68 File Offset: 0x0001C068
public static Attachment CreateAttachmentFromString(string content, string name, Encoding contentEncoding, string mediaType)
{
if (content == null)
{
throw new ArgumentNullException("content");
}
MemoryStream memoryStream = new MemoryStream();
StreamWriter streamWriter = new StreamWriter(memoryStream, contentEncoding);
streamWriter.Write(content);
streamWriter.Flush();
memoryStream.Position = 0L;
return new Attachment(memoryStream, name, mediaType)
{
TransferEncoding = global::System.Net.Mime.ContentType.GuessTransferEncoding(contentEncoding),
ContentType =
{
CharSet = streamWriter.Encoding.BodyName
}
};
}
// Token: 0x06000AA3 RID: 2723 RVA: 0x0001DED8 File Offset: 0x0001C0D8
private void InitName(string fileName)
{
if (fileName == null)
{
throw new ArgumentNullException("fileName");
}
this.Name = Path.GetFileName(fileName);
}
// Token: 0x04000AF9 RID: 2809
private global::System.Net.Mime.ContentDisposition contentDisposition = new global::System.Net.Mime.ContentDisposition();
// Token: 0x04000AFA RID: 2810
private Encoding nameEncoding;
}
}
+673
View File
@@ -0,0 +1,673 @@
using System;
using System.Collections;
using System.IO;
using System.Net.Mime;
namespace System.Net.Mail
{
/// <summary>Base class that represents an email attachment. Classes <see cref="T:System.Net.Mail.Attachment" />, <see cref="T:System.Net.Mail.AlternateView" />, and <see cref="T:System.Net.Mail.LinkedResource" /> derive from this class.</summary>
// Token: 0x02000138 RID: 312
public abstract class AttachmentBase : IDisposable
{
/// <summary>Instantiates an <see cref="T:System.Net.Mail.AttachmentBase" /> with the specified <see cref="T:System.IO.Stream" />.</summary>
/// <param name="contentStream">A stream containing the content for this attachment.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="contentStream" /> is null.</exception>
// Token: 0x06000AA4 RID: 2724 RVA: 0x0001DEF8 File Offset: 0x0001C0F8
protected AttachmentBase(Stream contentStream)
{
if (contentStream == null)
{
throw new ArgumentNullException();
}
this.contentStream = contentStream;
this.contentType.MediaType = "application/octet-stream";
this.contentType.CharSet = null;
}
/// <summary>Instantiates an <see cref="T:System.Net.Mail.AttachmentBase" /> with the specified <see cref="T:System.IO.Stream" /> and <see cref="T:System.Net.Mime.ContentType" />.</summary>
/// <param name="contentStream">A stream containing the content for this attachment.</param>
/// <param name="contentType">The type of the content.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="contentStream" /> is null.</exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="contentType" /> is not a valid value.</exception>
// Token: 0x06000AA5 RID: 2725 RVA: 0x0001DF4C File Offset: 0x0001C14C
protected AttachmentBase(Stream contentStream, global::System.Net.Mime.ContentType contentType)
{
if (contentStream == null || contentType == null)
{
throw new ArgumentNullException();
}
this.contentStream = contentStream;
this.contentType = contentType;
}
/// <summary>Instantiates an <see cref="T:System.Net.Mail.AttachmentBase" /> with the specified <see cref="T:System.IO.Stream" /> and media type.</summary>
/// <param name="contentStream">A stream containing the content for this attachment.</param>
/// <param name="mediaType">The MIME media type of the content.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="contentStream" /> is null.</exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="mediaType" /> is not a valid value.</exception>
// Token: 0x06000AA6 RID: 2726 RVA: 0x0001DF94 File Offset: 0x0001C194
protected AttachmentBase(Stream contentStream, string mediaType)
{
if (contentStream == null)
{
throw new ArgumentNullException();
}
this.contentStream = contentStream;
this.contentType.MediaType = mediaType;
}
/// <summary>Instantiates an <see cref="T:System.Net.Mail.AttachmentBase" /> with the specified file name.</summary>
/// <param name="fileName">The file name holding the content for this attachment.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="fileName" /> is null.</exception>
// Token: 0x06000AA7 RID: 2727 RVA: 0x0001DFD0 File Offset: 0x0001C1D0
protected AttachmentBase(string fileName)
{
if (fileName == null)
{
throw new ArgumentNullException();
}
this.contentStream = File.OpenRead(fileName);
this.contentType = new global::System.Net.Mime.ContentType(AttachmentBase.MimeTypes.GetMimeType(fileName));
}
/// <summary>Instantiates an <see cref="T:System.Net.Mail.AttachmentBase" /> with the specified file name and content type.</summary>
/// <param name="fileName">The file name holding the content for this attachment.</param>
/// <param name="contentType">The type of the content.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="fileName" /> is null.</exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="contentType" /> is not a valid value.</exception>
// Token: 0x06000AA8 RID: 2728 RVA: 0x0001E020 File Offset: 0x0001C220
protected AttachmentBase(string fileName, global::System.Net.Mime.ContentType contentType)
{
if (fileName == null)
{
throw new ArgumentNullException();
}
this.contentStream = File.OpenRead(fileName);
this.contentType = contentType;
}
/// <summary>Instantiates an <see cref="T:System.Net.Mail.AttachmentBase" /> with the specified file name and media type.</summary>
/// <param name="fileName">The file name holding the content for this attachment.</param>
/// <param name="mediaType">The MIME media type of the content.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="fileName" /> is null.</exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="mediaType" /> is not a valid value.</exception>
// Token: 0x06000AA9 RID: 2729 RVA: 0x0001E05C File Offset: 0x0001C25C
protected AttachmentBase(string fileName, string mediaType)
{
if (fileName == null)
{
throw new ArgumentNullException();
}
this.contentStream = File.OpenRead(fileName);
this.contentType.MediaType = mediaType;
}
/// <summary>Gets or sets the MIME content ID for this attachment.</summary>
/// <returns>A <see cref="T:System.String" /> holding the content ID.</returns>
/// <exception cref="T:System.ArgumentNullException">Attempted to set <see cref="P:System.Net.Mail.AttachmentBase.ContentId" /> to null.</exception>
// Token: 0x170002B0 RID: 688
// (get) Token: 0x06000AAA RID: 2730 RVA: 0x0001E0A8 File Offset: 0x0001C2A8
// (set) Token: 0x06000AAB RID: 2731 RVA: 0x0001E0B0 File Offset: 0x0001C2B0
public string ContentId
{
get
{
return this.id;
}
set
{
if (value == null)
{
throw new ArgumentNullException();
}
this.id = value;
}
}
/// <summary>Gets the content stream of this attachment.</summary>
/// <returns>A <see cref="T:System.IO.Stream" />.</returns>
// Token: 0x170002B1 RID: 689
// (get) Token: 0x06000AAC RID: 2732 RVA: 0x0001E0C8 File Offset: 0x0001C2C8
public Stream ContentStream
{
get
{
return this.contentStream;
}
}
/// <summary>Gets the content type of this attachment.</summary>
/// <returns>A <see cref="T:System.Net.Mime.ContentType" />.</returns>
// Token: 0x170002B2 RID: 690
// (get) Token: 0x06000AAD RID: 2733 RVA: 0x0001E0D0 File Offset: 0x0001C2D0
// (set) Token: 0x06000AAE RID: 2734 RVA: 0x0001E0D8 File Offset: 0x0001C2D8
public global::System.Net.Mime.ContentType ContentType
{
get
{
return this.contentType;
}
set
{
this.contentType = value;
}
}
/// <summary>Gets or sets the encoding of this attachment.</summary>
/// <returns>A <see cref="T:System.Net.Mime.TransferEncoding" />.</returns>
// Token: 0x170002B3 RID: 691
// (get) Token: 0x06000AAF RID: 2735 RVA: 0x0001E0E4 File Offset: 0x0001C2E4
// (set) Token: 0x06000AB0 RID: 2736 RVA: 0x0001E0EC File Offset: 0x0001C2EC
public global::System.Net.Mime.TransferEncoding TransferEncoding
{
get
{
return this.transferEncoding;
}
set
{
this.transferEncoding = value;
}
}
/// <summary>Releases the resources used by the <see cref="T:System.Net.Mail.AttachmentBase" />. </summary>
// Token: 0x06000AB1 RID: 2737 RVA: 0x0001E0F8 File Offset: 0x0001C2F8
public void Dispose()
{
this.Dispose(true);
}
/// <summary>Releases the unmanaged resources used by the <see cref="T:System.Net.Mail.AttachmentBase" /> and optionally releases the managed resources. </summary>
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources. </param>
// Token: 0x06000AB2 RID: 2738 RVA: 0x0001E104 File Offset: 0x0001C304
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
this.contentStream.Close();
}
}
// Token: 0x04000AFB RID: 2811
private string id;
// Token: 0x04000AFC RID: 2812
private global::System.Net.Mime.ContentType contentType = new global::System.Net.Mime.ContentType();
// Token: 0x04000AFD RID: 2813
private Stream contentStream;
// Token: 0x04000AFE RID: 2814
private global::System.Net.Mime.TransferEncoding transferEncoding = global::System.Net.Mime.TransferEncoding.Base64;
// Token: 0x02000139 RID: 313
private class MimeTypes
{
// Token: 0x06000AB4 RID: 2740 RVA: 0x0001E120 File Offset: 0x0001C320
static MimeTypes()
{
AttachmentBase.MimeTypes.mimeTypes.Add("3dm", "x-world/x-3dmf");
AttachmentBase.MimeTypes.mimeTypes.Add("3dmf", "x-world/x-3dmf");
AttachmentBase.MimeTypes.mimeTypes.Add("aab", "application/x-authorware-bin");
AttachmentBase.MimeTypes.mimeTypes.Add("aam", "application/x-authorware-map");
AttachmentBase.MimeTypes.mimeTypes.Add("aas", "application/x-authorware-seg");
AttachmentBase.MimeTypes.mimeTypes.Add("abc", "text/vnd.abc");
AttachmentBase.MimeTypes.mimeTypes.Add("acgi", "text/html");
AttachmentBase.MimeTypes.mimeTypes.Add("afl", "video/animaflex");
AttachmentBase.MimeTypes.mimeTypes.Add("ai", "application/postscript");
AttachmentBase.MimeTypes.mimeTypes.Add("aif", "audio/aiff");
AttachmentBase.MimeTypes.mimeTypes.Add("aifc", "audio/aiff");
AttachmentBase.MimeTypes.mimeTypes.Add("aiff", "audio/aiff");
AttachmentBase.MimeTypes.mimeTypes.Add("aim", "application/x-aim");
AttachmentBase.MimeTypes.mimeTypes.Add("aip", "text/x-audiosoft-intra");
AttachmentBase.MimeTypes.mimeTypes.Add("ani", "application/x-navi-animation");
AttachmentBase.MimeTypes.mimeTypes.Add("aos", "application/x-nokia-9000-communicator-add-on-software");
AttachmentBase.MimeTypes.mimeTypes.Add("aps", "application/mime");
AttachmentBase.MimeTypes.mimeTypes.Add("art", "image/x-jg");
AttachmentBase.MimeTypes.mimeTypes.Add("asf", "video/x-ms-asf");
AttachmentBase.MimeTypes.mimeTypes.Add("asm", "text/x-asm");
AttachmentBase.MimeTypes.mimeTypes.Add("asp", "text/asp");
AttachmentBase.MimeTypes.mimeTypes.Add("asx", "application/x-mplayer2");
AttachmentBase.MimeTypes.mimeTypes.Add("au", "audio/x-au");
AttachmentBase.MimeTypes.mimeTypes.Add("avi", "video/avi");
AttachmentBase.MimeTypes.mimeTypes.Add("avs", "video/avs-video");
AttachmentBase.MimeTypes.mimeTypes.Add("bcpio", "application/x-bcpio");
AttachmentBase.MimeTypes.mimeTypes.Add("bm", "image/bmp");
AttachmentBase.MimeTypes.mimeTypes.Add("bmp", "image/bmp");
AttachmentBase.MimeTypes.mimeTypes.Add("boo", "application/book");
AttachmentBase.MimeTypes.mimeTypes.Add("book", "application/book");
AttachmentBase.MimeTypes.mimeTypes.Add("boz", "application/x-bzip2");
AttachmentBase.MimeTypes.mimeTypes.Add("bsh", "application/x-bsh");
AttachmentBase.MimeTypes.mimeTypes.Add("bz", "application/x-bzip");
AttachmentBase.MimeTypes.mimeTypes.Add("bz2", "application/x-bzip2");
AttachmentBase.MimeTypes.mimeTypes.Add("c", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("c++", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("cat", "application/vnd.ms-pki.seccat");
AttachmentBase.MimeTypes.mimeTypes.Add("cc", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("ccad", "application/clariscad");
AttachmentBase.MimeTypes.mimeTypes.Add("cco", "application/x-cocoa");
AttachmentBase.MimeTypes.mimeTypes.Add("cdf", "application/cdf");
AttachmentBase.MimeTypes.mimeTypes.Add("cer", "application/pkix-cert");
AttachmentBase.MimeTypes.mimeTypes.Add("cha", "application/x-chat");
AttachmentBase.MimeTypes.mimeTypes.Add("chat", "application/x-chat");
AttachmentBase.MimeTypes.mimeTypes.Add("class", "application/java");
AttachmentBase.MimeTypes.mimeTypes.Add("conf", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("cpio", "application/x-cpio");
AttachmentBase.MimeTypes.mimeTypes.Add("cpp", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("cpt", "application/x-cpt");
AttachmentBase.MimeTypes.mimeTypes.Add("crl", "application/pkix-crl");
AttachmentBase.MimeTypes.mimeTypes.Add("crt", "application/pkix-cert");
AttachmentBase.MimeTypes.mimeTypes.Add("csh", "application/x-csh");
AttachmentBase.MimeTypes.mimeTypes.Add("css", "text/css");
AttachmentBase.MimeTypes.mimeTypes.Add("cxx", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("dcr", "application/x-director");
AttachmentBase.MimeTypes.mimeTypes.Add("deepv", "application/x-deepv");
AttachmentBase.MimeTypes.mimeTypes.Add("def", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("der", "application/x-x509-ca-cert");
AttachmentBase.MimeTypes.mimeTypes.Add("dif", "video/x-dv");
AttachmentBase.MimeTypes.mimeTypes.Add("dir", "application/x-director");
AttachmentBase.MimeTypes.mimeTypes.Add("dl", "video/dl");
AttachmentBase.MimeTypes.mimeTypes.Add("doc", "application/msword");
AttachmentBase.MimeTypes.mimeTypes.Add("dot", "application/msword");
AttachmentBase.MimeTypes.mimeTypes.Add("dp", "application/commonground");
AttachmentBase.MimeTypes.mimeTypes.Add("drw", "application/drafting");
AttachmentBase.MimeTypes.mimeTypes.Add("dv", "video/x-dv");
AttachmentBase.MimeTypes.mimeTypes.Add("dvi", "application/x-dvi");
AttachmentBase.MimeTypes.mimeTypes.Add("dwf", "drawing/x-dwf (old)");
AttachmentBase.MimeTypes.mimeTypes.Add("dwg", "application/acad");
AttachmentBase.MimeTypes.mimeTypes.Add("dxf", "application/dxf");
AttachmentBase.MimeTypes.mimeTypes.Add("dxr", "application/x-director");
AttachmentBase.MimeTypes.mimeTypes.Add("el", "text/x-script.elisp");
AttachmentBase.MimeTypes.mimeTypes.Add("elc", "application/x-elc");
AttachmentBase.MimeTypes.mimeTypes.Add("eps", "application/postscript");
AttachmentBase.MimeTypes.mimeTypes.Add("es", "application/x-esrehber");
AttachmentBase.MimeTypes.mimeTypes.Add("etx", "text/x-setext");
AttachmentBase.MimeTypes.mimeTypes.Add("evy", "application/envoy");
AttachmentBase.MimeTypes.mimeTypes.Add("f", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("f77", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("f90", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("fdf", "application/vnd.fdf");
AttachmentBase.MimeTypes.mimeTypes.Add("fif", "image/fif");
AttachmentBase.MimeTypes.mimeTypes.Add("fli", "video/fli");
AttachmentBase.MimeTypes.mimeTypes.Add("flo", "image/florian");
AttachmentBase.MimeTypes.mimeTypes.Add("flx", "text/vnd.fmi.flexstor");
AttachmentBase.MimeTypes.mimeTypes.Add("fmf", "video/x-atomic3d-feature");
AttachmentBase.MimeTypes.mimeTypes.Add("for", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("fpx", "image/vnd.fpx");
AttachmentBase.MimeTypes.mimeTypes.Add("frl", "application/freeloader");
AttachmentBase.MimeTypes.mimeTypes.Add("funk", "audio/make");
AttachmentBase.MimeTypes.mimeTypes.Add("g", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("g3", "image/g3fax");
AttachmentBase.MimeTypes.mimeTypes.Add("gif", "image/gif");
AttachmentBase.MimeTypes.mimeTypes.Add("gl", "video/gl");
AttachmentBase.MimeTypes.mimeTypes.Add("gsd", "audio/x-gsm");
AttachmentBase.MimeTypes.mimeTypes.Add("gsm", "audio/x-gsm");
AttachmentBase.MimeTypes.mimeTypes.Add("gsp", "application/x-gsp");
AttachmentBase.MimeTypes.mimeTypes.Add("gss", "application/x-gss");
AttachmentBase.MimeTypes.mimeTypes.Add("gtar", "application/x-gtar");
AttachmentBase.MimeTypes.mimeTypes.Add("gz", "application/x-gzip");
AttachmentBase.MimeTypes.mimeTypes.Add("gzip", "application/x-gzip");
AttachmentBase.MimeTypes.mimeTypes.Add("h", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("hdf", "application/x-hdf");
AttachmentBase.MimeTypes.mimeTypes.Add("help", "application/x-helpfile");
AttachmentBase.MimeTypes.mimeTypes.Add("hgl", "application/vnd.hp-HPGL");
AttachmentBase.MimeTypes.mimeTypes.Add("hh", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("hlb", "text/x-script");
AttachmentBase.MimeTypes.mimeTypes.Add("hlp", "application/x-helpfile");
AttachmentBase.MimeTypes.mimeTypes.Add("hpg", "application/vnd.hp-HPGL");
AttachmentBase.MimeTypes.mimeTypes.Add("hpgl", "application/vnd.hp-HPGL");
AttachmentBase.MimeTypes.mimeTypes.Add("hqx", "application/binhex");
AttachmentBase.MimeTypes.mimeTypes.Add("hta", "application/hta");
AttachmentBase.MimeTypes.mimeTypes.Add("htc", "text/x-component");
AttachmentBase.MimeTypes.mimeTypes.Add("htm", "text/html");
AttachmentBase.MimeTypes.mimeTypes.Add("html", "text/html");
AttachmentBase.MimeTypes.mimeTypes.Add("htmls", "text/html");
AttachmentBase.MimeTypes.mimeTypes.Add("htt", "text/webviewhtml");
AttachmentBase.MimeTypes.mimeTypes.Add("htx", "text/html");
AttachmentBase.MimeTypes.mimeTypes.Add("ice", "x-conference/x-cooltalk");
AttachmentBase.MimeTypes.mimeTypes.Add("ico", "image/x-icon");
AttachmentBase.MimeTypes.mimeTypes.Add("idc", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("ief", "image/ief");
AttachmentBase.MimeTypes.mimeTypes.Add("iefs", "image/ief");
AttachmentBase.MimeTypes.mimeTypes.Add("iges", "application/iges");
AttachmentBase.MimeTypes.mimeTypes.Add("igs", "application/iges");
AttachmentBase.MimeTypes.mimeTypes.Add("ima", "application/x-ima");
AttachmentBase.MimeTypes.mimeTypes.Add("imap", "application/x-httpd-imap");
AttachmentBase.MimeTypes.mimeTypes.Add("inf", "application/inf");
AttachmentBase.MimeTypes.mimeTypes.Add("ins", "application/x-internett-signup");
AttachmentBase.MimeTypes.mimeTypes.Add("ip", "application/x-ip2");
AttachmentBase.MimeTypes.mimeTypes.Add("isu", "video/x-isvideo");
AttachmentBase.MimeTypes.mimeTypes.Add("it", "audio/it");
AttachmentBase.MimeTypes.mimeTypes.Add("iv", "application/x-inventor");
AttachmentBase.MimeTypes.mimeTypes.Add("ivr", "i-world/i-vrml");
AttachmentBase.MimeTypes.mimeTypes.Add("ivy", "application/x-livescreen");
AttachmentBase.MimeTypes.mimeTypes.Add("jam", "audio/x-jam");
AttachmentBase.MimeTypes.mimeTypes.Add("jav", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("java", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("jcm", "application/x-java-commerce");
AttachmentBase.MimeTypes.mimeTypes.Add("jfif", "image/jpeg");
AttachmentBase.MimeTypes.mimeTypes.Add("jfif-tbnl", "image/jpeg");
AttachmentBase.MimeTypes.mimeTypes.Add("jpe", "image/jpeg");
AttachmentBase.MimeTypes.mimeTypes.Add("jpeg", "image/jpeg");
AttachmentBase.MimeTypes.mimeTypes.Add("jpg", "image/jpeg");
AttachmentBase.MimeTypes.mimeTypes.Add("jps", "image/x-jps");
AttachmentBase.MimeTypes.mimeTypes.Add("js", "application/x-javascript");
AttachmentBase.MimeTypes.mimeTypes.Add("jut", "image/jutvision");
AttachmentBase.MimeTypes.mimeTypes.Add("kar", "audio/midi");
AttachmentBase.MimeTypes.mimeTypes.Add("ksh", "text/x-script.ksh");
AttachmentBase.MimeTypes.mimeTypes.Add("la", "audio/nspaudio");
AttachmentBase.MimeTypes.mimeTypes.Add("lam", "audio/x-liveaudio");
AttachmentBase.MimeTypes.mimeTypes.Add("latex", "application/x-latex");
AttachmentBase.MimeTypes.mimeTypes.Add("list", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("lma", "audio/nspaudio");
AttachmentBase.MimeTypes.mimeTypes.Add("log", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("lsp", "application/x-lisp");
AttachmentBase.MimeTypes.mimeTypes.Add("lst", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("lsx", "text/x-la-asf");
AttachmentBase.MimeTypes.mimeTypes.Add("ltx", "application/x-latex");
AttachmentBase.MimeTypes.mimeTypes.Add("m", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("m1v", "video/mpeg");
AttachmentBase.MimeTypes.mimeTypes.Add("m2a", "audio/mpeg");
AttachmentBase.MimeTypes.mimeTypes.Add("m2v", "video/mpeg");
AttachmentBase.MimeTypes.mimeTypes.Add("m3u", "audio/x-mpequrl");
AttachmentBase.MimeTypes.mimeTypes.Add("man", "application/x-troff-man");
AttachmentBase.MimeTypes.mimeTypes.Add("map", "application/x-navimap");
AttachmentBase.MimeTypes.mimeTypes.Add("mar", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("mbd", "application/mbedlet");
AttachmentBase.MimeTypes.mimeTypes.Add("mc$", "application/x-magic-cap-package-1.0");
AttachmentBase.MimeTypes.mimeTypes.Add("mcd", "application/mcad");
AttachmentBase.MimeTypes.mimeTypes.Add("mcf", "image/vasa");
AttachmentBase.MimeTypes.mimeTypes.Add("mcp", "application/netmc");
AttachmentBase.MimeTypes.mimeTypes.Add("me", "application/x-troff-me");
AttachmentBase.MimeTypes.mimeTypes.Add("mht", "message/rfc822");
AttachmentBase.MimeTypes.mimeTypes.Add("mhtml", "message/rfc822");
AttachmentBase.MimeTypes.mimeTypes.Add("mid", "audio/midi");
AttachmentBase.MimeTypes.mimeTypes.Add("midi", "audio/midi");
AttachmentBase.MimeTypes.mimeTypes.Add("mif", "application/x-mif");
AttachmentBase.MimeTypes.mimeTypes.Add("mime", "message/rfc822");
AttachmentBase.MimeTypes.mimeTypes.Add("mjf", "audio/x-vnd.AudioExplosion.MjuiceMediaFile");
AttachmentBase.MimeTypes.mimeTypes.Add("mjpg", "video/x-motion-jpeg");
AttachmentBase.MimeTypes.mimeTypes.Add("mm", "application/base64");
AttachmentBase.MimeTypes.mimeTypes.Add("mme", "application/base64");
AttachmentBase.MimeTypes.mimeTypes.Add("mod", "audio/mod");
AttachmentBase.MimeTypes.mimeTypes.Add("moov", "video/quicktime");
AttachmentBase.MimeTypes.mimeTypes.Add("mov", "video/quicktime");
AttachmentBase.MimeTypes.mimeTypes.Add("movie", "video/x-sgi-movie");
AttachmentBase.MimeTypes.mimeTypes.Add("mp2", "video/mpeg");
AttachmentBase.MimeTypes.mimeTypes.Add("mp3", "audio/mpeg3");
AttachmentBase.MimeTypes.mimeTypes.Add("mpa", "audio/mpeg");
AttachmentBase.MimeTypes.mimeTypes.Add("mpc", "application/x-project");
AttachmentBase.MimeTypes.mimeTypes.Add("mpe", "video/mpeg");
AttachmentBase.MimeTypes.mimeTypes.Add("mpeg", "video/mpeg");
AttachmentBase.MimeTypes.mimeTypes.Add("mpg", "video/mpeg");
AttachmentBase.MimeTypes.mimeTypes.Add("mpga", "audio/mpeg");
AttachmentBase.MimeTypes.mimeTypes.Add("mpp", "application/vnd.ms-project");
AttachmentBase.MimeTypes.mimeTypes.Add("mpt", "application/x-project");
AttachmentBase.MimeTypes.mimeTypes.Add("mpv", "application/x-project");
AttachmentBase.MimeTypes.mimeTypes.Add("mpx", "application/x-project");
AttachmentBase.MimeTypes.mimeTypes.Add("mrc", "application/marc");
AttachmentBase.MimeTypes.mimeTypes.Add("ms", "application/x-troff-ms");
AttachmentBase.MimeTypes.mimeTypes.Add("mv", "video/x-sgi-movie");
AttachmentBase.MimeTypes.mimeTypes.Add("my", "audio/make");
AttachmentBase.MimeTypes.mimeTypes.Add("mzz", "application/x-vnd.AudioExplosion.mzz");
AttachmentBase.MimeTypes.mimeTypes.Add("nap", "image/naplps");
AttachmentBase.MimeTypes.mimeTypes.Add("naplps", "image/naplps");
AttachmentBase.MimeTypes.mimeTypes.Add("nc", "application/x-netcdf");
AttachmentBase.MimeTypes.mimeTypes.Add("ncm", "application/vnd.nokia.configuration-message");
AttachmentBase.MimeTypes.mimeTypes.Add("nif", "image/x-niff");
AttachmentBase.MimeTypes.mimeTypes.Add("niff", "image/x-niff");
AttachmentBase.MimeTypes.mimeTypes.Add("nix", "application/x-mix-transfer");
AttachmentBase.MimeTypes.mimeTypes.Add("nsc", "application/x-conference");
AttachmentBase.MimeTypes.mimeTypes.Add("nvd", "application/x-navidoc");
AttachmentBase.MimeTypes.mimeTypes.Add("oda", "application/oda");
AttachmentBase.MimeTypes.mimeTypes.Add("omc", "application/x-omc");
AttachmentBase.MimeTypes.mimeTypes.Add("omcd", "application/x-omcdatamaker");
AttachmentBase.MimeTypes.mimeTypes.Add("omcr", "application/x-omcregerator");
AttachmentBase.MimeTypes.mimeTypes.Add("p", "text/x-pascal");
AttachmentBase.MimeTypes.mimeTypes.Add("p10", "application/pkcs10");
AttachmentBase.MimeTypes.mimeTypes.Add("p12", "application/pkcs-12");
AttachmentBase.MimeTypes.mimeTypes.Add("p7a", "application/x-pkcs7-signature");
AttachmentBase.MimeTypes.mimeTypes.Add("p7c", "application/pkcs7-mime");
AttachmentBase.MimeTypes.mimeTypes.Add("p7m", "application/pkcs7-mime");
AttachmentBase.MimeTypes.mimeTypes.Add("p7r", "application/x-pkcs7-certreqresp");
AttachmentBase.MimeTypes.mimeTypes.Add("p7s", "application/pkcs7-signature");
AttachmentBase.MimeTypes.mimeTypes.Add("part", "application/pro_eng");
AttachmentBase.MimeTypes.mimeTypes.Add("pas", "text/pascal");
AttachmentBase.MimeTypes.mimeTypes.Add("pbm", "image/x-portable-bitmap");
AttachmentBase.MimeTypes.mimeTypes.Add("pcl", "application/x-pcl");
AttachmentBase.MimeTypes.mimeTypes.Add("pct", "image/x-pict");
AttachmentBase.MimeTypes.mimeTypes.Add("pcx", "image/x-pcx");
AttachmentBase.MimeTypes.mimeTypes.Add("pdb", "chemical/x-pdb");
AttachmentBase.MimeTypes.mimeTypes.Add("pdf", "application/pdf");
AttachmentBase.MimeTypes.mimeTypes.Add("pfunk", "audio/make");
AttachmentBase.MimeTypes.mimeTypes.Add("pgm", "image/x-portable-graymap");
AttachmentBase.MimeTypes.mimeTypes.Add("pic", "image/pict");
AttachmentBase.MimeTypes.mimeTypes.Add("pict", "image/pict");
AttachmentBase.MimeTypes.mimeTypes.Add("pkg", "application/x-newton-compatible-pkg");
AttachmentBase.MimeTypes.mimeTypes.Add("pko", "application/vnd.ms-pki.pko");
AttachmentBase.MimeTypes.mimeTypes.Add("pl", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("plx", "application/x-PiXCLscript");
AttachmentBase.MimeTypes.mimeTypes.Add("pm", "image/x-xpixmap");
AttachmentBase.MimeTypes.mimeTypes.Add("pm4", "application/x-pagemaker");
AttachmentBase.MimeTypes.mimeTypes.Add("pm5", "application/x-pagemaker");
AttachmentBase.MimeTypes.mimeTypes.Add("png", "image/png");
AttachmentBase.MimeTypes.mimeTypes.Add("pnm", "application/x-portable-anymap");
AttachmentBase.MimeTypes.mimeTypes.Add("pot", "application/mspowerpoint");
AttachmentBase.MimeTypes.mimeTypes.Add("pov", "model/x-pov");
AttachmentBase.MimeTypes.mimeTypes.Add("ppa", "application/vnd.ms-powerpoint");
AttachmentBase.MimeTypes.mimeTypes.Add("ppm", "image/x-portable-pixmap");
AttachmentBase.MimeTypes.mimeTypes.Add("pps", "application/mspowerpoint");
AttachmentBase.MimeTypes.mimeTypes.Add("ppt", "application/mspowerpoint");
AttachmentBase.MimeTypes.mimeTypes.Add("ppz", "application/mspowerpoint");
AttachmentBase.MimeTypes.mimeTypes.Add("pre", "application/x-freelance");
AttachmentBase.MimeTypes.mimeTypes.Add("prt", "application/pro_eng");
AttachmentBase.MimeTypes.mimeTypes.Add("ps", "application/postscript");
AttachmentBase.MimeTypes.mimeTypes.Add("pvu", "paleovu/x-pv");
AttachmentBase.MimeTypes.mimeTypes.Add("pwz", "application/vnd.ms-powerpoint");
AttachmentBase.MimeTypes.mimeTypes.Add("py", "text/x-script.phyton");
AttachmentBase.MimeTypes.mimeTypes.Add("pyc", "applicaiton/x-bytecode.python");
AttachmentBase.MimeTypes.mimeTypes.Add("qcp", "audio/vnd.qcelp");
AttachmentBase.MimeTypes.mimeTypes.Add("qd3", "x-world/x-3dmf");
AttachmentBase.MimeTypes.mimeTypes.Add("qd3d", "x-world/x-3dmf");
AttachmentBase.MimeTypes.mimeTypes.Add("qif", "image/x-quicktime");
AttachmentBase.MimeTypes.mimeTypes.Add("qt", "video/quicktime");
AttachmentBase.MimeTypes.mimeTypes.Add("qtc", "video/x-qtc");
AttachmentBase.MimeTypes.mimeTypes.Add("qti", "image/x-quicktime");
AttachmentBase.MimeTypes.mimeTypes.Add("qtif", "image/x-quicktime");
AttachmentBase.MimeTypes.mimeTypes.Add("ra", "audio/x-pn-realaudio");
AttachmentBase.MimeTypes.mimeTypes.Add("ram", "audio/x-pn-realaudio");
AttachmentBase.MimeTypes.mimeTypes.Add("ras", "application/x-cmu-raster");
AttachmentBase.MimeTypes.mimeTypes.Add("rast", "image/cmu-raster");
AttachmentBase.MimeTypes.mimeTypes.Add("rexx", "text/x-script.rexx");
AttachmentBase.MimeTypes.mimeTypes.Add("rf", "image/vnd.rn-realflash");
AttachmentBase.MimeTypes.mimeTypes.Add("rgb", "image/x-rgb");
AttachmentBase.MimeTypes.mimeTypes.Add("rm", "application/vnd.rn-realmedia");
AttachmentBase.MimeTypes.mimeTypes.Add("rmi", "audio/mid");
AttachmentBase.MimeTypes.mimeTypes.Add("rmm", "audio/x-pn-realaudio");
AttachmentBase.MimeTypes.mimeTypes.Add("rmp", "audio/x-pn-realaudio");
AttachmentBase.MimeTypes.mimeTypes.Add("rng", "application/ringing-tones");
AttachmentBase.MimeTypes.mimeTypes.Add("rnx", "application/vnd.rn-realplayer");
AttachmentBase.MimeTypes.mimeTypes.Add("roff", "application/x-troff");
AttachmentBase.MimeTypes.mimeTypes.Add("rp", "image/vnd.rn-realpix");
AttachmentBase.MimeTypes.mimeTypes.Add("rpm", "audio/x-pn-realaudio-plugin");
AttachmentBase.MimeTypes.mimeTypes.Add("rss", "text/xml");
AttachmentBase.MimeTypes.mimeTypes.Add("rt", "text/richtext");
AttachmentBase.MimeTypes.mimeTypes.Add("rtf", "text/richtext");
AttachmentBase.MimeTypes.mimeTypes.Add("rtx", "text/richtext");
AttachmentBase.MimeTypes.mimeTypes.Add("rv", "video/vnd.rn-realvideo");
AttachmentBase.MimeTypes.mimeTypes.Add("s", "text/x-asm");
AttachmentBase.MimeTypes.mimeTypes.Add("s3m", "audio/s3m");
AttachmentBase.MimeTypes.mimeTypes.Add("sbk", "application/x-tbook");
AttachmentBase.MimeTypes.mimeTypes.Add("scm", "application/x-lotusscreencam");
AttachmentBase.MimeTypes.mimeTypes.Add("sdml", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("sdp", "application/sdp");
AttachmentBase.MimeTypes.mimeTypes.Add("sdr", "application/sounder");
AttachmentBase.MimeTypes.mimeTypes.Add("sea", "application/sea");
AttachmentBase.MimeTypes.mimeTypes.Add("set", "application/set");
AttachmentBase.MimeTypes.mimeTypes.Add("sgm", "text/sgml");
AttachmentBase.MimeTypes.mimeTypes.Add("sgml", "text/sgml");
AttachmentBase.MimeTypes.mimeTypes.Add("sh", "text/x-script.sh");
AttachmentBase.MimeTypes.mimeTypes.Add("shar", "application/x-bsh");
AttachmentBase.MimeTypes.mimeTypes.Add("shtml", "text/html");
AttachmentBase.MimeTypes.mimeTypes.Add("sid", "audio/x-psid");
AttachmentBase.MimeTypes.mimeTypes.Add("sit", "application/x-sit");
AttachmentBase.MimeTypes.mimeTypes.Add("skd", "application/x-koan");
AttachmentBase.MimeTypes.mimeTypes.Add("skm", "application/x-koan");
AttachmentBase.MimeTypes.mimeTypes.Add("skp", "application/x-koan");
AttachmentBase.MimeTypes.mimeTypes.Add("skt", "application/x-koan");
AttachmentBase.MimeTypes.mimeTypes.Add("sl", "application/x-seelogo");
AttachmentBase.MimeTypes.mimeTypes.Add("smi", "application/smil");
AttachmentBase.MimeTypes.mimeTypes.Add("smil", "application/smil");
AttachmentBase.MimeTypes.mimeTypes.Add("snd", "audio/basic");
AttachmentBase.MimeTypes.mimeTypes.Add("sol", "application/solids");
AttachmentBase.MimeTypes.mimeTypes.Add("spc", "application/x-pkcs7-certificates");
AttachmentBase.MimeTypes.mimeTypes.Add("spl", "application/futuresplash");
AttachmentBase.MimeTypes.mimeTypes.Add("spr", "application/x-sprite");
AttachmentBase.MimeTypes.mimeTypes.Add("sprite", "application/x-sprite");
AttachmentBase.MimeTypes.mimeTypes.Add("src", "application/x-wais-source");
AttachmentBase.MimeTypes.mimeTypes.Add("ssi", "text/x-server-parsed-html");
AttachmentBase.MimeTypes.mimeTypes.Add("ssm", "application/streamingmedia");
AttachmentBase.MimeTypes.mimeTypes.Add("sst", "application/vnd.ms-pki.certstore");
AttachmentBase.MimeTypes.mimeTypes.Add("step", "application/step");
AttachmentBase.MimeTypes.mimeTypes.Add("stl", "application/sla");
AttachmentBase.MimeTypes.mimeTypes.Add("stp", "application/step");
AttachmentBase.MimeTypes.mimeTypes.Add("sv4cpio", "application/x-sv4cpio");
AttachmentBase.MimeTypes.mimeTypes.Add("sv4crc", "application/x-sv4crc");
AttachmentBase.MimeTypes.mimeTypes.Add("svf", "image/x-dwg");
AttachmentBase.MimeTypes.mimeTypes.Add("svr", "application/x-world");
AttachmentBase.MimeTypes.mimeTypes.Add("swf", "application/x-shockwave-flash");
AttachmentBase.MimeTypes.mimeTypes.Add("t", "application/x-troff");
AttachmentBase.MimeTypes.mimeTypes.Add("talk", "text/x-speech");
AttachmentBase.MimeTypes.mimeTypes.Add("tar", "application/x-tar");
AttachmentBase.MimeTypes.mimeTypes.Add("tbk", "application/toolbook");
AttachmentBase.MimeTypes.mimeTypes.Add("tcl", "text/x-script.tcl");
AttachmentBase.MimeTypes.mimeTypes.Add("tcsh", "text/x-script.tcsh");
AttachmentBase.MimeTypes.mimeTypes.Add("tex", "application/x-tex");
AttachmentBase.MimeTypes.mimeTypes.Add("texi", "application/x-texinfo");
AttachmentBase.MimeTypes.mimeTypes.Add("texinfo", "application/x-texinfo");
AttachmentBase.MimeTypes.mimeTypes.Add("text", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("tgz", "application/x-compressed");
AttachmentBase.MimeTypes.mimeTypes.Add("tif", "image/tiff");
AttachmentBase.MimeTypes.mimeTypes.Add("tiff", "image/tiff");
AttachmentBase.MimeTypes.mimeTypes.Add("tr", "application/x-troff");
AttachmentBase.MimeTypes.mimeTypes.Add("tsi", "audio/tsp-audio");
AttachmentBase.MimeTypes.mimeTypes.Add("tsp", "audio/tsplayer");
AttachmentBase.MimeTypes.mimeTypes.Add("tsv", "text/tab-separated-values");
AttachmentBase.MimeTypes.mimeTypes.Add("turbot", "image/florian");
AttachmentBase.MimeTypes.mimeTypes.Add("txt", "text/plain");
AttachmentBase.MimeTypes.mimeTypes.Add("uil", "text/x-uil");
AttachmentBase.MimeTypes.mimeTypes.Add("uni", "text/uri-list");
AttachmentBase.MimeTypes.mimeTypes.Add("unis", "text/uri-list");
AttachmentBase.MimeTypes.mimeTypes.Add("unv", "application/i-deas");
AttachmentBase.MimeTypes.mimeTypes.Add("uri", "text/uri-list");
AttachmentBase.MimeTypes.mimeTypes.Add("uris", "text/uri-list");
AttachmentBase.MimeTypes.mimeTypes.Add("ustar", "multipart/x-ustar");
AttachmentBase.MimeTypes.mimeTypes.Add("uu", "text/x-uuencode");
AttachmentBase.MimeTypes.mimeTypes.Add("uue", "text/x-uuencode");
AttachmentBase.MimeTypes.mimeTypes.Add("vcd", "application/x-cdlink");
AttachmentBase.MimeTypes.mimeTypes.Add("vcs", "text/x-vCalendar");
AttachmentBase.MimeTypes.mimeTypes.Add("vda", "application/vda");
AttachmentBase.MimeTypes.mimeTypes.Add("vdo", "video/vdo");
AttachmentBase.MimeTypes.mimeTypes.Add("vew", "application/groupwise");
AttachmentBase.MimeTypes.mimeTypes.Add("viv", "video/vivo");
AttachmentBase.MimeTypes.mimeTypes.Add("vivo", "video/vivo");
AttachmentBase.MimeTypes.mimeTypes.Add("vmd", "application/vocaltec-media-desc");
AttachmentBase.MimeTypes.mimeTypes.Add("vmf", "application/vocaltec-media-file");
AttachmentBase.MimeTypes.mimeTypes.Add("voc", "audio/voc");
AttachmentBase.MimeTypes.mimeTypes.Add("vos", "video/vosaic");
AttachmentBase.MimeTypes.mimeTypes.Add("vox", "audio/voxware");
AttachmentBase.MimeTypes.mimeTypes.Add("vqe", "audio/x-twinvq-plugin");
AttachmentBase.MimeTypes.mimeTypes.Add("vqf", "audio/x-twinvq");
AttachmentBase.MimeTypes.mimeTypes.Add("vql", "audio/x-twinvq-plugin");
AttachmentBase.MimeTypes.mimeTypes.Add("vrml", "application/x-vrml");
AttachmentBase.MimeTypes.mimeTypes.Add("vrt", "x-world/x-vrt");
AttachmentBase.MimeTypes.mimeTypes.Add("vsd", "application/x-visio");
AttachmentBase.MimeTypes.mimeTypes.Add("vst", "application/x-visio");
AttachmentBase.MimeTypes.mimeTypes.Add("vsw", "application/x-visio");
AttachmentBase.MimeTypes.mimeTypes.Add("w60", "application/wordperfect6.0");
AttachmentBase.MimeTypes.mimeTypes.Add("w61", "application/wordperfect6.1");
AttachmentBase.MimeTypes.mimeTypes.Add("w6w", "application/msword");
AttachmentBase.MimeTypes.mimeTypes.Add("wav", "audio/wav");
AttachmentBase.MimeTypes.mimeTypes.Add("wb1", "application/x-qpro");
AttachmentBase.MimeTypes.mimeTypes.Add("wbmp", "image/vnd.wap.wbmp");
AttachmentBase.MimeTypes.mimeTypes.Add("web", "application/vnd.xara");
AttachmentBase.MimeTypes.mimeTypes.Add("wiz", "application/msword");
AttachmentBase.MimeTypes.mimeTypes.Add("wk1", "application/x-123");
AttachmentBase.MimeTypes.mimeTypes.Add("wmf", "windows/metafile");
AttachmentBase.MimeTypes.mimeTypes.Add("wml", "text/vnd.wap.wml");
AttachmentBase.MimeTypes.mimeTypes.Add("wmlc", "application/vnd.wap.wmlc");
AttachmentBase.MimeTypes.mimeTypes.Add("wmls", "text/vnd.wap.wmlscript");
AttachmentBase.MimeTypes.mimeTypes.Add("wmlsc", "application/vnd.wap.wmlscriptc");
AttachmentBase.MimeTypes.mimeTypes.Add("word", "application/msword");
AttachmentBase.MimeTypes.mimeTypes.Add("wp", "application/wordperfect");
AttachmentBase.MimeTypes.mimeTypes.Add("wp5", "application/wordperfect");
AttachmentBase.MimeTypes.mimeTypes.Add("wp6", "application/wordperfect");
AttachmentBase.MimeTypes.mimeTypes.Add("wpd", "application/wordperfect");
AttachmentBase.MimeTypes.mimeTypes.Add("wq1", "application/x-lotus");
AttachmentBase.MimeTypes.mimeTypes.Add("wri", "application/mswrite");
AttachmentBase.MimeTypes.mimeTypes.Add("wrl", "application/x-world");
AttachmentBase.MimeTypes.mimeTypes.Add("wrz", "model/vrml");
AttachmentBase.MimeTypes.mimeTypes.Add("wsc", "text/scriplet");
AttachmentBase.MimeTypes.mimeTypes.Add("wsrc", "application/x-wais-source");
AttachmentBase.MimeTypes.mimeTypes.Add("wtk", "application/x-wintalk");
AttachmentBase.MimeTypes.mimeTypes.Add("xbm", "image/x-xbitmap");
AttachmentBase.MimeTypes.mimeTypes.Add("xdr", "video/x-amt-demorun");
AttachmentBase.MimeTypes.mimeTypes.Add("xgz", "xgl/drawing");
AttachmentBase.MimeTypes.mimeTypes.Add("xif", "image/vnd.xiff");
AttachmentBase.MimeTypes.mimeTypes.Add("xl", "application/excel");
AttachmentBase.MimeTypes.mimeTypes.Add("xla", "application/excel");
AttachmentBase.MimeTypes.mimeTypes.Add("xlb", "application/excel");
AttachmentBase.MimeTypes.mimeTypes.Add("xlc", "application/excel");
AttachmentBase.MimeTypes.mimeTypes.Add("xld", "application/excel");
AttachmentBase.MimeTypes.mimeTypes.Add("xlk", "application/excel");
AttachmentBase.MimeTypes.mimeTypes.Add("xll", "application/excel");
AttachmentBase.MimeTypes.mimeTypes.Add("xlm", "application/excel");
AttachmentBase.MimeTypes.mimeTypes.Add("xls", "application/excel");
AttachmentBase.MimeTypes.mimeTypes.Add("xlt", "application/excel");
AttachmentBase.MimeTypes.mimeTypes.Add("xlv", "application/excel");
AttachmentBase.MimeTypes.mimeTypes.Add("xlw", "application/excel");
AttachmentBase.MimeTypes.mimeTypes.Add("xm", "audio/xm");
AttachmentBase.MimeTypes.mimeTypes.Add("xml", "text/xml");
AttachmentBase.MimeTypes.mimeTypes.Add("xmz", "xgl/movie");
AttachmentBase.MimeTypes.mimeTypes.Add("xpix", "application/x-vnd.ls-xpix");
AttachmentBase.MimeTypes.mimeTypes.Add("xpm", "image/xpm");
AttachmentBase.MimeTypes.mimeTypes.Add("x-png", "image/png");
AttachmentBase.MimeTypes.mimeTypes.Add("xsr", "video/x-amt-showrun");
AttachmentBase.MimeTypes.mimeTypes.Add("xwd", "image/x-xwd");
AttachmentBase.MimeTypes.mimeTypes.Add("xyz", "chemical/x-pdb");
AttachmentBase.MimeTypes.mimeTypes.Add("z", "application/x-compressed");
AttachmentBase.MimeTypes.mimeTypes.Add("zip", "application/zip");
AttachmentBase.MimeTypes.mimeTypes.Add("zsh", "text/x-script.zsh");
}
// Token: 0x06000AB5 RID: 2741 RVA: 0x000202FC File Offset: 0x0001E4FC
public static string GetMimeType(string fileName)
{
string text = null;
int num = fileName.LastIndexOf('.');
if (num != -1 && fileName.Length > num + 1)
{
text = AttachmentBase.MimeTypes.mimeTypes[fileName.Substring(num + 1)] as string;
}
if (text == null)
{
text = "application/octet-stream";
}
return text;
}
// Token: 0x04000AFF RID: 2815
private static Hashtable mimeTypes = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
}
}
}
+49
View File
@@ -0,0 +1,49 @@
using System;
using System.Collections.ObjectModel;
namespace System.Net.Mail
{
/// <summary>Stores attachments to be sent as part of an e-mail message.</summary>
// Token: 0x0200013A RID: 314
public sealed class AttachmentCollection : Collection<Attachment>, IDisposable
{
// Token: 0x06000AB6 RID: 2742 RVA: 0x00020350 File Offset: 0x0001E550
internal AttachmentCollection()
{
}
/// <summary>Releases all resources used by the <see cref="T:System.Net.Mail.AttachmentCollection" />. </summary>
// Token: 0x06000AB7 RID: 2743 RVA: 0x00020358 File Offset: 0x0001E558
public void Dispose()
{
for (int i = 0; i < this.Count; i++)
{
this[i].Dispose();
}
}
// Token: 0x06000AB8 RID: 2744 RVA: 0x00020388 File Offset: 0x0001E588
protected override void ClearItems()
{
base.ClearItems();
}
// Token: 0x06000AB9 RID: 2745 RVA: 0x00020390 File Offset: 0x0001E590
protected override void InsertItem(int index, Attachment item)
{
base.InsertItem(index, item);
}
// Token: 0x06000ABA RID: 2746 RVA: 0x0002039C File Offset: 0x0001E59C
protected override void RemoveItem(int index)
{
base.RemoveItem(index);
}
// Token: 0x06000ABB RID: 2747 RVA: 0x000203A8 File Offset: 0x0001E5A8
protected override void SetItem(int index, Attachment item)
{
base.SetItem(index, item);
}
}
}
+27
View File
@@ -0,0 +1,27 @@
using System;
namespace System.Net.Mail
{
// Token: 0x02000148 RID: 328
internal class CCredentialsByHost : ICredentialsByHost
{
// Token: 0x06000B4E RID: 2894 RVA: 0x00022D3C File Offset: 0x00020F3C
public CCredentialsByHost(string userName, string password)
{
this.userName = userName;
this.password = password;
}
// Token: 0x06000B4F RID: 2895 RVA: 0x00022D54 File Offset: 0x00020F54
public NetworkCredential GetCredential(string host, int port, string authenticationType)
{
return new NetworkCredential(this.userName, this.password);
}
// Token: 0x04000B51 RID: 2897
private string userName;
// Token: 0x04000B52 RID: 2898
private string password;
}
}
@@ -0,0 +1,26 @@
using System;
namespace System.Net.Mail
{
/// <summary>Describes the delivery notification options for e-mail.</summary>
// Token: 0x0200013B RID: 315
[Flags]
public enum DeliveryNotificationOptions
{
/// <summary>No notification.</summary>
// Token: 0x04000B01 RID: 2817
None = 0,
/// <summary>Notify if the delivery is successful.</summary>
// Token: 0x04000B02 RID: 2818
OnSuccess = 1,
/// <summary>Notify if the delivery is unsuccessful.</summary>
// Token: 0x04000B03 RID: 2819
OnFailure = 2,
/// <summary>Notify if the delivery is delayed</summary>
// Token: 0x04000B04 RID: 2820
Delay = 4,
/// <summary>Never notify.</summary>
// Token: 0x04000B05 RID: 2821
Never = 134217728
}
}
+185
View File
@@ -0,0 +1,185 @@
using System;
using System.IO;
using System.Net.Mime;
using System.Text;
namespace System.Net.Mail
{
/// <summary>Represents an embedded external resource in an email attachment, such as an image in an HTML attachment.</summary>
// Token: 0x0200013C RID: 316
public class LinkedResource : AttachmentBase
{
/// <summary>Initializes a new instance of <see cref="T:System.Net.Mail.LinkedResource" /> using the specified file name.</summary>
/// <param name="fileName">The file name holding the content for this embedded resource.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="fileName" /> is null.</exception>
// Token: 0x06000ABC RID: 2748 RVA: 0x000203B4 File Offset: 0x0001E5B4
public LinkedResource(string fileName)
: base(fileName)
{
if (fileName == null)
{
throw new ArgumentNullException();
}
}
/// <summary>Initializes a new instance of <see cref="T:System.Net.Mail.LinkedResource" /> with the specified file name and content type.</summary>
/// <param name="fileName">The file name that holds the content for this embedded resource.</param>
/// <param name="contentType">The type of the content.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="fileName" /> is null.</exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="contentType" /> is not a valid value.</exception>
// Token: 0x06000ABD RID: 2749 RVA: 0x000203CC File Offset: 0x0001E5CC
public LinkedResource(string fileName, global::System.Net.Mime.ContentType contentType)
: base(fileName, contentType)
{
if (fileName == null)
{
throw new ArgumentNullException();
}
}
/// <summary>Initializes a new instance of <see cref="T:System.Net.Mail.LinkedResource" /> with the specified file name and media type.</summary>
/// <param name="fileName">The file name that holds the content for this embedded resource.</param>
/// <param name="mediaType">The MIME media type of the content.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="fileName" /> is null.</exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="mediaType" /> is not a valid value.</exception>
// Token: 0x06000ABE RID: 2750 RVA: 0x000203E4 File Offset: 0x0001E5E4
public LinkedResource(string fileName, string mediaType)
: base(fileName, mediaType)
{
if (fileName == null)
{
throw new ArgumentNullException();
}
}
/// <summary>Initializes a new instance of <see cref="T:System.Net.Mail.LinkedResource" /> using the supplied <see cref="T:System.IO.Stream" />.</summary>
/// <param name="contentStream">A stream that contains the content for this embedded resource.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="contentStream" /> is null.</exception>
// Token: 0x06000ABF RID: 2751 RVA: 0x000203FC File Offset: 0x0001E5FC
public LinkedResource(Stream contentStream)
: base(contentStream)
{
if (contentStream == null)
{
throw new ArgumentNullException();
}
}
/// <summary>Initializes a new instance of <see cref="T:System.Net.Mail.LinkedResource" /> with the values supplied by <see cref="T:System.IO.Stream" /> and <see cref="T:System.Net.Mime.ContentType" />.</summary>
/// <param name="contentStream">A stream that contains the content for this embedded resource.</param>
/// <param name="contentType">The type of the content.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="contentStream" /> is null.</exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="contentType" /> is not a valid value.</exception>
// Token: 0x06000AC0 RID: 2752 RVA: 0x00020414 File Offset: 0x0001E614
public LinkedResource(Stream contentStream, global::System.Net.Mime.ContentType contentType)
: base(contentStream, contentType)
{
if (contentStream == null)
{
throw new ArgumentNullException();
}
}
/// <summary>Initializes a new instance of <see cref="T:System.Net.Mail.LinkedResource" /> with the specified <see cref="T:System.IO.Stream" /> and media type.</summary>
/// <param name="contentStream">A stream that contains the content for this embedded resource.</param>
/// <param name="mediaType">The MIME media type of the content.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="contentStream" /> is null.</exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="mediaType" /> is not a valid value.</exception>
// Token: 0x06000AC1 RID: 2753 RVA: 0x0002042C File Offset: 0x0001E62C
public LinkedResource(Stream contentStream, string mediaType)
: base(contentStream, mediaType)
{
if (contentStream == null)
{
throw new ArgumentNullException();
}
}
/// <summary>Gets or sets a URI that the resource must match.</summary>
/// <returns>If <see cref="P:System.Net.Mail.LinkedResource.ContentLink" /> is a relative URI, the recipient of the message must resolve it.</returns>
// Token: 0x170002B4 RID: 692
// (get) Token: 0x06000AC2 RID: 2754 RVA: 0x00020444 File Offset: 0x0001E644
// (set) Token: 0x06000AC3 RID: 2755 RVA: 0x0002044C File Offset: 0x0001E64C
public global::System.Uri ContentLink
{
get
{
return this.contentLink;
}
set
{
this.contentLink = value;
}
}
/// <summary>Creates a <see cref="T:System.Net.Mail.LinkedResource" /> object from a string to be included in an email attachment as an embedded resource. The default media type is plain text, and the default content type is ASCII.</summary>
/// <returns>A <see cref="T:System.Net.Mail.LinkedResource" /> object that contains the embedded resource to be included in the email attachment.</returns>
/// <param name="content">A string that contains the embedded resource to be included in the email attachment.</param>
/// <exception cref="T:System.ArgumentNullException">The specified content string is null.</exception>
// Token: 0x06000AC4 RID: 2756 RVA: 0x00020458 File Offset: 0x0001E658
public static LinkedResource CreateLinkedResourceFromString(string content)
{
if (content == null)
{
throw new ArgumentNullException();
}
MemoryStream memoryStream = new MemoryStream(Encoding.Default.GetBytes(content));
return new LinkedResource(memoryStream)
{
TransferEncoding = global::System.Net.Mime.TransferEncoding.QuotedPrintable
};
}
/// <summary>Creates a <see cref="T:System.Net.Mail.LinkedResource" /> object from a string to be included in an email attachment as an embedded resource, with the specified content type, and media type as plain text.</summary>
/// <returns>A <see cref="T:System.Net.Mail.LinkedResource" /> object that contains the embedded resource to be included in the email attachment.</returns>
/// <param name="content">A string that contains the embedded resource to be included in the email attachment.</param>
/// <param name="contentType">The type of the content.</param>
/// <exception cref="T:System.ArgumentNullException">The specified content string is null.</exception>
// Token: 0x06000AC5 RID: 2757 RVA: 0x00020494 File Offset: 0x0001E694
public static LinkedResource CreateLinkedResourceFromString(string content, global::System.Net.Mime.ContentType contentType)
{
if (content == null)
{
throw new ArgumentNullException();
}
MemoryStream memoryStream = new MemoryStream(Encoding.Default.GetBytes(content));
return new LinkedResource(memoryStream, contentType)
{
TransferEncoding = global::System.Net.Mime.TransferEncoding.QuotedPrintable
};
}
/// <summary>Creates a <see cref="T:System.Net.Mail.LinkedResource" /> object from a string to be included in an email attachment as an embedded resource, with the specified content type, and media type.</summary>
/// <returns>A <see cref="T:System.Net.Mail.LinkedResource" /> object that contains the embedded resource to be included in the email attachment.</returns>
/// <param name="content">A string that contains the embedded resource to be included in the email attachment.</param>
/// <param name="contentEncoding">The type of the content.</param>
/// <param name="mediaType">The MIME media type of the content.</param>
/// <exception cref="T:System.ArgumentNullException">The specified content string is null.</exception>
// Token: 0x06000AC6 RID: 2758 RVA: 0x000204D0 File Offset: 0x0001E6D0
public static LinkedResource CreateLinkedResourceFromString(string content, Encoding contentEncoding, string mediaType)
{
if (content == null)
{
throw new ArgumentNullException();
}
MemoryStream memoryStream = new MemoryStream(contentEncoding.GetBytes(content));
return new LinkedResource(memoryStream, mediaType)
{
TransferEncoding = global::System.Net.Mime.TransferEncoding.QuotedPrintable
};
}
// Token: 0x04000B06 RID: 2822
private global::System.Uri contentLink;
}
}
@@ -0,0 +1,52 @@
using System;
using System.Collections.ObjectModel;
namespace System.Net.Mail
{
/// <summary>Stores linked resources to be sent as part of an e-mail message.</summary>
// Token: 0x0200013D RID: 317
public sealed class LinkedResourceCollection : Collection<LinkedResource>, IDisposable
{
// Token: 0x06000AC7 RID: 2759 RVA: 0x00020508 File Offset: 0x0001E708
internal LinkedResourceCollection()
{
}
/// <summary>Releases all resources used by the <see cref="T:System.Net.Mail.LinkedResourceCollection" />.</summary>
// Token: 0x06000AC8 RID: 2760 RVA: 0x00020510 File Offset: 0x0001E710
public void Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
// Token: 0x06000AC9 RID: 2761 RVA: 0x00020520 File Offset: 0x0001E720
private void Dispose(bool disposing)
{
}
// Token: 0x06000ACA RID: 2762 RVA: 0x00020524 File Offset: 0x0001E724
protected override void ClearItems()
{
base.ClearItems();
}
// Token: 0x06000ACB RID: 2763 RVA: 0x0002052C File Offset: 0x0001E72C
protected override void InsertItem(int index, LinkedResource item)
{
base.InsertItem(index, item);
}
// Token: 0x06000ACC RID: 2764 RVA: 0x00020538 File Offset: 0x0001E738
protected override void RemoveItem(int index)
{
base.RemoveItem(index);
}
// Token: 0x06000ACD RID: 2765 RVA: 0x00020544 File Offset: 0x0001E744
protected override void SetItem(int index, LinkedResource item)
{
base.SetItem(index, item);
}
}
}
+202
View File
@@ -0,0 +1,202 @@
using System;
using System.Text;
namespace System.Net.Mail
{
/// <summary>Represents the address of an electronic mail sender or recipient.</summary>
// Token: 0x0200013E RID: 318
public class MailAddress
{
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.MailAddress" /> class using the specified address. </summary>
/// <param name="address">A <see cref="T:System.String" /> that contains an e-mail address.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="address" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="address" /> is <see cref="F:System.String.Empty" /> ("").</exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="address" /> is not in a recognized format.</exception>
// Token: 0x06000ACE RID: 2766 RVA: 0x00020550 File Offset: 0x0001E750
public MailAddress(string address)
: this(address, null)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.MailAddress" /> class using the specified address and display name.</summary>
/// <param name="address">A <see cref="T:System.String" /> that contains an e-mail address.</param>
/// <param name="displayName">A <see cref="T:System.String" /> that contains the display name associated with <paramref name="address" />. This parameter can be null.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="address" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="address" /> is <see cref="F:System.String.Empty" /> ("").</exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="address" /> is not in a recognized format.-or-<paramref name="address" /> contains non-ASCII characters.</exception>
// Token: 0x06000ACF RID: 2767 RVA: 0x0002055C File Offset: 0x0001E75C
public MailAddress(string address, string displayName)
: this(address, displayName, Encoding.Default)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.MailAddress" /> class using the specified address, display name, and encoding.</summary>
/// <param name="address">A <see cref="T:System.String" /> that contains an e-mail address.</param>
/// <param name="displayName">A <see cref="T:System.String" /> that contains the display name associated with <paramref name="address" />.</param>
/// <param name="displayNameEncoding">The <see cref="T:System.Text.Encoding" /> that defines the character set used for <paramref name="displayName" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="address" /> is null.-or-<paramref name="displayName" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="address" /> is <see cref="F:System.String.Empty" /> ("").-or-<paramref name="displayName" /> is <see cref="F:System.String.Empty" /> ("").</exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="address" /> is not in a recognized format.-or-<paramref name="address" /> contains non-ASCII characters.</exception>
// Token: 0x06000AD0 RID: 2768 RVA: 0x0002056C File Offset: 0x0001E76C
public MailAddress(string address, string displayName, Encoding displayNameEncoding)
{
if (address == null)
{
throw new ArgumentNullException("address");
}
int num = address.IndexOf('"');
if (num == 0)
{
int num2 = address.IndexOf('"', num + 1);
if (num2 == -1)
{
throw MailAddress.CreateFormatException();
}
this.displayName = address.Substring(num + 1, num2 - 1).Trim();
address = address.Substring(num2 + 1);
}
int num3 = address.IndexOf('<');
if (num3 != -1)
{
if (num3 + 1 >= address.Length)
{
throw MailAddress.CreateFormatException();
}
int num4 = address.IndexOf('>', num3 + 1);
if (num4 == -1)
{
throw MailAddress.CreateFormatException();
}
if (this.displayName == null)
{
this.displayName = address.Substring(0, num3).Trim();
}
address = address.Substring(++num3, num4 - num3);
}
if (displayName != null)
{
this.displayName = displayName.Trim();
}
this.address = address.Trim();
}
/// <summary>Gets the e-mail address specified when this instance was created.</summary>
/// <returns>A <see cref="T:System.String" /> that contains the e-mail address.</returns>
// Token: 0x170002B5 RID: 693
// (get) Token: 0x06000AD1 RID: 2769 RVA: 0x00020664 File Offset: 0x0001E864
public string Address
{
get
{
return this.address;
}
}
/// <summary>Gets the display name composed from the display name and address information specified when this instance was created.</summary>
/// <returns>A <see cref="T:System.String" /> that contains the display name; otherwise, <see cref="F:System.String.Empty" /> ("") if no display name information was specified when this instance was created.</returns>
// Token: 0x170002B6 RID: 694
// (get) Token: 0x06000AD2 RID: 2770 RVA: 0x0002066C File Offset: 0x0001E86C
public string DisplayName
{
get
{
if (this.displayName == null)
{
return string.Empty;
}
return this.displayName;
}
}
/// <summary>Gets the host portion of the address specified when this instance was created.</summary>
/// <returns>A <see cref="T:System.String" /> that contains the name of the host computer that accepts e-mail for the <see cref="P:System.Net.Mail.MailAddress.User" /> property.</returns>
// Token: 0x170002B7 RID: 695
// (get) Token: 0x06000AD3 RID: 2771 RVA: 0x00020688 File Offset: 0x0001E888
public string Host
{
get
{
return this.Address.Substring(this.address.IndexOf("@") + 1);
}
}
/// <summary>Gets the user information from the address specified when this instance was created.</summary>
/// <returns>A <see cref="T:System.String" /> that contains the user name portion of the <see cref="P:System.Net.Mail.MailAddress.Address" />.</returns>
// Token: 0x170002B8 RID: 696
// (get) Token: 0x06000AD4 RID: 2772 RVA: 0x000206A8 File Offset: 0x0001E8A8
public string User
{
get
{
return this.Address.Substring(0, this.address.IndexOf("@"));
}
}
/// <summary>Compares two mail addresses.</summary>
/// <returns>true if the two mail addresses are equal; otherwise, false.</returns>
/// <param name="value">A <see cref="T:System.Net.Mail.MailAddress" /> instance to compare to the current instance.</param>
// Token: 0x06000AD5 RID: 2773 RVA: 0x000206C8 File Offset: 0x0001E8C8
public override bool Equals(object obj)
{
return this.Equals(obj as MailAddress);
}
// Token: 0x06000AD6 RID: 2774 RVA: 0x000206D8 File Offset: 0x0001E8D8
private bool Equals(MailAddress other)
{
return other != null && this.Address == other.Address;
}
/// <summary>Returns a hash value for a mail address.</summary>
/// <returns>An integer hash value.</returns>
// Token: 0x06000AD7 RID: 2775 RVA: 0x000206F4 File Offset: 0x0001E8F4
public override int GetHashCode()
{
return this.address.GetHashCode();
}
/// <summary>Returns a string representation of this instance.</summary>
/// <returns>A <see cref="T:System.String" /> that contains the contents of this <see cref="T:System.Net.Mail.MailAddress" />.</returns>
// Token: 0x06000AD8 RID: 2776 RVA: 0x00020704 File Offset: 0x0001E904
public override string ToString()
{
StringBuilder stringBuilder = new StringBuilder();
if (this.DisplayName != null && this.DisplayName.Length > 0)
{
stringBuilder.Append("\"");
stringBuilder.Append(this.DisplayName);
stringBuilder.Append("\"");
stringBuilder.Append(" ");
stringBuilder.Append("<");
stringBuilder.Append(this.Address);
stringBuilder.Append(">");
}
else
{
stringBuilder.Append(this.Address);
}
return stringBuilder.ToString();
}
// Token: 0x06000AD9 RID: 2777 RVA: 0x000207A4 File Offset: 0x0001E9A4
private static FormatException CreateFormatException()
{
return new FormatException("The specified string is not in the form required for an e-mail address.");
}
// Token: 0x04000B07 RID: 2823
private string address;
// Token: 0x04000B08 RID: 2824
private string displayName;
}
}
+70
View File
@@ -0,0 +1,70 @@
using System;
using System.Collections.ObjectModel;
using System.Text;
namespace System.Net.Mail
{
/// <summary>Store e-mail addresses that are associated with an e-mail message.</summary>
// Token: 0x0200013F RID: 319
public class MailAddressCollection : Collection<MailAddress>
{
/// <summary>Add a list of e-mail addresses to the collection.</summary>
/// <param name="addresses">The e-mail addresses to add to the <see cref="T:System.Net.Mail.MailAddressCollection" />. Multiple e-mail addresses must be separated with a comma character (","). </param>
/// <exception cref="T:System.ArgumentNullException">The<paramref name=" addresses" /> parameter is null.</exception>
/// <exception cref="T:System.ArgumentException">The<paramref name=" addresses" /> parameter is an empty string.</exception>
/// <exception cref="T:System.FormatException">The<paramref name=" addresses" /> parameter contains an e-mail address that is invalid or not supported. </exception>
// Token: 0x06000ADB RID: 2779 RVA: 0x000207B8 File Offset: 0x0001E9B8
public void Add(string addresses)
{
foreach (string text in addresses.Split(new char[] { ',' }))
{
this.Add(new MailAddress(text));
}
}
/// <summary>Inserts an e-mail address into the <see cref="T:System.Net.Mail.MailAddressCollection" />, at the specified location.</summary>
/// <param name="index">The location at which to insert the e-mail address that is specified by <paramref name="item" />.</param>
/// <param name="item">The e-mail address to be inserted into the collection.</param>
/// <exception cref="T:System.ArgumentNullException">The<paramref name=" item" /> parameter is null.</exception>
// Token: 0x06000ADC RID: 2780 RVA: 0x000207FC File Offset: 0x0001E9FC
protected override void InsertItem(int index, MailAddress item)
{
if (item == null)
{
throw new ArgumentNullException();
}
base.InsertItem(index, item);
}
/// <summary>Replaces the element at the specified index.</summary>
/// <param name="index">The index of the e-mail address element to be replaced.</param>
/// <param name="item">An e-mail address that will replace the element in the collection.</param>
/// <exception cref="T:System.ArgumentNullException">The<paramref name=" item" /> parameter is null.</exception>
// Token: 0x06000ADD RID: 2781 RVA: 0x00020814 File Offset: 0x0001EA14
protected override void SetItem(int index, MailAddress item)
{
if (item == null)
{
throw new ArgumentNullException();
}
base.SetItem(index, item);
}
/// <summary>Returns a string representation of the e-mail addresses in this <see cref="T:System.Net.Mail.MailAddressCollection" /> object.</summary>
/// <returns>A <see cref="T:System.String" /> containing the e-mail addresses in this collection.</returns>
// Token: 0x06000ADE RID: 2782 RVA: 0x0002082C File Offset: 0x0001EA2C
public override string ToString()
{
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < this.Count; i++)
{
if (i > 0)
{
stringBuilder.Append(", ");
}
stringBuilder.Append(this[i].ToString());
}
return stringBuilder.ToString();
}
}
}
+480
View File
@@ -0,0 +1,480 @@
using System;
using System.Collections.Specialized;
using System.Net.Mime;
using System.Text;
namespace System.Net.Mail
{
/// <summary>Represents an e-mail message that can be sent using the <see cref="T:System.Net.Mail.SmtpClient" /> class.</summary>
// Token: 0x02000140 RID: 320
public class MailMessage : IDisposable
{
/// <summary>Initializes an empty instance of the <see cref="T:System.Net.Mail.MailMessage" /> class.</summary>
// Token: 0x06000ADF RID: 2783 RVA: 0x00020884 File Offset: 0x0001EA84
public MailMessage()
{
this.to = new MailAddressCollection();
this.alternateViews = new AlternateViewCollection();
this.attachments = new AttachmentCollection();
this.bcc = new MailAddressCollection();
this.cc = new MailAddressCollection();
this.replyTo = new MailAddressCollection();
this.headers = new global::System.Collections.Specialized.NameValueCollection();
this.headers.Add("MIME-Version", "1.0");
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.MailMessage" /> class by using the specified <see cref="T:System.Net.Mail.MailAddress" /> class objects. </summary>
/// <param name="from">A <see cref="T:System.Net.Mail.MailAddress" /> that contains the address of the sender of the e-mail message.</param>
/// <param name="to">A <see cref="T:System.Net.Mail.MailAddress" /> that contains the address of the recipient of the e-mail message.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="from" /> is null.-or-<paramref name="to" /> is null.</exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="from" /> or <paramref name="to" /> is malformed.</exception>
// Token: 0x06000AE0 RID: 2784 RVA: 0x00020904 File Offset: 0x0001EB04
public MailMessage(MailAddress from, MailAddress to)
: this()
{
if (from == null || to == null)
{
throw new ArgumentNullException();
}
this.From = from;
this.to.Add(to);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.MailMessage" /> class by using the specified <see cref="T:System.String" /> class objects. </summary>
/// <param name="from">A <see cref="T:System.String" /> that contains the address of the sender of the e-mail message.</param>
/// <param name="to">A <see cref="T:System.String" /> that contains the addresses of the recipients of the e-mail message.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="from" /> is null.-or-<paramref name="to" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="from" /> is <see cref="F:System.String.Empty" /> ("").-or-<paramref name="to" /> is <see cref="F:System.String.Empty" /> ("").</exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="from" /> or <paramref name="to" /> is malformed.</exception>
// Token: 0x06000AE1 RID: 2785 RVA: 0x00020934 File Offset: 0x0001EB34
public MailMessage(string from, string to)
: this()
{
if (from == null || from == string.Empty)
{
throw new ArgumentNullException("from");
}
if (to == null || to == string.Empty)
{
throw new ArgumentNullException("to");
}
this.from = new MailAddress(from);
foreach (string text in to.Split(new char[] { ',' }))
{
this.to.Add(new MailAddress(text.Trim()));
}
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.MailMessage" /> class. </summary>
/// <param name="from">A <see cref="T:System.String" /> that contains the address of the sender of the e-mail message.</param>
/// <param name="to">A <see cref="T:System.String" /> that contains the address of the recipient of the e-mail message.</param>
/// <param name="subject">A <see cref="T:System.String" /> that contains the subject text.</param>
/// <param name="body">A <see cref="T:System.String" /> that contains the message body.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="from" /> is null.-or-<paramref name="to" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="from" /> is <see cref="F:System.String.Empty" /> ("").-or-<paramref name="to" /> is <see cref="F:System.String.Empty" /> ("").</exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="from" /> or <paramref name="to" /> is malformed.</exception>
// Token: 0x06000AE2 RID: 2786 RVA: 0x000209D8 File Offset: 0x0001EBD8
public MailMessage(string from, string to, string subject, string body)
: this()
{
if (from == null || from == string.Empty)
{
throw new ArgumentNullException("from");
}
if (to == null || to == string.Empty)
{
throw new ArgumentNullException("to");
}
this.from = new MailAddress(from);
foreach (string text in to.Split(new char[] { ',' }))
{
this.to.Add(new MailAddress(text.Trim()));
}
this.Body = body;
this.Subject = subject;
}
/// <summary>Gets the attachment collection used to store alternate forms of the message body.</summary>
/// <returns>A writable <see cref="T:System.Net.Mail.AlternateViewCollection" />.</returns>
// Token: 0x170002B9 RID: 697
// (get) Token: 0x06000AE3 RID: 2787 RVA: 0x00020A88 File Offset: 0x0001EC88
public AlternateViewCollection AlternateViews
{
get
{
return this.alternateViews;
}
}
/// <summary>Gets the attachment collection used to store data attached to this e-mail message.</summary>
/// <returns>A writable <see cref="T:System.Net.Mail.AttachmentCollection" />.</returns>
// Token: 0x170002BA RID: 698
// (get) Token: 0x06000AE4 RID: 2788 RVA: 0x00020A90 File Offset: 0x0001EC90
public AttachmentCollection Attachments
{
get
{
return this.attachments;
}
}
/// <summary>Gets the address collection that contains the blind carbon copy (BCC) recipients for this e-mail message.</summary>
/// <returns>A writable <see cref="T:System.Net.Mail.MailAddressCollection" /> object.</returns>
// Token: 0x170002BB RID: 699
// (get) Token: 0x06000AE5 RID: 2789 RVA: 0x00020A98 File Offset: 0x0001EC98
public MailAddressCollection Bcc
{
get
{
return this.bcc;
}
}
/// <summary>Gets or sets the message body.</summary>
/// <returns>A <see cref="T:System.String" /> value that contains the body text.</returns>
// Token: 0x170002BC RID: 700
// (get) Token: 0x06000AE6 RID: 2790 RVA: 0x00020AA0 File Offset: 0x0001ECA0
// (set) Token: 0x06000AE7 RID: 2791 RVA: 0x00020AA8 File Offset: 0x0001ECA8
public string Body
{
get
{
return this.body;
}
set
{
if (value != null && this.bodyEncoding == null)
{
this.bodyEncoding = this.GuessEncoding(value) ?? Encoding.ASCII;
}
this.body = value;
}
}
// Token: 0x170002BD RID: 701
// (get) Token: 0x06000AE8 RID: 2792 RVA: 0x00020ADC File Offset: 0x0001ECDC
internal global::System.Net.Mime.ContentType BodyContentType
{
get
{
return new global::System.Net.Mime.ContentType((!this.isHtml) ? "text/plain" : "text/html")
{
CharSet = (this.BodyEncoding ?? Encoding.ASCII).HeaderName
};
}
}
// Token: 0x170002BE RID: 702
// (get) Token: 0x06000AE9 RID: 2793 RVA: 0x00020B28 File Offset: 0x0001ED28
internal global::System.Net.Mime.TransferEncoding ContentTransferEncoding
{
get
{
return global::System.Net.Mime.ContentType.GuessTransferEncoding(this.BodyEncoding);
}
}
/// <summary>Gets or sets the encoding used to encode the message body.</summary>
/// <returns>An <see cref="T:System.Text.Encoding" /> applied to the contents of the <see cref="P:System.Net.Mail.MailMessage.Body" />.</returns>
// Token: 0x170002BF RID: 703
// (get) Token: 0x06000AEA RID: 2794 RVA: 0x00020B38 File Offset: 0x0001ED38
// (set) Token: 0x06000AEB RID: 2795 RVA: 0x00020B40 File Offset: 0x0001ED40
public Encoding BodyEncoding
{
get
{
return this.bodyEncoding;
}
set
{
this.bodyEncoding = value;
}
}
/// <summary>Gets the address collection that contains the carbon copy (CC) recipients for this e-mail message.</summary>
/// <returns>A writable <see cref="T:System.Net.Mail.MailAddressCollection" /> object.</returns>
// Token: 0x170002C0 RID: 704
// (get) Token: 0x06000AEC RID: 2796 RVA: 0x00020B4C File Offset: 0x0001ED4C
public MailAddressCollection CC
{
get
{
return this.cc;
}
}
/// <summary>Gets or sets the delivery notifications for this e-mail message.</summary>
/// <returns>A <see cref="T:System.Net.Mail.DeliveryNotificationOptions" /> value that contains the delivery notifications for this message.</returns>
// Token: 0x170002C1 RID: 705
// (get) Token: 0x06000AED RID: 2797 RVA: 0x00020B54 File Offset: 0x0001ED54
// (set) Token: 0x06000AEE RID: 2798 RVA: 0x00020B5C File Offset: 0x0001ED5C
public DeliveryNotificationOptions DeliveryNotificationOptions
{
get
{
return this.deliveryNotificationOptions;
}
set
{
this.deliveryNotificationOptions = value;
}
}
/// <summary>Gets or sets the from address for this e-mail message.</summary>
/// <returns>A <see cref="T:System.Net.Mail.MailAddress" /> that contains the from address information.</returns>
// Token: 0x170002C2 RID: 706
// (get) Token: 0x06000AEF RID: 2799 RVA: 0x00020B68 File Offset: 0x0001ED68
// (set) Token: 0x06000AF0 RID: 2800 RVA: 0x00020B70 File Offset: 0x0001ED70
public MailAddress From
{
get
{
return this.from;
}
set
{
this.from = value;
}
}
/// <summary>Gets the e-mail headers that are transmitted with this e-mail message.</summary>
/// <returns>A <see cref="T:System.Collections.Specialized.NameValueCollection" /> that contains the e-mail headers.</returns>
// Token: 0x170002C3 RID: 707
// (get) Token: 0x06000AF1 RID: 2801 RVA: 0x00020B7C File Offset: 0x0001ED7C
public global::System.Collections.Specialized.NameValueCollection Headers
{
get
{
return this.headers;
}
}
/// <summary>Gets or sets a value indicating whether the mail message body is in Html.</summary>
/// <returns>true if the message body is in Html; else false. The default is false.</returns>
// Token: 0x170002C4 RID: 708
// (get) Token: 0x06000AF2 RID: 2802 RVA: 0x00020B84 File Offset: 0x0001ED84
// (set) Token: 0x06000AF3 RID: 2803 RVA: 0x00020B8C File Offset: 0x0001ED8C
public bool IsBodyHtml
{
get
{
return this.isHtml;
}
set
{
this.isHtml = value;
}
}
/// <summary>Gets or sets the priority of this e-mail message.</summary>
/// <returns>A <see cref="T:System.Net.Mail.MailPriority" /> that contains the priority of this message.</returns>
// Token: 0x170002C5 RID: 709
// (get) Token: 0x06000AF4 RID: 2804 RVA: 0x00020B98 File Offset: 0x0001ED98
// (set) Token: 0x06000AF5 RID: 2805 RVA: 0x00020BA0 File Offset: 0x0001EDA0
public MailPriority Priority
{
get
{
return this.priority;
}
set
{
this.priority = value;
}
}
// Token: 0x170002C6 RID: 710
// (get) Token: 0x06000AF6 RID: 2806 RVA: 0x00020BAC File Offset: 0x0001EDAC
// (set) Token: 0x06000AF7 RID: 2807 RVA: 0x00020BB4 File Offset: 0x0001EDB4
internal Encoding HeadersEncoding
{
get
{
return this.headersEncoding;
}
set
{
this.headersEncoding = value;
}
}
// Token: 0x170002C7 RID: 711
// (get) Token: 0x06000AF8 RID: 2808 RVA: 0x00020BC0 File Offset: 0x0001EDC0
internal MailAddressCollection ReplyToList
{
get
{
return this.replyTo;
}
}
/// <summary>Gets or sets the ReplyTo address for the mail message.</summary>
/// <returns>A MailAddress that indicates the value of the <see cref="P:System.Net.Mail.MailMessage.ReplyTo" /> field.</returns>
// Token: 0x170002C8 RID: 712
// (get) Token: 0x06000AF9 RID: 2809 RVA: 0x00020BC8 File Offset: 0x0001EDC8
// (set) Token: 0x06000AFA RID: 2810 RVA: 0x00020BE8 File Offset: 0x0001EDE8
public MailAddress ReplyTo
{
get
{
if (this.replyTo.Count == 0)
{
return null;
}
return this.replyTo[0];
}
set
{
this.replyTo.Clear();
this.replyTo.Add(value);
}
}
/// <summary>Gets or sets the sender's address for this e-mail message.</summary>
/// <returns>A <see cref="T:System.Net.Mail.MailAddress" /> that contains the sender's address information.</returns>
// Token: 0x170002C9 RID: 713
// (get) Token: 0x06000AFB RID: 2811 RVA: 0x00020C04 File Offset: 0x0001EE04
// (set) Token: 0x06000AFC RID: 2812 RVA: 0x00020C0C File Offset: 0x0001EE0C
public MailAddress Sender
{
get
{
return this.sender;
}
set
{
this.sender = value;
}
}
/// <summary>Gets or sets the subject line for this e-mail message.</summary>
/// <returns>A <see cref="T:System.String" /> that contains the subject content.</returns>
// Token: 0x170002CA RID: 714
// (get) Token: 0x06000AFD RID: 2813 RVA: 0x00020C18 File Offset: 0x0001EE18
// (set) Token: 0x06000AFE RID: 2814 RVA: 0x00020C20 File Offset: 0x0001EE20
public string Subject
{
get
{
return this.subject;
}
set
{
if (value != null && this.subjectEncoding == null)
{
this.subjectEncoding = this.GuessEncoding(value);
}
this.subject = value;
}
}
/// <summary>Gets or sets the encoding used for the subject content for this e-mail message.</summary>
/// <returns>An <see cref="T:System.Text.Encoding" /> that was used to encode the <see cref="P:System.Net.Mail.MailMessage.Subject" /> property.</returns>
// Token: 0x170002CB RID: 715
// (get) Token: 0x06000AFF RID: 2815 RVA: 0x00020C48 File Offset: 0x0001EE48
// (set) Token: 0x06000B00 RID: 2816 RVA: 0x00020C50 File Offset: 0x0001EE50
public Encoding SubjectEncoding
{
get
{
return this.subjectEncoding;
}
set
{
this.subjectEncoding = value;
}
}
/// <summary>Gets the address collection that contains the recipients of this e-mail message.</summary>
/// <returns>A writable <see cref="T:System.Net.Mail.MailAddressCollection" /> object.</returns>
// Token: 0x170002CC RID: 716
// (get) Token: 0x06000B01 RID: 2817 RVA: 0x00020C5C File Offset: 0x0001EE5C
public MailAddressCollection To
{
get
{
return this.to;
}
}
/// <summary>Releases all resources used by the <see cref="T:System.Net.Mail.MailMessage" />. </summary>
// Token: 0x06000B02 RID: 2818 RVA: 0x00020C64 File Offset: 0x0001EE64
public void Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>Releases the unmanaged resources used by the <see cref="T:System.Net.Mail.MailMessage" /> and optionally releases the managed resources. </summary>
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources. </param>
// Token: 0x06000B03 RID: 2819 RVA: 0x00020C74 File Offset: 0x0001EE74
protected virtual void Dispose(bool disposing)
{
}
// Token: 0x06000B04 RID: 2820 RVA: 0x00020C78 File Offset: 0x0001EE78
private Encoding GuessEncoding(string s)
{
return global::System.Net.Mime.ContentType.GuessEncoding(s);
}
// Token: 0x04000B09 RID: 2825
private AlternateViewCollection alternateViews;
// Token: 0x04000B0A RID: 2826
private AttachmentCollection attachments;
// Token: 0x04000B0B RID: 2827
private MailAddressCollection bcc;
// Token: 0x04000B0C RID: 2828
private MailAddressCollection replyTo;
// Token: 0x04000B0D RID: 2829
private string body;
// Token: 0x04000B0E RID: 2830
private MailPriority priority;
// Token: 0x04000B0F RID: 2831
private MailAddress sender;
// Token: 0x04000B10 RID: 2832
private DeliveryNotificationOptions deliveryNotificationOptions;
// Token: 0x04000B11 RID: 2833
private MailAddressCollection cc;
// Token: 0x04000B12 RID: 2834
private MailAddress from;
// Token: 0x04000B13 RID: 2835
private global::System.Collections.Specialized.NameValueCollection headers;
// Token: 0x04000B14 RID: 2836
private MailAddressCollection to;
// Token: 0x04000B15 RID: 2837
private string subject;
// Token: 0x04000B16 RID: 2838
private Encoding subjectEncoding;
// Token: 0x04000B17 RID: 2839
private Encoding bodyEncoding;
// Token: 0x04000B18 RID: 2840
private Encoding headersEncoding = Encoding.UTF8;
// Token: 0x04000B19 RID: 2841
private bool isHtml;
}
}
+19
View File
@@ -0,0 +1,19 @@
using System;
namespace System.Net.Mail
{
/// <summary>Specifies the priority of a <see cref="T:System.Net.Mail.MailMessage" />.</summary>
// Token: 0x02000141 RID: 321
public enum MailPriority
{
/// <summary>The email has normal priority.</summary>
// Token: 0x04000B1B RID: 2843
Normal,
/// <summary>The email has low priority.</summary>
// Token: 0x04000B1C RID: 2844
Low,
/// <summary>The email has high priority.</summary>
// Token: 0x04000B1D RID: 2845
High
}
}
@@ -0,0 +1,12 @@
using System;
using System.ComponentModel;
namespace System.Net.Mail
{
/// <summary>Represents the method that will handle the <see cref="E:System.Net.Mail.SmtpClient.SendCompleted" /> event.</summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">An <see cref="T:System.ComponentModel.AsyncCompletedEventArgs" /> containing event data.</param>
// Token: 0x0200032D RID: 813
// (Invoke) Token: 0x06001C8D RID: 7309
public delegate void SendCompletedEventHandler(object sender, global::System.ComponentModel.AsyncCompletedEventArgs e);
}
+19
View File
@@ -0,0 +1,19 @@
using System;
namespace System.Net.Mail
{
/// <summary>Specifies the level of access allowed to a Simple Mail Transport Protocol (SMTP) server.</summary>
// Token: 0x02000142 RID: 322
public enum SmtpAccess
{
/// <summary>No access to an SMTP host.</summary>
// Token: 0x04000B1F RID: 2847
None,
/// <summary>Connection to an SMTP host on the default port (port 25).</summary>
// Token: 0x04000B20 RID: 2848
Connect,
/// <summary>Connection to an SMTP host on any port.</summary>
// Token: 0x04000B21 RID: 2849
ConnectToUnrestrictedPort
}
}
+1528
View File
@@ -0,0 +1,1528 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.IO;
using System.Net.Mime;
using System.Net.Security;
using System.Net.Sockets;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading;
namespace System.Net.Mail
{
/// <summary>Allows applications to send e-mail by using the Simple Mail Transfer Protocol (SMTP).</summary>
// Token: 0x02000143 RID: 323
public class SmtpClient
{
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpClient" /> class by using configuration file settings. </summary>
// Token: 0x06000B05 RID: 2821 RVA: 0x00020C80 File Offset: 0x0001EE80
public SmtpClient()
: this(null, 0)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpClient" /> class that sends e-mail by using the specified SMTP server. </summary>
/// <param name="host">A <see cref="T:System.String" /> that contains the name or IP address of the host computer used for SMTP transactions.</param>
// Token: 0x06000B06 RID: 2822 RVA: 0x00020C8C File Offset: 0x0001EE8C
public SmtpClient(string host)
: this(host, 0)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpClient" /> class that sends e-mail by using the specified SMTP server and port.</summary>
/// <param name="host">A <see cref="T:System.String" /> that contains the name or IP address of the host used for SMTP transactions.</param>
/// <param name="port">An <see cref="T:System.Int32" /> greater than zero that contains the port to be used on <paramref name="host" />.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="port" /> cannot be less than zero.</exception>
// Token: 0x06000B07 RID: 2823 RVA: 0x00020C98 File Offset: 0x0001EE98
public SmtpClient(string host, int port)
{
if (!string.IsNullOrEmpty(host))
{
this.host = host;
}
if (port != 0)
{
this.port = port;
}
}
/// <summary>Occurs when an asynchronous e-mail send operation completes.</summary>
// Token: 0x14000022 RID: 34
// (add) Token: 0x06000B08 RID: 2824 RVA: 0x00020D04 File Offset: 0x0001EF04
// (remove) Token: 0x06000B09 RID: 2825 RVA: 0x00020D20 File Offset: 0x0001EF20
public event SendCompletedEventHandler SendCompleted;
/// <summary>Specify which certificates should be used to establish the Secure Sockets Layer (SSL) connection.</summary>
/// <returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" />, holding one or more client certificates. The default value is derived from the mail configuration attributes in a configuration file.</returns>
// Token: 0x170002CD RID: 717
// (get) Token: 0x06000B0A RID: 2826 RVA: 0x00020D3C File Offset: 0x0001EF3C
[global::System.MonoTODO("Client certificates not used")]
public global::System.Security.Cryptography.X509Certificates.X509CertificateCollection ClientCertificates
{
get
{
if (this.clientCertificates == null)
{
this.clientCertificates = new global::System.Security.Cryptography.X509Certificates.X509CertificateCollection();
}
return this.clientCertificates;
}
}
/// <summary>Gets or sets the Service Provider Name (SPN) to use for authentication when using extended protection.</summary>
/// <returns>A <see cref="T:System.String" /> that specifies the SPN to use for extended protection. The default value for this SPN is of the form "SMTPSVC/&lt;host&gt;" where &lt;host&gt; is the hostname of the SMTP mail server. </returns>
// Token: 0x170002CE RID: 718
// (get) Token: 0x06000B0B RID: 2827 RVA: 0x00020D5C File Offset: 0x0001EF5C
// (set) Token: 0x06000B0C RID: 2828 RVA: 0x00020D64 File Offset: 0x0001EF64
private string TargetName { get; set; }
/// <summary>Gets or sets the credentials used to authenticate the sender.</summary>
/// <returns>An <see cref="T:System.Net.ICredentialsByHost" /> that represents the credentials to use for authentication; or null if no credentials have been specified.</returns>
/// <exception cref="T:System.InvalidOperationException">You cannot change the value of this property when an email is being sent.</exception>
// Token: 0x170002CF RID: 719
// (get) Token: 0x06000B0D RID: 2829 RVA: 0x00020D70 File Offset: 0x0001EF70
// (set) Token: 0x06000B0E RID: 2830 RVA: 0x00020D78 File Offset: 0x0001EF78
public ICredentialsByHost Credentials
{
get
{
return this.credentials;
}
set
{
this.CheckState();
this.credentials = value;
}
}
/// <summary>Specifies how outgoing email messages will be handled.</summary>
/// <returns>An <see cref="T:System.Net.Mail.SmtpDeliveryMethod" /> that indicates how email messages are delivered.</returns>
// Token: 0x170002D0 RID: 720
// (get) Token: 0x06000B0F RID: 2831 RVA: 0x00020D88 File Offset: 0x0001EF88
// (set) Token: 0x06000B10 RID: 2832 RVA: 0x00020D90 File Offset: 0x0001EF90
public SmtpDeliveryMethod DeliveryMethod
{
get
{
return this.deliveryMethod;
}
set
{
this.CheckState();
this.deliveryMethod = value;
}
}
/// <summary>Specify whether the <see cref="T:System.Net.Mail.SmtpClient" /> uses Secure Sockets Layer (SSL) to encrypt the connection.</summary>
/// <returns>true if the <see cref="T:System.Net.Mail.SmtpClient" /> uses SSL; otherwise, false. The default is false.</returns>
// Token: 0x170002D1 RID: 721
// (get) Token: 0x06000B11 RID: 2833 RVA: 0x00020DA0 File Offset: 0x0001EFA0
// (set) Token: 0x06000B12 RID: 2834 RVA: 0x00020DA8 File Offset: 0x0001EFA8
public bool EnableSsl
{
get
{
return this.enableSsl;
}
set
{
this.CheckState();
this.enableSsl = value;
}
}
/// <summary>Gets or sets the name or IP address of the host used for SMTP transactions.</summary>
/// <returns>A <see cref="T:System.String" /> that contains the name or IP address of the computer to use for SMTP transactions.</returns>
/// <exception cref="T:System.ArgumentNullException">The value specified for a set operation is null.</exception>
/// <exception cref="T:System.ArgumentException">The value specified for a set operation is equal to <see cref="F:System.String.Empty" /> ("").</exception>
/// <exception cref="T:System.InvalidOperationException">You cannot change the value of this property when an email is being sent.</exception>
// Token: 0x170002D2 RID: 722
// (get) Token: 0x06000B13 RID: 2835 RVA: 0x00020DB8 File Offset: 0x0001EFB8
// (set) Token: 0x06000B14 RID: 2836 RVA: 0x00020DC0 File Offset: 0x0001EFC0
public string Host
{
get
{
return this.host;
}
set
{
if (value == null)
{
throw new ArgumentNullException("value");
}
if (value.Length == 0)
{
throw new ArgumentException("An empty string is not allowed.", "value");
}
this.CheckState();
this.host = value;
}
}
/// <summary>Gets or sets the folder where applications save mail messages to be processed by the local SMTP server.</summary>
/// <returns>A <see cref="T:System.String" /> that specifies the pickup directory for mail messages.</returns>
// Token: 0x170002D3 RID: 723
// (get) Token: 0x06000B15 RID: 2837 RVA: 0x00020DFC File Offset: 0x0001EFFC
// (set) Token: 0x06000B16 RID: 2838 RVA: 0x00020E04 File Offset: 0x0001F004
public string PickupDirectoryLocation
{
get
{
return this.pickupDirectoryLocation;
}
set
{
this.pickupDirectoryLocation = value;
}
}
/// <summary>Gets or sets the port used for SMTP transactions.</summary>
/// <returns>An <see cref="T:System.Int32" /> that contains the port number on the SMTP host. The default value is 25.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value specified for a set operation is less than or equal to zero.</exception>
/// <exception cref="T:System.InvalidOperationException">You cannot change the value of this property when an email is being sent.</exception>
// Token: 0x170002D4 RID: 724
// (get) Token: 0x06000B17 RID: 2839 RVA: 0x00020E10 File Offset: 0x0001F010
// (set) Token: 0x06000B18 RID: 2840 RVA: 0x00020E18 File Offset: 0x0001F018
public int Port
{
get
{
return this.port;
}
set
{
if (value <= 0)
{
throw new ArgumentOutOfRangeException("value");
}
this.CheckState();
this.port = value;
}
}
/// <summary>Gets the network connection used to transmit the e-mail message.</summary>
/// <returns>A <see cref="T:System.Net.ServicePoint" /> that connects to the <see cref="P:System.Net.Mail.SmtpClient.Host" /> property used for SMTP.</returns>
/// <exception cref="T:System.InvalidOperationException">
/// <see cref="P:System.Net.Mail.SmtpClient.Host" /> is null or the empty string ("").-or-<see cref="P:System.Net.Mail.SmtpClient.Port" /> is zero.</exception>
// Token: 0x170002D5 RID: 725
// (get) Token: 0x06000B19 RID: 2841 RVA: 0x00020E3C File Offset: 0x0001F03C
[global::System.MonoTODO]
public ServicePoint ServicePoint
{
get
{
throw new NotImplementedException();
}
}
/// <summary>Gets or sets a value that specifies the amount of time after which a synchronous <see cref="Overload:System.Net.Mail.SmtpClient.Send" /> call times out.</summary>
/// <returns>An <see cref="T:System.Int32" /> that specifies the time-out value in milliseconds. The default value is 100,000 (100 seconds).</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value specified for a set operation was less than zero.</exception>
/// <exception cref="T:System.InvalidOperationException">You cannot change the value of this property when an email is being sent.</exception>
// Token: 0x170002D6 RID: 726
// (get) Token: 0x06000B1A RID: 2842 RVA: 0x00020E44 File Offset: 0x0001F044
// (set) Token: 0x06000B1B RID: 2843 RVA: 0x00020E4C File Offset: 0x0001F04C
public int Timeout
{
get
{
return this.timeout;
}
set
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value");
}
this.CheckState();
this.timeout = value;
}
}
/// <summary>Gets or sets a <see cref="T:System.Boolean" /> value that controls whether the <see cref="P:System.Net.CredentialCache.DefaultCredentials" /> are sent with requests.</summary>
/// <returns>true if the default credentials are used; otherwise false. The default value is false.</returns>
/// <exception cref="T:System.InvalidOperationException">You cannot change the value of this property when an e-mail is being sent.</exception>
// Token: 0x170002D7 RID: 727
// (get) Token: 0x06000B1C RID: 2844 RVA: 0x00020E70 File Offset: 0x0001F070
// (set) Token: 0x06000B1D RID: 2845 RVA: 0x00020E74 File Offset: 0x0001F074
public bool UseDefaultCredentials
{
get
{
return false;
}
[global::System.MonoNotSupported("no DefaultCredential support in Mono")]
set
{
if (value)
{
throw new NotImplementedException("Default credentials are not supported");
}
this.CheckState();
}
}
// Token: 0x06000B1E RID: 2846 RVA: 0x00020E90 File Offset: 0x0001F090
private void CheckState()
{
if (this.messageInProcess != null)
{
throw new InvalidOperationException("Cannot set Timeout while Sending a message");
}
}
// Token: 0x06000B1F RID: 2847 RVA: 0x00020EA8 File Offset: 0x0001F0A8
private static string EncodeAddress(MailAddress address)
{
string text = global::System.Net.Mime.ContentType.EncodeSubjectRFC2047(address.DisplayName, Encoding.UTF8);
return string.Concat(new string[] { "\"", text, "\" <", address.Address, ">" });
}
// Token: 0x06000B20 RID: 2848 RVA: 0x00020EF8 File Offset: 0x0001F0F8
private static string EncodeAddresses(MailAddressCollection addresses)
{
StringBuilder stringBuilder = new StringBuilder();
bool flag = true;
foreach (MailAddress mailAddress in addresses)
{
if (!flag)
{
stringBuilder.Append(", ");
}
stringBuilder.Append(SmtpClient.EncodeAddress(mailAddress));
flag = false;
}
return stringBuilder.ToString();
}
// Token: 0x06000B21 RID: 2849 RVA: 0x00020F80 File Offset: 0x0001F180
private string EncodeSubjectRFC2047(MailMessage message)
{
return global::System.Net.Mime.ContentType.EncodeSubjectRFC2047(message.Subject, message.SubjectEncoding);
}
// Token: 0x06000B22 RID: 2850 RVA: 0x00020F94 File Offset: 0x0001F194
private string EncodeBody(MailMessage message)
{
string body = message.Body;
Encoding bodyEncoding = message.BodyEncoding;
global::System.Net.Mime.TransferEncoding contentTransferEncoding = message.ContentTransferEncoding;
if (contentTransferEncoding == global::System.Net.Mime.TransferEncoding.Base64)
{
return Convert.ToBase64String(bodyEncoding.GetBytes(body), Base64FormattingOptions.InsertLineBreaks);
}
if (contentTransferEncoding != global::System.Net.Mime.TransferEncoding.SevenBit)
{
return this.ToQuotedPrintable(body, bodyEncoding);
}
return body;
}
// Token: 0x06000B23 RID: 2851 RVA: 0x00020FE4 File Offset: 0x0001F1E4
private string EncodeBody(AlternateView av)
{
byte[] array = new byte[av.ContentStream.Length];
av.ContentStream.Read(array, 0, array.Length);
global::System.Net.Mime.TransferEncoding transferEncoding = av.TransferEncoding;
if (transferEncoding == global::System.Net.Mime.TransferEncoding.Base64)
{
return Convert.ToBase64String(array, Base64FormattingOptions.InsertLineBreaks);
}
if (transferEncoding != global::System.Net.Mime.TransferEncoding.SevenBit)
{
return this.ToQuotedPrintable(array);
}
return Encoding.ASCII.GetString(array);
}
// Token: 0x06000B24 RID: 2852 RVA: 0x0002104C File Offset: 0x0001F24C
private void EndSection(string section)
{
this.SendData(string.Format("--{0}--", section));
this.SendData(string.Empty);
}
// Token: 0x06000B25 RID: 2853 RVA: 0x0002106C File Offset: 0x0001F26C
private string GenerateBoundary()
{
string text = SmtpClient.GenerateBoundary(this.boundaryIndex);
this.boundaryIndex++;
return text;
}
// Token: 0x06000B26 RID: 2854 RVA: 0x00021094 File Offset: 0x0001F294
private static string GenerateBoundary(int index)
{
return string.Format("--boundary_{0}_{1}", index, Guid.NewGuid().ToString("D"));
}
// Token: 0x06000B27 RID: 2855 RVA: 0x000210C4 File Offset: 0x0001F2C4
private bool IsError(SmtpClient.SmtpResponse status)
{
return status.StatusCode >= (SmtpStatusCode)400;
}
/// <summary>Raises the <see cref="E:System.Net.Mail.SmtpClient.SendCompleted" /> event.</summary>
/// <param name="e">An <see cref="T:System.ComponentModel.AsyncCompletedEventArgs" /> that contains event data.</param>
// Token: 0x06000B28 RID: 2856 RVA: 0x000210D8 File Offset: 0x0001F2D8
protected void OnSendCompleted(global::System.ComponentModel.AsyncCompletedEventArgs e)
{
try
{
if (this.SendCompleted != null)
{
this.SendCompleted(this, e);
}
}
finally
{
this.worker = null;
this.user_async_state = null;
}
}
// Token: 0x06000B29 RID: 2857 RVA: 0x00021130 File Offset: 0x0001F330
private void CheckCancellation()
{
if (this.worker != null && this.worker.CancellationPending)
{
throw new SmtpClient.CancellationException();
}
}
// Token: 0x06000B2A RID: 2858 RVA: 0x00021154 File Offset: 0x0001F354
private SmtpClient.SmtpResponse Read()
{
byte[] array = new byte[512];
int num = 0;
bool flag = false;
do
{
this.CheckCancellation();
int num2 = this.stream.Read(array, num, array.Length - num);
if (num2 <= 0)
{
break;
}
int num3 = num + num2 - 1;
if (num3 > 4 && (array[num3] == 10 || array[num3] == 13))
{
int num4 = num3 - 3;
while (num4 >= 0 && array[num4] != 10 && array[num4] != 13)
{
num4--;
}
flag = array[num4 + 4] == 32;
}
num += num2;
if (num == array.Length)
{
byte[] array2 = new byte[array.Length * 2];
Array.Copy(array, 0, array2, 0, array.Length);
array = array2;
}
}
while (!flag);
if (num > 0)
{
Encoding encoding = new ASCIIEncoding();
string @string = encoding.GetString(array, 0, num - 1);
return SmtpClient.SmtpResponse.Parse(@string);
}
throw new IOException("Connection closed");
}
// Token: 0x06000B2B RID: 2859 RVA: 0x00021264 File Offset: 0x0001F464
private void ResetExtensions()
{
this.authMechs = SmtpClient.AuthMechs.None;
}
// Token: 0x06000B2C RID: 2860 RVA: 0x00021270 File Offset: 0x0001F470
private void ParseExtensions(string extens)
{
char[] array = new char[] { ' ' };
string[] array2 = extens.Split(new char[] { '\n' });
foreach (string text in array2)
{
if (text.Length >= 4)
{
string text2 = text.Substring(4);
if (text2.StartsWith("AUTH ", StringComparison.Ordinal))
{
string[] array4 = text2.Split(array);
for (int j = 1; j < array4.Length; j++)
{
string text3 = array4[j].Trim();
string text4 = text3;
switch (text4)
{
case "CRAM-MD5":
this.authMechs |= SmtpClient.AuthMechs.CramMD5;
break;
case "DIGEST-MD5":
this.authMechs |= SmtpClient.AuthMechs.DigestMD5;
break;
case "GSSAPI":
this.authMechs |= SmtpClient.AuthMechs.GssAPI;
break;
case "KERBEROS_V4":
this.authMechs |= SmtpClient.AuthMechs.Kerberos4;
break;
case "LOGIN":
this.authMechs |= SmtpClient.AuthMechs.Login;
break;
case "PLAIN":
this.authMechs |= SmtpClient.AuthMechs.Plain;
break;
}
}
}
}
}
}
/// <summary>Sends the specified message to an SMTP server for delivery.</summary>
/// <param name="message">A <see cref="T:System.Net.Mail.MailMessage" /> that contains the message to send.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <see cref="P:System.Net.Mail.MailMessage.From" /> is null.-or-<see cref="P:System.Net.Mail.MailMessage.To" /> is null.-or- <paramref name="message" /> is null.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">There are no recipients in <see cref="P:System.Net.Mail.MailMessage.To" />, <see cref="P:System.Net.Mail.MailMessage.CC" />, and <see cref="P:System.Net.Mail.MailMessage.Bcc" />.</exception>
/// <exception cref="T:System.InvalidOperationException">This <see cref="T:System.Net.Mail.SmtpClient" /> has a <see cref="Overload:System.Net.Mail.SmtpClient.SendAsync" /> call in progress.-or- <see cref="P:System.Net.Mail.SmtpClient.Host" /> is null.-or-<see cref="P:System.Net.Mail.SmtpClient.Host" /> is equal to the empty string ("").-or- <see cref="P:System.Net.Mail.SmtpClient.Port" /> is zero.</exception>
/// <exception cref="T:System.ObjectDisposedException">This object has been disposed.</exception>
/// <exception cref="T:System.Net.Mail.SmtpException">The connection to the SMTP server failed.-or-Authentication failed.-or-The operation timed out.</exception>
/// <exception cref="T:System.Net.Mail.SmtpFailedRecipientsException">The message could not be delivered to one or more of the recipients in <see cref="P:System.Net.Mail.MailMessage.To" />, <see cref="P:System.Net.Mail.MailMessage.CC" />, or <see cref="P:System.Net.Mail.MailMessage.Bcc" />.</exception>
// Token: 0x06000B2D RID: 2861 RVA: 0x00021434 File Offset: 0x0001F634
public void Send(MailMessage message)
{
if (message == null)
{
throw new ArgumentNullException("message");
}
if (this.deliveryMethod == SmtpDeliveryMethod.Network && (this.Host == null || this.Host.Trim().Length == 0))
{
throw new InvalidOperationException("The SMTP host was not specified");
}
if (this.deliveryMethod == SmtpDeliveryMethod.PickupDirectoryFromIis)
{
throw new NotSupportedException("IIS delivery is not supported");
}
if (this.port == 0)
{
this.port = 25;
}
this.mutex.WaitOne();
try
{
this.messageInProcess = message;
if (this.deliveryMethod == SmtpDeliveryMethod.SpecifiedPickupDirectory)
{
this.SendToFile(message);
}
else
{
this.SendInternal(message);
}
}
catch (SmtpClient.CancellationException)
{
}
catch (SmtpException)
{
throw;
}
catch (Exception ex)
{
throw new SmtpException("Message could not be sent.", ex);
}
finally
{
this.mutex.ReleaseMutex();
this.messageInProcess = null;
}
}
// Token: 0x06000B2E RID: 2862 RVA: 0x00021580 File Offset: 0x0001F780
private void SendInternal(MailMessage message)
{
this.CheckCancellation();
try
{
this.client = new global::System.Net.Sockets.TcpClient(this.host, this.port);
this.stream = this.client.GetStream();
this.writer = new StreamWriter(this.stream);
this.reader = new StreamReader(this.stream);
this.SendCore(message);
}
finally
{
if (this.writer != null)
{
this.writer.Close();
}
if (this.reader != null)
{
this.reader.Close();
}
if (this.stream != null)
{
this.stream.Close();
}
if (this.client != null)
{
this.client.Close();
}
}
}
// Token: 0x06000B2F RID: 2863 RVA: 0x00021660 File Offset: 0x0001F860
private void SendToFile(MailMessage message)
{
if (!Path.IsPathRooted(this.pickupDirectoryLocation))
{
throw new SmtpException("Only absolute directories are allowed for pickup directory.");
}
string text = Path.Combine(this.pickupDirectoryLocation, Guid.NewGuid() + ".eml");
try
{
this.writer = new StreamWriter(text);
MailAddress from = message.From;
if (from == null)
{
from = this.defaultFrom;
}
this.SendHeader("Date", DateTime.Now.ToString("ddd, dd MMM yyyy HH':'mm':'ss zzz", DateTimeFormatInfo.InvariantInfo));
this.SendHeader("From", from.ToString());
this.SendHeader("To", message.To.ToString());
if (message.CC.Count > 0)
{
this.SendHeader("Cc", message.CC.ToString());
}
this.SendHeader("Subject", this.EncodeSubjectRFC2047(message));
foreach (string text2 in message.Headers.AllKeys)
{
this.SendHeader(text2, message.Headers[text2]);
}
this.AddPriorityHeader(message);
this.boundaryIndex = 0;
if (message.Attachments.Count > 0)
{
this.SendWithAttachments(message);
}
else
{
this.SendWithoutAttachments(message, null, false);
}
}
finally
{
if (this.writer != null)
{
this.writer.Close();
}
this.writer = null;
}
}
// Token: 0x06000B30 RID: 2864 RVA: 0x000217FC File Offset: 0x0001F9FC
private void SendCore(MailMessage message)
{
SmtpClient.SmtpResponse smtpResponse = this.Read();
if (this.IsError(smtpResponse))
{
throw new SmtpException(smtpResponse.StatusCode, smtpResponse.Description);
}
smtpResponse = this.SendCommand("EHLO " + Dns.GetHostName());
if (this.IsError(smtpResponse))
{
smtpResponse = this.SendCommand("HELO " + Dns.GetHostName());
if (this.IsError(smtpResponse))
{
throw new SmtpException(smtpResponse.StatusCode, smtpResponse.Description);
}
}
else
{
string description = smtpResponse.Description;
if (description != null)
{
this.ParseExtensions(description);
}
}
if (this.enableSsl)
{
this.InitiateSecureConnection();
this.ResetExtensions();
this.writer = new StreamWriter(this.stream);
this.reader = new StreamReader(this.stream);
smtpResponse = this.SendCommand("EHLO " + Dns.GetHostName());
if (this.IsError(smtpResponse))
{
smtpResponse = this.SendCommand("HELO " + Dns.GetHostName());
if (this.IsError(smtpResponse))
{
throw new SmtpException(smtpResponse.StatusCode, smtpResponse.Description);
}
}
else
{
string description2 = smtpResponse.Description;
if (description2 != null)
{
this.ParseExtensions(description2);
}
}
}
if (this.authMechs != SmtpClient.AuthMechs.None)
{
this.Authenticate();
}
MailAddress from = message.From;
if (from == null)
{
from = this.defaultFrom;
}
smtpResponse = this.SendCommand("MAIL FROM:<" + from.Address + '>');
if (this.IsError(smtpResponse))
{
throw new SmtpException(smtpResponse.StatusCode, smtpResponse.Description);
}
List<SmtpFailedRecipientException> list = new List<SmtpFailedRecipientException>();
for (int i = 0; i < message.To.Count; i++)
{
smtpResponse = this.SendCommand("RCPT TO:<" + message.To[i].Address + '>');
if (this.IsError(smtpResponse))
{
list.Add(new SmtpFailedRecipientException(smtpResponse.StatusCode, message.To[i].Address));
}
}
for (int j = 0; j < message.CC.Count; j++)
{
smtpResponse = this.SendCommand("RCPT TO:<" + message.CC[j].Address + '>');
if (this.IsError(smtpResponse))
{
list.Add(new SmtpFailedRecipientException(smtpResponse.StatusCode, message.CC[j].Address));
}
}
for (int k = 0; k < message.Bcc.Count; k++)
{
smtpResponse = this.SendCommand("RCPT TO:<" + message.Bcc[k].Address + '>');
if (this.IsError(smtpResponse))
{
list.Add(new SmtpFailedRecipientException(smtpResponse.StatusCode, message.Bcc[k].Address));
}
}
if (list.Count > 0)
{
throw new SmtpFailedRecipientsException("failed recipients", list.ToArray());
}
smtpResponse = this.SendCommand("DATA");
if (this.IsError(smtpResponse))
{
throw new SmtpException(smtpResponse.StatusCode, smtpResponse.Description);
}
string text = DateTime.Now.ToString("ddd, dd MMM yyyy HH':'mm':'ss zzz", DateTimeFormatInfo.InvariantInfo);
text = text.Remove(text.Length - 3, 1);
this.SendHeader("Date", text);
this.SendHeader("From", SmtpClient.EncodeAddress(from));
this.SendHeader("To", SmtpClient.EncodeAddresses(message.To));
if (message.CC.Count > 0)
{
this.SendHeader("Cc", SmtpClient.EncodeAddresses(message.CC));
}
this.SendHeader("Subject", this.EncodeSubjectRFC2047(message));
string text2 = "normal";
switch (message.Priority)
{
case MailPriority.Normal:
text2 = "normal";
break;
case MailPriority.Low:
text2 = "non-urgent";
break;
case MailPriority.High:
text2 = "urgent";
break;
}
this.SendHeader("Priority", text2);
if (message.Sender != null)
{
this.SendHeader("Sender", SmtpClient.EncodeAddress(message.Sender));
}
if (message.ReplyToList.Count > 0)
{
this.SendHeader("Reply-To", SmtpClient.EncodeAddresses(message.ReplyToList));
}
foreach (string text3 in message.Headers.AllKeys)
{
this.SendHeader(text3, message.Headers[text3]);
}
this.AddPriorityHeader(message);
this.boundaryIndex = 0;
if (message.Attachments.Count > 0)
{
this.SendWithAttachments(message);
}
else
{
this.SendWithoutAttachments(message, null, false);
}
this.SendDot();
smtpResponse = this.Read();
if (this.IsError(smtpResponse))
{
throw new SmtpException(smtpResponse.StatusCode, smtpResponse.Description);
}
try
{
smtpResponse = this.SendCommand("QUIT");
}
catch (IOException)
{
}
}
/// <summary>Sends the specified e-mail message to an SMTP server for delivery. The message sender, recipients, subject, and message body are specified using <see cref="T:System.String" /> objects.</summary>
/// <param name="from">A <see cref="T:System.String" /> that contains the address information of the message sender.</param>
/// <param name="recipients">A <see cref="T:System.String" /> that contains the addresses that the message is sent to.</param>
/// <param name="subject">A <see cref="T:System.String" /> that contains the subject line for the message.</param>
/// <param name="body">A <see cref="T:System.String" /> that contains the message body.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="from" /> is null.-or-<paramref name="recipient" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="from" /> is <see cref="F:System.String.Empty" />.-or-<paramref name="recipient" /> is <see cref="F:System.String.Empty" />.</exception>
/// <exception cref="T:System.InvalidOperationException">This <see cref="T:System.Net.Mail.SmtpClient" /> has a <see cref="Overload:System.Net.Mail.SmtpClient.SendAsync" /> call in progress.-or- <see cref="P:System.Net.Mail.SmtpClient.Host" /> is null.-or-<see cref="P:System.Net.Mail.SmtpClient.Host" /> is equal to the empty string ("").-or- <see cref="P:System.Net.Mail.SmtpClient.Port" /> is zero.</exception>
/// <exception cref="T:System.ObjectDisposedException">This object has been disposed.</exception>
/// <exception cref="T:System.Net.Mail.SmtpException">The connection to the SMTP server failed.-or-Authentication failed.-or-The operation timed out.</exception>
/// <exception cref="T:System.Net.Mail.SmtpFailedRecipientsException">The message could not be delivered to one or more of the recipients in <paramref name="recipients" />. </exception>
// Token: 0x06000B31 RID: 2865 RVA: 0x00021D84 File Offset: 0x0001FF84
public void Send(string from, string to, string subject, string body)
{
this.Send(new MailMessage(from, to, subject, body));
}
// Token: 0x06000B32 RID: 2866 RVA: 0x00021D98 File Offset: 0x0001FF98
private void SendDot()
{
this.writer.Write(".\r\n");
this.writer.Flush();
}
// Token: 0x06000B33 RID: 2867 RVA: 0x00021DB8 File Offset: 0x0001FFB8
private void SendData(string data)
{
if (string.IsNullOrEmpty(data))
{
this.writer.Write("\r\n");
this.writer.Flush();
return;
}
StringReader stringReader = new StringReader(data);
bool flag = this.deliveryMethod == SmtpDeliveryMethod.Network;
string text;
while ((text = stringReader.ReadLine()) != null)
{
this.CheckCancellation();
if (flag)
{
int i;
for (i = 0; i < text.Length; i++)
{
if (text[i] != '.')
{
break;
}
}
if (i > 0 && i == text.Length)
{
text += ".";
}
}
this.writer.Write(text);
this.writer.Write("\r\n");
}
this.writer.Flush();
}
/// <summary>Sends the specified e-mail message to an SMTP server for delivery. This method does not block the calling thread and allows the caller to pass an object to the method that is invoked when the operation completes. </summary>
/// <param name="message">A <see cref="T:System.Net.Mail.MailMessage" /> that contains the message to send.</param>
/// <param name="userToken">A user-defined object that is passed to the method invoked when the asynchronous operation completes.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <see cref="P:System.Net.Mail.MailMessage.From" /> is null.-or-<see cref="P:System.Net.Mail.MailMessage.To" /> is null.-or- <paramref name="message" /> is null.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">There are no recipients in <see cref="P:System.Net.Mail.MailMessage.To" />, <see cref="P:System.Net.Mail.MailMessage.CC" />, and <see cref="P:System.Net.Mail.MailMessage.Bcc" />.</exception>
/// <exception cref="T:System.InvalidOperationException">This <see cref="T:System.Net.Mail.SmtpClient" /> has a <see cref="Overload:System.Net.Mail.SmtpClient.SendAsync" /> call in progress.-or- <see cref="P:System.Net.Mail.SmtpClient.Host" /> is null.-or-<see cref="P:System.Net.Mail.SmtpClient.Host" /> is equal to the empty string ("").-or- <see cref="P:System.Net.Mail.SmtpClient.Port" /> is zero.</exception>
/// <exception cref="T:System.ObjectDisposedException">This object has been disposed.</exception>
/// <exception cref="T:System.Net.Mail.SmtpException">The connection to the SMTP server failed.-or-Authentication failed.-or-The operation timed out.</exception>
/// <exception cref="T:System.Net.Mail.SmtpFailedRecipientsException">The <paramref name="message" /> could not be delivered to one or more of the recipients in <see cref="P:System.Net.Mail.MailMessage.To" />, <see cref="P:System.Net.Mail.MailMessage.CC" />, or <see cref="P:System.Net.Mail.MailMessage.Bcc" />.</exception>
// Token: 0x06000B34 RID: 2868 RVA: 0x00021E8C File Offset: 0x0002008C
public void SendAsync(MailMessage message, object userToken)
{
if (this.worker != null)
{
throw new InvalidOperationException("Another SendAsync operation is in progress");
}
this.worker = new global::System.ComponentModel.BackgroundWorker();
this.worker.DoWork += delegate(object o, global::System.ComponentModel.DoWorkEventArgs ea)
{
try
{
this.user_async_state = ea.Argument;
this.Send(message);
}
catch (Exception ex)
{
ea.Result = ex;
throw ex;
}
};
this.worker.WorkerSupportsCancellation = true;
this.worker.RunWorkerCompleted += delegate(object o, global::System.ComponentModel.RunWorkerCompletedEventArgs ea)
{
this.OnSendCompleted(new global::System.ComponentModel.AsyncCompletedEventArgs(ea.Error, ea.Cancelled, this.user_async_state));
};
this.worker.RunWorkerAsync(userToken);
}
/// <summary>Sends an e-mail message to an SMTP server for delivery. The message sender, recipients, subject, and message body are specified using <see cref="T:System.String" /> objects. This method does not block the calling thread and allows the caller to pass an object to the method that is invoked when the operation completes.</summary>
/// <param name="from">A <see cref="T:System.String" /> that contains the address information of the message sender.</param>
/// <param name="recipients">A <see cref="T:System.String" /> that contains the address that the message is sent to.</param>
/// <param name="subject">A <see cref="T:System.String" /> that contains the subject line for the message.</param>
/// <param name="body">A <see cref="T:System.String" /> that contains the message body.</param>
/// <param name="userToken">A user-defined object that is passed to the method invoked when the asynchronous operation completes.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="from" /> is null.-or-<paramref name="recipient" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="from" /> is <see cref="F:System.String.Empty" />.-or-<paramref name="recipient" /> is <see cref="F:System.String.Empty" />.</exception>
/// <exception cref="T:System.InvalidOperationException">This <see cref="T:System.Net.Mail.SmtpClient" /> has a <see cref="Overload:System.Net.Mail.SmtpClient.SendAsync" /> call in progress.-or- <see cref="P:System.Net.Mail.SmtpClient.Host" /> is null.-or-<see cref="P:System.Net.Mail.SmtpClient.Host" /> is equal to the empty string ("").-or- <see cref="P:System.Net.Mail.SmtpClient.Port" /> is zero.</exception>
/// <exception cref="T:System.ObjectDisposedException">This object has been disposed.</exception>
/// <exception cref="T:System.Net.Mail.SmtpException">The connection to the SMTP server failed.-or-Authentication failed.-or-The operation timed out.</exception>
/// <exception cref="T:System.Net.Mail.SmtpFailedRecipientsException">The message could not be delivered to one or more of the recipients in <paramref name="recipients" />. </exception>
// Token: 0x06000B35 RID: 2869 RVA: 0x00021F14 File Offset: 0x00020114
public void SendAsync(string from, string to, string subject, string body, object userToken)
{
this.SendAsync(new MailMessage(from, to, subject, body), userToken);
}
/// <summary>Cancels an asynchronous operation to send an e-mail message.</summary>
/// <exception cref="T:System.ObjectDisposedException">This object has been disposed.</exception>
// Token: 0x06000B36 RID: 2870 RVA: 0x00021F28 File Offset: 0x00020128
public void SendAsyncCancel()
{
if (this.worker == null)
{
throw new InvalidOperationException("SendAsync operation is not in progress");
}
this.worker.CancelAsync();
}
// Token: 0x06000B37 RID: 2871 RVA: 0x00021F4C File Offset: 0x0002014C
private void AddPriorityHeader(MailMessage message)
{
MailPriority priority = message.Priority;
if (priority != MailPriority.Low)
{
if (priority == MailPriority.High)
{
this.SendHeader("Priority", "Urgent");
this.SendHeader("Importance", "high");
this.SendHeader("X-Priority", "1");
}
}
else
{
this.SendHeader("Priority", "Non-Urgent");
this.SendHeader("Importance", "low");
this.SendHeader("X-Priority", "5");
}
}
// Token: 0x06000B38 RID: 2872 RVA: 0x00021FE0 File Offset: 0x000201E0
private void SendSimpleBody(MailMessage message)
{
this.SendHeader("Content-Type", message.BodyContentType.ToString());
if (message.ContentTransferEncoding != global::System.Net.Mime.TransferEncoding.SevenBit)
{
this.SendHeader("Content-Transfer-Encoding", SmtpClient.GetTransferEncodingName(message.ContentTransferEncoding));
}
this.SendData(string.Empty);
this.SendData(this.EncodeBody(message));
}
// Token: 0x06000B39 RID: 2873 RVA: 0x00022040 File Offset: 0x00020240
private void SendBodylessSingleAlternate(AlternateView av)
{
this.SendHeader("Content-Type", av.ContentType.ToString());
if (av.TransferEncoding != global::System.Net.Mime.TransferEncoding.SevenBit)
{
this.SendHeader("Content-Transfer-Encoding", SmtpClient.GetTransferEncodingName(av.TransferEncoding));
}
this.SendData(string.Empty);
this.SendData(this.EncodeBody(av));
}
// Token: 0x06000B3A RID: 2874 RVA: 0x000220A0 File Offset: 0x000202A0
private void SendWithoutAttachments(MailMessage message, string boundary, bool attachmentExists)
{
if (message.Body == null && message.AlternateViews.Count == 1)
{
this.SendBodylessSingleAlternate(message.AlternateViews[0]);
}
else if (message.AlternateViews.Count > 0)
{
this.SendBodyWithAlternateViews(message, boundary, attachmentExists);
}
else
{
this.SendSimpleBody(message);
}
}
// Token: 0x06000B3B RID: 2875 RVA: 0x00022108 File Offset: 0x00020308
private void SendWithAttachments(MailMessage message)
{
string text = this.GenerateBoundary();
this.SendHeader("Content-Type", new global::System.Net.Mime.ContentType
{
Boundary = text,
MediaType = "multipart/mixed",
CharSet = null
}.ToString());
this.SendData(string.Empty);
Attachment attachment = null;
if (message.AlternateViews.Count > 0)
{
this.SendWithoutAttachments(message, text, true);
}
else
{
attachment = Attachment.CreateAttachmentFromString(message.Body, null, message.BodyEncoding, (!message.IsBodyHtml) ? "text/plain" : "text/html");
message.Attachments.Insert(0, attachment);
}
try
{
this.SendAttachments(message, attachment, text);
}
finally
{
if (attachment != null)
{
message.Attachments.Remove(attachment);
}
}
this.EndSection(text);
}
// Token: 0x06000B3C RID: 2876 RVA: 0x000221F8 File Offset: 0x000203F8
private void SendBodyWithAlternateViews(MailMessage message, string boundary, bool attachmentExists)
{
AlternateViewCollection alternateViews = message.AlternateViews;
string text = this.GenerateBoundary();
global::System.Net.Mime.ContentType contentType = new global::System.Net.Mime.ContentType();
contentType.Boundary = text;
contentType.MediaType = "multipart/alternative";
if (!attachmentExists)
{
this.SendHeader("Content-Type", contentType.ToString());
this.SendData(string.Empty);
}
AlternateView alternateView = null;
if (message.Body != null)
{
alternateView = AlternateView.CreateAlternateViewFromString(message.Body, message.BodyEncoding, (!message.IsBodyHtml) ? "text/plain" : "text/html");
alternateViews.Insert(0, alternateView);
this.StartSection(boundary, contentType);
}
try
{
foreach (AlternateView alternateView2 in alternateViews)
{
string text2 = null;
if (alternateView2.LinkedResources.Count > 0)
{
text2 = this.GenerateBoundary();
global::System.Net.Mime.ContentType contentType2 = new global::System.Net.Mime.ContentType("multipart/related");
contentType2.Boundary = text2;
contentType2.Parameters["type"] = alternateView2.ContentType.ToString();
this.StartSection(text, contentType2);
this.StartSection(text2, alternateView2.ContentType, alternateView2.TransferEncoding);
}
else
{
global::System.Net.Mime.ContentType contentType2 = new global::System.Net.Mime.ContentType(alternateView2.ContentType.ToString());
this.StartSection(text, contentType2, alternateView2.TransferEncoding);
}
global::System.Net.Mime.TransferEncoding transferEncoding = alternateView2.TransferEncoding;
switch (transferEncoding + 1)
{
case global::System.Net.Mime.TransferEncoding.QuotedPrintable:
case (global::System.Net.Mime.TransferEncoding)3:
{
byte[] array = new byte[alternateView2.ContentStream.Length];
alternateView2.ContentStream.Read(array, 0, array.Length);
this.SendData(Encoding.ASCII.GetString(array));
break;
}
case global::System.Net.Mime.TransferEncoding.Base64:
{
byte[] array2 = new byte[alternateView2.ContentStream.Length];
alternateView2.ContentStream.Read(array2, 0, array2.Length);
this.SendData(this.ToQuotedPrintable(array2));
break;
}
case global::System.Net.Mime.TransferEncoding.SevenBit:
{
byte[] array = new byte[alternateView2.ContentStream.Length];
alternateView2.ContentStream.Read(array, 0, array.Length);
this.SendData(Convert.ToBase64String(array, Base64FormattingOptions.InsertLineBreaks));
break;
}
}
if (alternateView2.LinkedResources.Count > 0)
{
this.SendLinkedResources(message, alternateView2.LinkedResources, text2);
this.EndSection(text2);
}
if (!attachmentExists)
{
this.SendData(string.Empty);
}
}
}
finally
{
if (alternateView != null)
{
alternateViews.Remove(alternateView);
}
}
this.EndSection(text);
}
// Token: 0x06000B3D RID: 2877 RVA: 0x000224C8 File Offset: 0x000206C8
private void SendLinkedResources(MailMessage message, LinkedResourceCollection resources, string boundary)
{
foreach (LinkedResource linkedResource in resources)
{
this.StartSection(boundary, linkedResource.ContentType, linkedResource.TransferEncoding, linkedResource);
global::System.Net.Mime.TransferEncoding transferEncoding = linkedResource.TransferEncoding;
switch (transferEncoding + 1)
{
case global::System.Net.Mime.TransferEncoding.QuotedPrintable:
case (global::System.Net.Mime.TransferEncoding)3:
{
byte[] array = new byte[linkedResource.ContentStream.Length];
linkedResource.ContentStream.Read(array, 0, array.Length);
this.SendData(Encoding.ASCII.GetString(array));
break;
}
case global::System.Net.Mime.TransferEncoding.Base64:
{
byte[] array2 = new byte[linkedResource.ContentStream.Length];
linkedResource.ContentStream.Read(array2, 0, array2.Length);
this.SendData(this.ToQuotedPrintable(array2));
break;
}
case global::System.Net.Mime.TransferEncoding.SevenBit:
{
byte[] array = new byte[linkedResource.ContentStream.Length];
linkedResource.ContentStream.Read(array, 0, array.Length);
this.SendData(Convert.ToBase64String(array, Base64FormattingOptions.InsertLineBreaks));
break;
}
}
}
}
// Token: 0x06000B3E RID: 2878 RVA: 0x000225FC File Offset: 0x000207FC
private void SendAttachments(MailMessage message, Attachment body, string boundary)
{
foreach (Attachment attachment in message.Attachments)
{
global::System.Net.Mime.ContentType contentType = new global::System.Net.Mime.ContentType(attachment.ContentType.ToString());
if (attachment.Name != null)
{
contentType.Name = attachment.Name;
if (attachment.NameEncoding != null)
{
contentType.CharSet = attachment.NameEncoding.HeaderName;
}
attachment.ContentDisposition.FileName = attachment.Name;
}
this.StartSection(boundary, contentType, attachment.TransferEncoding, (attachment != body) ? attachment.ContentDisposition : null);
byte[] array = new byte[attachment.ContentStream.Length];
attachment.ContentStream.Read(array, 0, array.Length);
global::System.Net.Mime.TransferEncoding transferEncoding = attachment.TransferEncoding;
switch (transferEncoding + 1)
{
case global::System.Net.Mime.TransferEncoding.QuotedPrintable:
case (global::System.Net.Mime.TransferEncoding)3:
this.SendData(Encoding.ASCII.GetString(array));
break;
case global::System.Net.Mime.TransferEncoding.Base64:
this.SendData(this.ToQuotedPrintable(array));
break;
case global::System.Net.Mime.TransferEncoding.SevenBit:
this.SendData(Convert.ToBase64String(array, Base64FormattingOptions.InsertLineBreaks));
break;
}
this.SendData(string.Empty);
}
}
// Token: 0x06000B3F RID: 2879 RVA: 0x0002275C File Offset: 0x0002095C
private SmtpClient.SmtpResponse SendCommand(string command)
{
this.writer.Write(command);
this.writer.Write("\r\n");
this.writer.Flush();
return this.Read();
}
// Token: 0x06000B40 RID: 2880 RVA: 0x00022798 File Offset: 0x00020998
private void SendHeader(string name, string value)
{
this.SendData(string.Format("{0}: {1}", name, value));
}
// Token: 0x06000B41 RID: 2881 RVA: 0x000227AC File Offset: 0x000209AC
private void StartSection(string section, global::System.Net.Mime.ContentType sectionContentType)
{
this.SendData(string.Format("--{0}", section));
this.SendHeader("content-type", sectionContentType.ToString());
this.SendData(string.Empty);
}
// Token: 0x06000B42 RID: 2882 RVA: 0x000227E8 File Offset: 0x000209E8
private void StartSection(string section, global::System.Net.Mime.ContentType sectionContentType, global::System.Net.Mime.TransferEncoding transferEncoding)
{
this.SendData(string.Format("--{0}", section));
this.SendHeader("content-type", sectionContentType.ToString());
this.SendHeader("content-transfer-encoding", SmtpClient.GetTransferEncodingName(transferEncoding));
this.SendData(string.Empty);
}
// Token: 0x06000B43 RID: 2883 RVA: 0x00022834 File Offset: 0x00020A34
private void StartSection(string section, global::System.Net.Mime.ContentType sectionContentType, global::System.Net.Mime.TransferEncoding transferEncoding, LinkedResource lr)
{
this.SendData(string.Format("--{0}", section));
this.SendHeader("content-type", sectionContentType.ToString());
this.SendHeader("content-transfer-encoding", SmtpClient.GetTransferEncodingName(transferEncoding));
if (lr.ContentId != null && lr.ContentId.Length > 0)
{
this.SendHeader("content-ID", "<" + lr.ContentId + ">");
}
this.SendData(string.Empty);
}
// Token: 0x06000B44 RID: 2884 RVA: 0x000228C0 File Offset: 0x00020AC0
private void StartSection(string section, global::System.Net.Mime.ContentType sectionContentType, global::System.Net.Mime.TransferEncoding transferEncoding, global::System.Net.Mime.ContentDisposition contentDisposition)
{
this.SendData(string.Format("--{0}", section));
this.SendHeader("content-type", sectionContentType.ToString());
this.SendHeader("content-transfer-encoding", SmtpClient.GetTransferEncodingName(transferEncoding));
if (contentDisposition != null)
{
this.SendHeader("content-disposition", contentDisposition.ToString());
}
this.SendData(string.Empty);
}
// Token: 0x06000B45 RID: 2885 RVA: 0x00022924 File Offset: 0x00020B24
private string ToQuotedPrintable(string input, Encoding enc)
{
byte[] bytes = enc.GetBytes(input);
return this.ToQuotedPrintable(bytes);
}
// Token: 0x06000B46 RID: 2886 RVA: 0x00022940 File Offset: 0x00020B40
private string ToQuotedPrintable(byte[] bytes)
{
StringWriter stringWriter = new StringWriter();
int num = 0;
StringBuilder stringBuilder = new StringBuilder("=", 3);
byte b = 61;
char c = '\0';
int i = 0;
while (i < bytes.Length)
{
byte b2 = bytes[i];
int num2;
if (b2 > 127 || b2 == b)
{
stringBuilder.Length = 1;
stringBuilder.Append(Convert.ToString(b2, 16).ToUpperInvariant());
num2 = 3;
goto IL_8E;
}
c = Convert.ToChar(b2);
if (c != '\r' && c != '\n')
{
num2 = 1;
goto IL_8E;
}
stringWriter.Write(c);
num = 0;
IL_C7:
i++;
continue;
IL_8E:
num += num2;
if (num > 75)
{
stringWriter.Write("=\r\n");
num = num2;
}
if (num2 == 1)
{
stringWriter.Write(c);
goto IL_C7;
}
stringWriter.Write(stringBuilder.ToString());
goto IL_C7;
}
return stringWriter.ToString();
}
// Token: 0x06000B47 RID: 2887 RVA: 0x00022A2C File Offset: 0x00020C2C
private static string GetTransferEncodingName(global::System.Net.Mime.TransferEncoding encoding)
{
switch (encoding)
{
case global::System.Net.Mime.TransferEncoding.QuotedPrintable:
return "quoted-printable";
case global::System.Net.Mime.TransferEncoding.Base64:
return "base64";
case global::System.Net.Mime.TransferEncoding.SevenBit:
return "7bit";
default:
return "unknown";
}
}
// Token: 0x06000B48 RID: 2888 RVA: 0x00022A6C File Offset: 0x00020C6C
private void InitiateSecureConnection()
{
SmtpClient.SmtpResponse smtpResponse = this.SendCommand("STARTTLS");
if (this.IsError(smtpResponse))
{
throw new SmtpException(SmtpStatusCode.GeneralFailure, "Server does not support secure connections.");
}
global::System.Net.Security.SslStream sslStream = new global::System.Net.Security.SslStream(this.stream, false, this.callback, null);
this.CheckCancellation();
sslStream.AuthenticateAsClient(this.Host, this.ClientCertificates, global::System.Security.Authentication.SslProtocols.Default, false);
this.stream = sslStream;
}
// Token: 0x06000B49 RID: 2889 RVA: 0x00022AD8 File Offset: 0x00020CD8
private void Authenticate()
{
string text;
string text2;
if (this.UseDefaultCredentials)
{
text = CredentialCache.DefaultCredentials.GetCredential(new global::System.Uri("smtp://" + this.host), "basic").UserName;
text2 = CredentialCache.DefaultCredentials.GetCredential(new global::System.Uri("smtp://" + this.host), "basic").Password;
}
else
{
if (this.Credentials == null)
{
return;
}
text = this.Credentials.GetCredential(this.host, this.port, "smtp").UserName;
text2 = this.Credentials.GetCredential(this.host, this.port, "smtp").Password;
}
this.Authenticate(text, text2);
}
// Token: 0x06000B4A RID: 2890 RVA: 0x00022BAC File Offset: 0x00020DAC
private void Authenticate(string Username, string Password)
{
SmtpClient.SmtpResponse smtpResponse = this.SendCommand("AUTH LOGIN");
if (smtpResponse.StatusCode != (SmtpStatusCode)334)
{
throw new SmtpException(smtpResponse.StatusCode, smtpResponse.Description);
}
smtpResponse = this.SendCommand(Convert.ToBase64String(Encoding.ASCII.GetBytes(Username)));
if (smtpResponse.StatusCode != (SmtpStatusCode)334)
{
throw new SmtpException(smtpResponse.StatusCode, smtpResponse.Description);
}
smtpResponse = this.SendCommand(Convert.ToBase64String(Encoding.ASCII.GetBytes(Password)));
if (this.IsError(smtpResponse))
{
throw new SmtpException(smtpResponse.StatusCode, smtpResponse.Description);
}
}
// Token: 0x04000B22 RID: 2850
private string host;
// Token: 0x04000B23 RID: 2851
private int port;
// Token: 0x04000B24 RID: 2852
private int timeout = 100000;
// Token: 0x04000B25 RID: 2853
private ICredentialsByHost credentials;
// Token: 0x04000B26 RID: 2854
private string pickupDirectoryLocation;
// Token: 0x04000B27 RID: 2855
private SmtpDeliveryMethod deliveryMethod;
// Token: 0x04000B28 RID: 2856
private bool enableSsl;
// Token: 0x04000B29 RID: 2857
private global::System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates;
// Token: 0x04000B2A RID: 2858
private global::System.Net.Sockets.TcpClient client;
// Token: 0x04000B2B RID: 2859
private Stream stream;
// Token: 0x04000B2C RID: 2860
private StreamWriter writer;
// Token: 0x04000B2D RID: 2861
private StreamReader reader;
// Token: 0x04000B2E RID: 2862
private int boundaryIndex;
// Token: 0x04000B2F RID: 2863
private MailAddress defaultFrom;
// Token: 0x04000B30 RID: 2864
private MailMessage messageInProcess;
// Token: 0x04000B31 RID: 2865
private global::System.ComponentModel.BackgroundWorker worker;
// Token: 0x04000B32 RID: 2866
private object user_async_state;
// Token: 0x04000B33 RID: 2867
private SmtpClient.AuthMechs authMechs;
// Token: 0x04000B34 RID: 2868
private Mutex mutex = new Mutex();
// Token: 0x04000B35 RID: 2869
private global::System.Net.Security.RemoteCertificateValidationCallback callback = delegate(object sender, X509Certificate certificate, global::System.Security.Cryptography.X509Certificates.X509Chain chain, global::System.Net.Security.SslPolicyErrors sslPolicyErrors)
{
if (ServicePointManager.ServerCertificateValidationCallback != null)
{
return ServicePointManager.ServerCertificateValidationCallback(sender, certificate, chain, sslPolicyErrors);
}
if (sslPolicyErrors != global::System.Net.Security.SslPolicyErrors.None)
{
throw new InvalidOperationException("SSL authentication error: " + sslPolicyErrors);
}
return true;
};
// Token: 0x02000144 RID: 324
[Flags]
private enum AuthMechs
{
// Token: 0x04000B3B RID: 2875
None = 0,
// Token: 0x04000B3C RID: 2876
CramMD5 = 1,
// Token: 0x04000B3D RID: 2877
DigestMD5 = 2,
// Token: 0x04000B3E RID: 2878
GssAPI = 4,
// Token: 0x04000B3F RID: 2879
Kerberos4 = 8,
// Token: 0x04000B40 RID: 2880
Login = 16,
// Token: 0x04000B41 RID: 2881
Plain = 32
}
// Token: 0x02000145 RID: 325
private class CancellationException : Exception
{
}
// Token: 0x02000146 RID: 326
private struct HeaderName
{
// Token: 0x04000B42 RID: 2882
public const string ContentTransferEncoding = "Content-Transfer-Encoding";
// Token: 0x04000B43 RID: 2883
public const string ContentType = "Content-Type";
// Token: 0x04000B44 RID: 2884
public const string Bcc = "Bcc";
// Token: 0x04000B45 RID: 2885
public const string Cc = "Cc";
// Token: 0x04000B46 RID: 2886
public const string From = "From";
// Token: 0x04000B47 RID: 2887
public const string Subject = "Subject";
// Token: 0x04000B48 RID: 2888
public const string To = "To";
// Token: 0x04000B49 RID: 2889
public const string MimeVersion = "MIME-Version";
// Token: 0x04000B4A RID: 2890
public const string MessageId = "Message-ID";
// Token: 0x04000B4B RID: 2891
public const string Priority = "Priority";
// Token: 0x04000B4C RID: 2892
public const string Importance = "Importance";
// Token: 0x04000B4D RID: 2893
public const string XPriority = "X-Priority";
// Token: 0x04000B4E RID: 2894
public const string Date = "Date";
}
// Token: 0x02000147 RID: 327
private struct SmtpResponse
{
// Token: 0x06000B4D RID: 2893 RVA: 0x00022CAC File Offset: 0x00020EAC
public static SmtpClient.SmtpResponse Parse(string line)
{
SmtpClient.SmtpResponse smtpResponse = default(SmtpClient.SmtpResponse);
if (line.Length < 4)
{
throw new SmtpException("Response is to short " + line.Length + ".");
}
if (line[3] != ' ' && line[3] != '-')
{
throw new SmtpException("Response format is wrong.(" + line + ")");
}
smtpResponse.StatusCode = (SmtpStatusCode)int.Parse(line.Substring(0, 3));
smtpResponse.Description = line;
return smtpResponse;
}
// Token: 0x04000B4F RID: 2895
public SmtpStatusCode StatusCode;
// Token: 0x04000B50 RID: 2896
public string Description;
}
}
}
+19
View File
@@ -0,0 +1,19 @@
using System;
namespace System.Net.Mail
{
/// <summary>Specifies how email messages are delivered.</summary>
// Token: 0x02000149 RID: 329
public enum SmtpDeliveryMethod
{
/// <summary>Email is sent through the network to an SMTP server.</summary>
// Token: 0x04000B54 RID: 2900
Network,
/// <summary>Email is copied to the directory specified by the <see cref="P:System.Net.Mail.SmtpClient.PickupDirectoryLocation" /> property for delivery by an external application.</summary>
// Token: 0x04000B55 RID: 2901
SpecifiedPickupDirectory,
/// <summary>Email is copied to the pickup directory used by a local Internet Information Services (IIS) for delivery.</summary>
// Token: 0x04000B56 RID: 2902
PickupDirectoryFromIis
}
}
+114
View File
@@ -0,0 +1,114 @@
using System;
using System.Runtime.Serialization;
namespace System.Net.Mail
{
/// <summary>Represents the exception that is thrown when the <see cref="T:System.Net.Mail.SmtpClient" /> is not able to complete a <see cref="Overload:System.Net.Mail.SmtpClient.Send" /> or <see cref="Overload:System.Net.Mail.SmtpClient.SendAsync" /> operation.</summary>
// Token: 0x0200014A RID: 330
[Serializable]
public class SmtpException : Exception, ISerializable
{
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpException" /> class. </summary>
// Token: 0x06000B50 RID: 2896 RVA: 0x00022D68 File Offset: 0x00020F68
public SmtpException()
: this(SmtpStatusCode.GeneralFailure)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpException" /> class with the specified status code.</summary>
/// <param name="statusCode">An <see cref="T:System.Net.Mail.SmtpStatusCode" /> value.</param>
// Token: 0x06000B51 RID: 2897 RVA: 0x00022D74 File Offset: 0x00020F74
public SmtpException(SmtpStatusCode statusCode)
: this(statusCode, "Syntax error, command unrecognized.")
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpException" /> class with the specified error message.</summary>
/// <param name="message">A <see cref="T:System.String" /> that describes the error that occurred.</param>
// Token: 0x06000B52 RID: 2898 RVA: 0x00022D84 File Offset: 0x00020F84
public SmtpException(string message)
: this(SmtpStatusCode.GeneralFailure, message)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpException" /> class from the specified instances of the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> and <see cref="T:System.Runtime.Serialization.StreamingContext" /> classes. </summary>
/// <param name="serializationInfo">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that contains the information required to serialize the new <see cref="T:System.Net.Mail.SmtpException" />. </param>
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains the source and destination of the serialized stream associated with the new instance. </param>
// Token: 0x06000B53 RID: 2899 RVA: 0x00022D90 File Offset: 0x00020F90
protected SmtpException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
try
{
this.statusCode = (SmtpStatusCode)((int)info.GetValue("Status", typeof(int)));
}
catch (SerializationException)
{
this.statusCode = (SmtpStatusCode)((int)info.GetValue("statusCode", typeof(SmtpStatusCode)));
}
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpException" /> class with the specified status code and error message.</summary>
/// <param name="statusCode">An <see cref="T:System.Net.Mail.SmtpStatusCode" /> value.</param>
/// <param name="message">A <see cref="T:System.String" /> that describes the error that occurred.</param>
// Token: 0x06000B54 RID: 2900 RVA: 0x00022E0C File Offset: 0x0002100C
public SmtpException(SmtpStatusCode statusCode, string message)
: base(message)
{
this.statusCode = statusCode;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpException" /> class with the specified error message and inner exception.</summary>
/// <param name="message">A <see cref="T:System.String" /> that describes the error that occurred.</param>
/// <param name="innerException">The exception that is the cause of the current exception. </param>
// Token: 0x06000B55 RID: 2901 RVA: 0x00022E1C File Offset: 0x0002101C
public SmtpException(string message, Exception innerException)
: base(message, innerException)
{
this.statusCode = SmtpStatusCode.GeneralFailure;
}
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> instance with the data needed to serialize the <see cref="T:System.Net.Mail.SmtpException" />.</summary>
/// <param name="serializationInfo">A <see cref="T:System.Runtime.Serialization.SerializationInfo" />, which holds the serialized data for the <see cref="T:System.Net.Mail.SmtpException" />. </param>
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains the destination of the serialized stream associated with the new <see cref="T:System.Net.Mail.SmtpException" />. </param>
// Token: 0x06000B56 RID: 2902 RVA: 0x00022E30 File Offset: 0x00021030
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
this.GetObjectData(info, context);
}
/// <summary>Gets the status code returned by an SMTP server when an e-mail message is transmitted.</summary>
/// <returns>An <see cref="T:System.Net.Mail.SmtpStatusCode" /> value that indicates the error that occurred.</returns>
// Token: 0x170002D8 RID: 728
// (get) Token: 0x06000B57 RID: 2903 RVA: 0x00022E3C File Offset: 0x0002103C
// (set) Token: 0x06000B58 RID: 2904 RVA: 0x00022E44 File Offset: 0x00021044
public SmtpStatusCode StatusCode
{
get
{
return this.statusCode;
}
set
{
this.statusCode = value;
}
}
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> instance with the data needed to serialize the <see cref="T:System.Net.Mail.SmtpException" />.</summary>
/// <param name="serializationInfo">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> to populate with data. </param>
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> that specifies the destination for this serialization.</param>
// Token: 0x06000B59 RID: 2905 RVA: 0x00022E50 File Offset: 0x00021050
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException("info");
}
base.GetObjectData(info, context);
info.AddValue("Status", this.statusCode, typeof(int));
}
// Token: 0x04000B57 RID: 2903
private SmtpStatusCode statusCode;
}
}
@@ -0,0 +1,118 @@
using System;
using System.Runtime.Serialization;
namespace System.Net.Mail
{
/// <summary>Represents the exception that is thrown when the <see cref="T:System.Net.Mail.SmtpClient" /> is not able to complete a <see cref="Overload:System.Net.Mail.SmtpClient.Send" /> or <see cref="Overload:System.Net.Mail.SmtpClient.SendAsync" /> operation to a particular recipient.</summary>
// Token: 0x0200014B RID: 331
[Serializable]
public class SmtpFailedRecipientException : SmtpException, ISerializable
{
/// <summary>Initializes an empty instance of the <see cref="T:System.Net.Mail.SmtpFailedRecipientException" /> class.</summary>
// Token: 0x06000B5A RID: 2906 RVA: 0x00022E8C File Offset: 0x0002108C
public SmtpFailedRecipientException()
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpFailedRecipientException" /> class with the specified error message.</summary>
/// <param name="message">A <see cref="T:System.String" /> that contains the error message.</param>
// Token: 0x06000B5B RID: 2907 RVA: 0x00022E94 File Offset: 0x00021094
public SmtpFailedRecipientException(string message)
: base(message)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpFailedRecipientException" /> class from the specified instances of the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> and <see cref="T:System.Runtime.Serialization.StreamingContext" /> classes.</summary>
/// <param name="info">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that contains the information required to serialize the new <see cref="T:System.Net.Mail.SmtpFailedRecipientException" />. </param>
/// <param name="context">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains the source and destination of the serialized stream that is associated with the new instance. </param>
// Token: 0x06000B5C RID: 2908 RVA: 0x00022EA0 File Offset: 0x000210A0
protected SmtpFailedRecipientException(SerializationInfo serializationInfo, StreamingContext streamingContext)
: base(serializationInfo, streamingContext)
{
if (serializationInfo == null)
{
throw new ArgumentNullException("serializationInfo");
}
this.failedRecipient = serializationInfo.GetString("failedRecipient");
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpFailedRecipientException" /> class with the specified status code and e-mail address.</summary>
/// <param name="statusCode">An <see cref="T:System.Net.Mail.SmtpStatusCode" /> value.</param>
/// <param name="failedRecipient">A <see cref="T:System.String" /> that contains the e-mail address.</param>
// Token: 0x06000B5D RID: 2909 RVA: 0x00022ED8 File Offset: 0x000210D8
public SmtpFailedRecipientException(SmtpStatusCode statusCode, string failedRecipient)
: base(statusCode)
{
this.failedRecipient = failedRecipient;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpException" /> class with the specified error message and inner exception.</summary>
/// <param name="message">A <see cref="T:System.String" /> that describes the error that occurred.</param>
/// <param name="innerException">The exception that is the cause of the current exception. </param>
// Token: 0x06000B5E RID: 2910 RVA: 0x00022EE8 File Offset: 0x000210E8
public SmtpFailedRecipientException(string message, Exception innerException)
: base(message, innerException)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpException" /> class with the specified error message, e-mail address, and inner exception.</summary>
/// <param name="message">A <see cref="T:System.String" /> that describes the error that occurred.</param>
/// <param name="failedRecipient">A <see cref="T:System.String" /> that contains the e-mail address.</param>
/// <param name="innerException">The exception that is the cause of the current exception.</param>
// Token: 0x06000B5F RID: 2911 RVA: 0x00022EF4 File Offset: 0x000210F4
public SmtpFailedRecipientException(string message, string failedRecipient, Exception innerException)
: base(message, innerException)
{
this.failedRecipient = failedRecipient;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpFailedRecipientException" /> class with the specified status code, e-mail address, and server response.</summary>
/// <param name="statusCode">An <see cref="T:System.Net.Mail.SmtpStatusCode" /> value.</param>
/// <param name="failedRecipient">A <see cref="T:System.String" /> that contains the e-mail address.</param>
/// <param name="serverResponse">A <see cref="T:System.String" /> that contains the server response.</param>
// Token: 0x06000B60 RID: 2912 RVA: 0x00022F08 File Offset: 0x00021108
public SmtpFailedRecipientException(SmtpStatusCode statusCode, string failedRecipient, string serverResponse)
: base(statusCode, serverResponse)
{
this.failedRecipient = failedRecipient;
}
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> instance with the data that is needed to serialize the <see cref="T:System.Net.Mail.SmtpFailedRecipientException" />.</summary>
/// <param name="serializationInfo">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> instance, which holds the serialized data for the <see cref="T:System.Net.Mail.SmtpFailedRecipientException" />. </param>
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> instance that contains the destination of the serialized stream that is associated with the new <see cref="T:System.Net.Mail.SmtpFailedRecipientException" />. </param>
// Token: 0x06000B61 RID: 2913 RVA: 0x00022F1C File Offset: 0x0002111C
void ISerializable.GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
this.GetObjectData(serializationInfo, streamingContext);
}
/// <summary>Indicates the e-mail address with delivery difficulties.</summary>
/// <returns>A <see cref="T:System.String" /> that contains the e-mail address.</returns>
// Token: 0x170002D9 RID: 729
// (get) Token: 0x06000B62 RID: 2914 RVA: 0x00022F28 File Offset: 0x00021128
public string FailedRecipient
{
get
{
return this.failedRecipient;
}
}
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> instance with the data that is needed to serialize the <see cref="T:System.Net.Mail.SmtpFailedRecipientException" />.</summary>
/// <param name="serializationInfo">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> to populate with data. </param>
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> that specifies the destination for this serialization.</param>
// Token: 0x06000B63 RID: 2915 RVA: 0x00022F30 File Offset: 0x00021130
public override void GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
if (serializationInfo == null)
{
throw new ArgumentNullException("serializationInfo");
}
base.GetObjectData(serializationInfo, streamingContext);
serializationInfo.AddValue("failedRecipient", this.failedRecipient);
}
// Token: 0x04000B58 RID: 2904
private string failedRecipient;
}
}
@@ -0,0 +1,96 @@
using System;
using System.Runtime.Serialization;
namespace System.Net.Mail
{
/// <summary>The exception that is thrown when e-mail is sent using an <see cref="T:System.Net.Mail.SmtpClient" /> and cannot be delivered to all recipients.</summary>
// Token: 0x0200014C RID: 332
[Serializable]
public class SmtpFailedRecipientsException : SmtpFailedRecipientException, ISerializable
{
/// <summary>Initializes an empty instance of the <see cref="T:System.Net.Mail.SmtpFailedRecipientsException" /> class.</summary>
// Token: 0x06000B64 RID: 2916 RVA: 0x00022F68 File Offset: 0x00021168
public SmtpFailedRecipientsException()
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpFailedRecipientsException" /> class with the specified <see cref="T:System.String" />.</summary>
/// <param name="message">The exception message.</param>
// Token: 0x06000B65 RID: 2917 RVA: 0x00022F70 File Offset: 0x00021170
public SmtpFailedRecipientsException(string message)
: base(message)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpFailedRecipientsException" /> class with the specified <see cref="T:System.String" /> and inner <see cref="T:System.Exception" />.</summary>
/// <param name="message">The exception message.</param>
/// <param name="innerException">The inner exception.</param>
// Token: 0x06000B66 RID: 2918 RVA: 0x00022F7C File Offset: 0x0002117C
public SmtpFailedRecipientsException(string message, Exception innerException)
: base(message, innerException)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpFailedRecipientsException" /> class with the specified <see cref="T:System.String" /> and array of type <see cref="T:System.Net.Mail.SmtpFailedRecipientException" />.</summary>
/// <param name="message">The exception message.</param>
/// <param name="innerExceptions">The array of recipients with delivery errors.</param>
// Token: 0x06000B67 RID: 2919 RVA: 0x00022F88 File Offset: 0x00021188
public SmtpFailedRecipientsException(string message, SmtpFailedRecipientException[] innerExceptions)
: base(message)
{
this.innerExceptions = innerExceptions;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpFailedRecipientsException" /> class from the specified instances of the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> and <see cref="T:System.Runtime.Serialization.StreamingContext" /> classes.</summary>
/// <param name="info">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> instance that contains the information required to serialize the new <see cref="T:System.Net.Mail.SmtpFailedRecipientsException" /> instance. </param>
/// <param name="context">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains the source of the serialized stream that is associated with the new <see cref="T:System.Net.Mail.SmtpFailedRecipientsException" /> instance. </param>
// Token: 0x06000B68 RID: 2920 RVA: 0x00022F98 File Offset: 0x00021198
protected SmtpFailedRecipientsException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
if (info == null)
{
throw new ArgumentNullException("info");
}
this.innerExceptions = (SmtpFailedRecipientException[])info.GetValue("innerExceptions", typeof(SmtpFailedRecipientException[]));
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.SmtpFailedRecipientsException" /> class from the specified <see cref="T:System.Runtime.Serialization.SerializationInfo" /> and <see cref="T:System.Runtime.Serialization.StreamingContext" /> instances.</summary>
/// <param name="serializationInfo">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that contains the information required to serialize the new <see cref="T:System.Net.Mail.SmtpFailedRecipientsException" />. </param>
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains the source of the serialized stream that is associated with the new <see cref="T:System.Net.Mail.SmtpFailedRecipientsException" />. </param>
// Token: 0x06000B69 RID: 2921 RVA: 0x00022FD4 File Offset: 0x000211D4
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
this.GetObjectData(info, context);
}
/// <summary>Gets one or more <see cref="T:System.Net.Mail.SmtpFailedRecipientException" />s that indicate the e-mail recipients with SMTP delivery errors.</summary>
/// <returns>An array of type <see cref="T:System.Net.Mail.SmtpFailedRecipientException" /> that lists the recipients with delivery errors.</returns>
// Token: 0x170002DA RID: 730
// (get) Token: 0x06000B6A RID: 2922 RVA: 0x00022FE0 File Offset: 0x000211E0
public SmtpFailedRecipientException[] InnerExceptions
{
get
{
return this.innerExceptions;
}
}
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> instance with the data that is needed to serialize the <see cref="T:System.Net.Mail.SmtpFailedRecipientsException" />.</summary>
/// <param name="serializationInfo">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> to be used. </param>
/// <param name="streamingContext">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> to be used. </param>
// Token: 0x06000B6B RID: 2923 RVA: 0x00022FE8 File Offset: 0x000211E8
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException("info");
}
base.GetObjectData(info, context);
info.AddValue("innerExceptions", this.innerExceptions);
}
// Token: 0x04000B59 RID: 2905
private SmtpFailedRecipientException[] innerExceptions;
}
}
+85
View File
@@ -0,0 +1,85 @@
using System;
namespace System.Net.Mail
{
/// <summary>Specifies the outcome of sending e-mail by using the <see cref="T:System.Net.Mail.SmtpClient" /> class.</summary>
// Token: 0x0200014D RID: 333
public enum SmtpStatusCode
{
/// <summary>The commands were sent in the incorrect sequence.</summary>
// Token: 0x04000B5B RID: 2907
BadCommandSequence = 503,
/// <summary>The specified user is not local, but the receiving SMTP service accepted the message and attempted to deliver it. This status code is defined in RFC 1123, which is available at http://www.ietf.org.</summary>
// Token: 0x04000B5C RID: 2908
CannotVerifyUserWillAttemptDelivery = 252,
/// <summary>The client was not authenticated or is not allowed to send mail using the specified SMTP host.</summary>
// Token: 0x04000B5D RID: 2909
ClientNotPermitted = 454,
/// <summary>The SMTP service does not implement the specified command.</summary>
// Token: 0x04000B5E RID: 2910
CommandNotImplemented = 502,
/// <summary>The SMTP service does not implement the specified command parameter.</summary>
// Token: 0x04000B5F RID: 2911
CommandParameterNotImplemented = 504,
/// <summary>The SMTP service does not recognize the specified command.</summary>
// Token: 0x04000B60 RID: 2912
CommandUnrecognized = 500,
/// <summary>The message is too large to be stored in the destination mailbox.</summary>
// Token: 0x04000B61 RID: 2913
ExceededStorageAllocation = 552,
/// <summary>The transaction could not occur. You receive this error when the specified SMTP host cannot be found.</summary>
// Token: 0x04000B62 RID: 2914
GeneralFailure = -1,
/// <summary>A Help message was returned by the service.</summary>
// Token: 0x04000B63 RID: 2915
HelpMessage = 214,
/// <summary>The SMTP service does not have sufficient storage to complete the request.</summary>
// Token: 0x04000B64 RID: 2916
InsufficientStorage = 452,
/// <summary>The SMTP service cannot complete the request. This error can occur if the client's IP address cannot be resolved (that is, a reverse lookup failed). You can also receive this error if the client domain has been identified as an open relay or source for unsolicited e-mail (spam). For details, see RFC 2505, which is available at http://www.ietf.org.</summary>
// Token: 0x04000B65 RID: 2917
LocalErrorInProcessing = 451,
/// <summary>The destination mailbox is in use.</summary>
// Token: 0x04000B66 RID: 2918
MailboxBusy = 450,
/// <summary>The syntax used to specify the destination mailbox is incorrect.</summary>
// Token: 0x04000B67 RID: 2919
MailboxNameNotAllowed = 553,
/// <summary>The destination mailbox was not found or could not be accessed.</summary>
// Token: 0x04000B68 RID: 2920
MailboxUnavailable = 550,
/// <summary>The email was successfully sent to the SMTP service.</summary>
// Token: 0x04000B69 RID: 2921
Ok = 250,
/// <summary>The SMTP service is closing the transmission channel.</summary>
// Token: 0x04000B6A RID: 2922
ServiceClosingTransmissionChannel = 221,
/// <summary>The SMTP service is not available; the server is closing the transmission channel.</summary>
// Token: 0x04000B6B RID: 2923
ServiceNotAvailable = 421,
/// <summary>The SMTP service is ready.</summary>
// Token: 0x04000B6C RID: 2924
ServiceReady = 220,
/// <summary>The SMTP service is ready to receive the e-mail content.</summary>
// Token: 0x04000B6D RID: 2925
StartMailInput = 354,
/// <summary>The syntax used to specify a command or parameter is incorrect.</summary>
// Token: 0x04000B6E RID: 2926
SyntaxError = 501,
/// <summary>A system status or system Help reply.</summary>
// Token: 0x04000B6F RID: 2927
SystemStatus = 211,
/// <summary>The transaction failed.</summary>
// Token: 0x04000B70 RID: 2928
TransactionFailed = 554,
/// <summary>The user mailbox is not located on the receiving server. You should resend using the supplied address information.</summary>
// Token: 0x04000B71 RID: 2929
UserNotLocalTryAlternatePath = 551,
/// <summary>The user mailbox is not located on the receiving server; the server forwards the e-mail.</summary>
// Token: 0x04000B72 RID: 2930
UserNotLocalWillForward = 251,
/// <summary>The SMTP server is configured to accept only TLS connections, and the SMTP client is attempting to connect by using a non-TLS connection. The solution is for the user to set EnableSsl=true on the SMTP Client.</summary>
// Token: 0x04000B73 RID: 2931
MustIssueStartTlsFirst = 530
}
}

Some files were not shown because too many files have changed in this diff Show More