using Apewer; using Apewer.Internals; using System; using System.Collections.Generic; using System.IO; using System.Net; using System.Text; namespace Apewer.Network { /// <summary></summary> public class HttpResponse { // ======================================== internal TextSet _properties = new TextSet(true); internal TextSet _headers = new TextSet(true); internal Action<Int64> _progress = null; internal Stream _stream = null; internal byte[] _data = Constant.EmptyBytes; internal long _contentlength = 0L; internal bool _locked = false; internal int _timeout = 0; // ---------------------------------------- internal bool _cached = false; internal CookieCollection _cookies = null; internal HttpStatusCode _statuscode = 0; // ======================================== /// <summary></summary> public TextSet Headers { get { return _headers; } } /// <summary></summary> public byte[] Data { get { return _data; } } /// <summary></summary> public Stream Stream { get { return _stream; } set { _stream = value; } } /// <summary></summary> public Action<Int64> ProgressCallback { get { return _progress; } set { _progress = value; } } /// <summary></summary> public string Encoding { get { return _headers["Encoding"]; } set { _headers["Encoding"] = value; } } /// <summary></summary> public string ContentType { get { return _headers["ContentType"]; } } /// <summary></summary> public int Timeout { get { return _timeout; } set { _timeout = value < 0 ? 0 : value; } } /// <summary></summary> public long ContentLength { get { return _contentlength; } } /// <summary></summary> public string Url { get { return _properties["Url"]; } } // ---------------------------------------- /// <summary></summary> public HttpStatusCode StatusCode { get { return _statuscode; } } /// <summary></summary> public CookieCollection Cookies { get { return _cookies; } } /// <summary></summary> public bool Cached { get { return _cached; } } /// <summary></summary> public string CharacterSet { get { return _properties["CharacterSet"]; } } /// <summary></summary> public string ContentEncoding { get { return _properties["ContentEncoding"]; } } /// <summary></summary> public string Method { get { return _properties["Method"]; } } /// <summary></summary> public string ProtocolVersion { get { return _properties["ProtocolVersion"]; } } /// <summary></summary> public string Server { get { return _properties["Server"]; } } /// <summary></summary> public string StatusDescription { get { return _properties["StatusDescription"]; } } // ======================================== } }