HttpResponseInfo.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Net;
  5. namespace MediaBrowser.Common.Net
  6. {
  7. /// <summary>
  8. /// Class HttpResponseInfo
  9. /// </summary>
  10. public class HttpResponseInfo : IDisposable
  11. {
  12. /// <summary>
  13. /// Gets or sets the type of the content.
  14. /// </summary>
  15. /// <value>The type of the content.</value>
  16. public string ContentType { get; set; }
  17. /// <summary>
  18. /// Gets or sets the response URL.
  19. /// </summary>
  20. /// <value>The response URL.</value>
  21. public string ResponseUrl { get; set; }
  22. /// <summary>
  23. /// Gets or sets the content.
  24. /// </summary>
  25. /// <value>The content.</value>
  26. public Stream Content { get; set; }
  27. /// <summary>
  28. /// Gets or sets the status code.
  29. /// </summary>
  30. /// <value>The status code.</value>
  31. public HttpStatusCode StatusCode { get; set; }
  32. /// <summary>
  33. /// Gets or sets the temp file path.
  34. /// </summary>
  35. /// <value>The temp file path.</value>
  36. public string TempFilePath { get; set; }
  37. /// <summary>
  38. /// Gets or sets the length of the content.
  39. /// </summary>
  40. /// <value>The length of the content.</value>
  41. public long? ContentLength { get; set; }
  42. /// <summary>
  43. /// Gets or sets the headers.
  44. /// </summary>
  45. /// <value>The headers.</value>
  46. public Dictionary<string, string> Headers { get; set; }
  47. private readonly IDisposable _disposable;
  48. public HttpResponseInfo(IDisposable disposable)
  49. {
  50. _disposable = disposable;
  51. Headers = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
  52. }
  53. public HttpResponseInfo()
  54. {
  55. Headers = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
  56. }
  57. public void Dispose()
  58. {
  59. if (_disposable != null)
  60. {
  61. _disposable.Dispose();
  62. }
  63. }
  64. }
  65. }