HttpSdk.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.InteropServices;
  5. using System.Text;
  6. namespace HPSocketCS
  7. {
  8. /// <summary>
  9. /// http版本号
  10. /// </summary>
  11. public enum HttpVersion
  12. {
  13. /// <summary>
  14. /// http 1.0
  15. /// </summary>
  16. V1_0 = 1,
  17. /// <summary>
  18. /// http 1.1
  19. /// </summary>
  20. v1_1 = 257,
  21. }
  22. /// <summary>
  23. /// URL 域
  24. /// HTTP 请求行中 URL 段位的域定义
  25. /// </summary>
  26. public enum HttpUrlField
  27. {
  28. Schema = 0,
  29. Host = 1,
  30. Port = 2,
  31. Path = 3,
  32. QueryString = 4,
  33. Fragment = 5,
  34. UserInfo = 6,
  35. /// <summary>
  36. /// Field Count
  37. /// </summary>
  38. Max = 7,
  39. }
  40. /// <summary>
  41. /// HTTP 解析结果标识
  42. /// 指示 HTTP 解析器是否继续执行解析操作
  43. /// </summary>
  44. public enum HttpParseResult
  45. {
  46. /// <summary>
  47. /// 终止解析,断开连接
  48. /// </summary>
  49. Error = -1,
  50. /// <summary>
  51. /// 继续解析
  52. /// </summary>
  53. Ok = 0,
  54. /// <summary>
  55. /// 跳过当前请求 BODY(仅用于 OnHeadersComplete 事件)
  56. /// </summary>
  57. SkipBody = 1,
  58. /// <summary>
  59. /// 升级协议(仅用于 OnHeadersComplete 事件)
  60. /// </summary>
  61. Upgrade = 2,
  62. }
  63. public enum HttpStatusCode
  64. {
  65. Continue = 100,
  66. SwitchingProtocols = 101,
  67. Processing = 102,
  68. Ok = 200,
  69. Created = 201,
  70. Accepted = 202,
  71. NonAuthoritativeInformation = 203,
  72. NoContent = 204,
  73. ResetContent = 205,
  74. PartialContent = 206,
  75. MultiStatus = 207,
  76. MultipleChoices = 300,
  77. MovedPermanently = 301,
  78. MovedTemporarily = 302,
  79. SeeOther = 303,
  80. NotModified = 304,
  81. UseProxy = 305,
  82. SwitchProxy = 306,
  83. TemporaryRedirect = 307,
  84. BadRequest = 400,
  85. Unauthorized = 401,
  86. PaymentRequired = 402,
  87. Forbidden = 403,
  88. NotFound = 404,
  89. MethodNotAllowed = 405,
  90. NotAcceptable = 406,
  91. ProxyAuthenticationRequired = 407,
  92. RequestTimeout = 408,
  93. Conflict = 409,
  94. Gone = 410,
  95. LengthRequired = 411,
  96. PreconditionFailed = 412,
  97. RequestEntityTooLarge = 413,
  98. RequestUriTooLong = 414,
  99. UnsupportedMediaType = 415,
  100. RequestedRangeNotSatisfiable = 416,
  101. ExpectationFailed = 417,
  102. UnprocessableEntity = 422,
  103. Locked = 423,
  104. FailedDependency = 424,
  105. UnorderedCollection = 435,
  106. UpgradeRequired = 426,
  107. RetryWith = 449,
  108. InternalServerError = 500,
  109. NotImplemented = 501,
  110. BadGateway = 502,
  111. ServiceUnavailable = 503,
  112. GatewayTimeout = 504,
  113. HttpVersionNotSupported = 505,
  114. VariantAlsoNegotiates = 506,
  115. InsufficientStorage = 507,
  116. BandwidthLimitExceeded = 509,
  117. NotExtended = 510,
  118. UnparseableResponseHeaders = 600,
  119. }
  120. /// <summary>
  121. /// Name/Value 结构体
  122. /// 字符串名值对结构体
  123. /// </summary>
  124. public struct TNVPair
  125. {
  126. [MarshalAs(UnmanagedType.LPStr)]
  127. public string Name;
  128. [MarshalAs(UnmanagedType.LPStr)]
  129. public string Value;
  130. }
  131. public class HttpSdk
  132. {
  133. }
  134. }