Files
2026-06-04 11:42:34 +02:00

2328 lines
92 KiB
C#

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;
}
}