You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
3.0 KiB

  1. using Apewer;
  2. using Apewer.Internals;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.IO;
  6. using System.Net;
  7. using System.Text;
  8. namespace Apewer.Network
  9. {
  10. /// <summary></summary>
  11. public class HttpResponse
  12. {
  13. // ========================================
  14. internal TextSet _properties = new TextSet(true);
  15. internal TextSet _headers = new TextSet(true);
  16. internal Action<Int64> _progress = null;
  17. internal Stream _stream = null;
  18. internal byte[] _data = Constant.EmptyBytes;
  19. internal long _contentlength = 0L;
  20. internal bool _locked = false;
  21. internal int _timeout = 0;
  22. // ----------------------------------------
  23. internal bool _cached = false;
  24. internal CookieCollection _cookies = null;
  25. internal HttpStatusCode _statuscode = 0;
  26. // ========================================
  27. /// <summary></summary>
  28. public TextSet Headers { get { return _headers; } }
  29. /// <summary></summary>
  30. public byte[] Data { get { return _data; } }
  31. /// <summary></summary>
  32. public Stream Stream { get { return _stream; } set { _stream = value; } }
  33. /// <summary></summary>
  34. public Action<Int64> ProgressCallback { get { return _progress; } set { _progress = value; } }
  35. /// <summary></summary>
  36. public string Encoding { get { return _headers["Encoding"]; } set { _headers["Encoding"] = value; } }
  37. /// <summary></summary>
  38. public string ContentType { get { return _headers["ContentType"]; } }
  39. /// <summary></summary>
  40. public int Timeout { get { return _timeout; } set { _timeout = value < 0 ? 0 : value; } }
  41. /// <summary></summary>
  42. public long ContentLength { get { return _contentlength; } }
  43. /// <summary></summary>
  44. public string Url { get { return _properties["Url"]; } }
  45. // ----------------------------------------
  46. /// <summary></summary>
  47. public HttpStatusCode StatusCode { get { return _statuscode; } }
  48. /// <summary></summary>
  49. public CookieCollection Cookies { get { return _cookies; } }
  50. /// <summary></summary>
  51. public bool Cached { get { return _cached; } }
  52. /// <summary></summary>
  53. public string CharacterSet { get { return _properties["CharacterSet"]; } }
  54. /// <summary></summary>
  55. public string ContentEncoding { get { return _properties["ContentEncoding"]; } }
  56. /// <summary></summary>
  57. public string Method { get { return _properties["Method"]; } }
  58. /// <summary></summary>
  59. public string ProtocolVersion { get { return _properties["ProtocolVersion"]; } }
  60. /// <summary></summary>
  61. public string Server { get { return _properties["Server"]; } }
  62. /// <summary></summary>
  63. public string StatusDescription { get { return _properties["StatusDescription"]; } }
  64. // ========================================
  65. }
  66. }