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.

52 lines
1.2 KiB

8 months ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Text;
  5. namespace Apewer.Network
  6. {
  7. /// <summary>HTTP 正文。</summary>
  8. public abstract class HttpBody { }
  9. /// <summary>HTTP 报文结构。</summary>
  10. public sealed class HttpBytesMessage : HttpBody
  11. {
  12. /// <summary>主体。</summary>
  13. public byte[] Bytes { get; set; }
  14. }
  15. /// <summary>HTTP 报文结构。</summary>
  16. public class HttpStreamMessage<T> : HttpBody where T : Stream
  17. {
  18. /// <summary>自动释放 Stream 对象。</summary>
  19. public bool AutoDispose { get; set; }
  20. /// <summary>主体。</summary>
  21. public Stream Stream { get; set; }
  22. /// <summary>主体的长度。</summary>
  23. public long Length { get; set; }
  24. }
  25. /// <summary>HTTP 报文结构。</summary>
  26. public sealed class HttpStreamMessage : HttpBody
  27. {
  28. /// <summary>自动释放 Stream 对象。</summary>
  29. public bool AutoDispose { get; set; }
  30. /// <summary>主体。</summary>
  31. public Stream Stream { get; set; }
  32. /// <summary>主体的长度。</summary>
  33. public long Length { get; set; }
  34. }
  35. }