constants.d.ts 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. import { IEnumMap } from './utils';
  2. export declare type HTTPMode = 'loose' | 'strict';
  3. export declare enum ERROR {
  4. OK = 0,
  5. INTERNAL = 1,
  6. STRICT = 2,
  7. LF_EXPECTED = 3,
  8. UNEXPECTED_CONTENT_LENGTH = 4,
  9. CLOSED_CONNECTION = 5,
  10. INVALID_METHOD = 6,
  11. INVALID_URL = 7,
  12. INVALID_CONSTANT = 8,
  13. INVALID_VERSION = 9,
  14. INVALID_HEADER_TOKEN = 10,
  15. INVALID_CONTENT_LENGTH = 11,
  16. INVALID_CHUNK_SIZE = 12,
  17. INVALID_STATUS = 13,
  18. INVALID_EOF_STATE = 14,
  19. INVALID_TRANSFER_ENCODING = 15,
  20. CB_MESSAGE_BEGIN = 16,
  21. CB_HEADERS_COMPLETE = 17,
  22. CB_MESSAGE_COMPLETE = 18,
  23. CB_CHUNK_HEADER = 19,
  24. CB_CHUNK_COMPLETE = 20,
  25. PAUSED = 21,
  26. PAUSED_UPGRADE = 22,
  27. PAUSED_H2_UPGRADE = 23,
  28. USER = 24
  29. }
  30. export declare enum TYPE {
  31. BOTH = 0,
  32. REQUEST = 1,
  33. RESPONSE = 2
  34. }
  35. export declare enum FLAGS {
  36. CONNECTION_KEEP_ALIVE = 1,
  37. CONNECTION_CLOSE = 2,
  38. CONNECTION_UPGRADE = 4,
  39. CHUNKED = 8,
  40. UPGRADE = 16,
  41. CONTENT_LENGTH = 32,
  42. SKIPBODY = 64,
  43. TRAILING = 128,
  44. TRANSFER_ENCODING = 512
  45. }
  46. export declare enum LENIENT_FLAGS {
  47. HEADERS = 1,
  48. CHUNKED_LENGTH = 2,
  49. KEEP_ALIVE = 4
  50. }
  51. export declare enum METHODS {
  52. DELETE = 0,
  53. GET = 1,
  54. HEAD = 2,
  55. POST = 3,
  56. PUT = 4,
  57. CONNECT = 5,
  58. OPTIONS = 6,
  59. TRACE = 7,
  60. COPY = 8,
  61. LOCK = 9,
  62. MKCOL = 10,
  63. MOVE = 11,
  64. PROPFIND = 12,
  65. PROPPATCH = 13,
  66. SEARCH = 14,
  67. UNLOCK = 15,
  68. BIND = 16,
  69. REBIND = 17,
  70. UNBIND = 18,
  71. ACL = 19,
  72. REPORT = 20,
  73. MKACTIVITY = 21,
  74. CHECKOUT = 22,
  75. MERGE = 23,
  76. 'M-SEARCH' = 24,
  77. NOTIFY = 25,
  78. SUBSCRIBE = 26,
  79. UNSUBSCRIBE = 27,
  80. PATCH = 28,
  81. PURGE = 29,
  82. MKCALENDAR = 30,
  83. LINK = 31,
  84. UNLINK = 32,
  85. SOURCE = 33,
  86. PRI = 34,
  87. DESCRIBE = 35,
  88. ANNOUNCE = 36,
  89. SETUP = 37,
  90. PLAY = 38,
  91. PAUSE = 39,
  92. TEARDOWN = 40,
  93. GET_PARAMETER = 41,
  94. SET_PARAMETER = 42,
  95. REDIRECT = 43,
  96. RECORD = 44,
  97. FLUSH = 45
  98. }
  99. export declare const METHODS_HTTP: METHODS[];
  100. export declare const METHODS_ICE: METHODS[];
  101. export declare const METHODS_RTSP: METHODS[];
  102. export declare const METHOD_MAP: IEnumMap;
  103. export declare const H_METHOD_MAP: IEnumMap;
  104. export declare enum FINISH {
  105. SAFE = 0,
  106. SAFE_WITH_CB = 1,
  107. UNSAFE = 2
  108. }
  109. export declare type CharList = Array<string | number>;
  110. export declare const ALPHA: CharList;
  111. export declare const NUM_MAP: {
  112. 0: number;
  113. 1: number;
  114. 2: number;
  115. 3: number;
  116. 4: number;
  117. 5: number;
  118. 6: number;
  119. 7: number;
  120. 8: number;
  121. 9: number;
  122. };
  123. export declare const HEX_MAP: {
  124. 0: number;
  125. 1: number;
  126. 2: number;
  127. 3: number;
  128. 4: number;
  129. 5: number;
  130. 6: number;
  131. 7: number;
  132. 8: number;
  133. 9: number;
  134. A: number;
  135. B: number;
  136. C: number;
  137. D: number;
  138. E: number;
  139. F: number;
  140. a: number;
  141. b: number;
  142. c: number;
  143. d: number;
  144. e: number;
  145. f: number;
  146. };
  147. export declare const NUM: CharList;
  148. export declare const ALPHANUM: CharList;
  149. export declare const MARK: CharList;
  150. export declare const USERINFO_CHARS: CharList;
  151. export declare const STRICT_URL_CHAR: CharList;
  152. export declare const URL_CHAR: CharList;
  153. export declare const HEX: CharList;
  154. export declare const STRICT_TOKEN: CharList;
  155. export declare const TOKEN: CharList;
  156. export declare const HEADER_CHARS: CharList;
  157. export declare const CONNECTION_TOKEN_CHARS: CharList;
  158. export declare const MAJOR: {
  159. 0: number;
  160. 1: number;
  161. 2: number;
  162. 3: number;
  163. 4: number;
  164. 5: number;
  165. 6: number;
  166. 7: number;
  167. 8: number;
  168. 9: number;
  169. };
  170. export declare const MINOR: {
  171. 0: number;
  172. 1: number;
  173. 2: number;
  174. 3: number;
  175. 4: number;
  176. 5: number;
  177. 6: number;
  178. 7: number;
  179. 8: number;
  180. 9: number;
  181. };
  182. export declare enum HEADER_STATE {
  183. GENERAL = 0,
  184. CONNECTION = 1,
  185. CONTENT_LENGTH = 2,
  186. TRANSFER_ENCODING = 3,
  187. UPGRADE = 4,
  188. CONNECTION_KEEP_ALIVE = 5,
  189. CONNECTION_CLOSE = 6,
  190. CONNECTION_UPGRADE = 7,
  191. TRANSFER_ENCODING_CHUNKED = 8
  192. }
  193. export declare const SPECIAL_HEADERS: {
  194. connection: HEADER_STATE;
  195. 'content-length': HEADER_STATE;
  196. 'proxy-connection': HEADER_STATE;
  197. 'transfer-encoding': HEADER_STATE;
  198. upgrade: HEADER_STATE;
  199. };