296 lines
10 KiB
C#
296 lines
10 KiB
C#
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;
|
|
}
|
|
}
|