b0c27550fb8de8dab23f255f41de6fac320e483849a43432e7120420c30c75c355c566d3c530c2d215542e1746e293174694a3d6d441956deb5929fad2a048 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. 'use strict'
  2. var transport = require('../../../spdy-transport')
  3. var base = transport.protocol.base
  4. exports.FRAME_HEADER_SIZE = 8
  5. exports.PING_OPAQUE_SIZE = 4
  6. exports.MAX_CONCURRENT_STREAMS = Infinity
  7. exports.DEFAULT_MAX_HEADER_LIST_SIZE = Infinity
  8. exports.DEFAULT_WEIGHT = 16
  9. exports.frameType = {
  10. SYN_STREAM: 1,
  11. SYN_REPLY: 2,
  12. RST_STREAM: 3,
  13. SETTINGS: 4,
  14. PING: 6,
  15. GOAWAY: 7,
  16. HEADERS: 8,
  17. WINDOW_UPDATE: 9,
  18. // Custom
  19. X_FORWARDED_FOR: 0xf000
  20. }
  21. exports.flags = {
  22. FLAG_FIN: 0x01,
  23. FLAG_COMPRESSED: 0x02,
  24. FLAG_UNIDIRECTIONAL: 0x02
  25. }
  26. exports.error = {
  27. PROTOCOL_ERROR: 1,
  28. INVALID_STREAM: 2,
  29. REFUSED_STREAM: 3,
  30. UNSUPPORTED_VERSION: 4,
  31. CANCEL: 5,
  32. INTERNAL_ERROR: 6,
  33. FLOW_CONTROL_ERROR: 7,
  34. STREAM_IN_USE: 8,
  35. // STREAM_ALREADY_CLOSED: 9
  36. STREAM_CLOSED: 9,
  37. INVALID_CREDENTIALS: 10,
  38. FRAME_TOO_LARGE: 11
  39. }
  40. exports.errorByCode = base.utils.reverse(exports.error)
  41. exports.settings = {
  42. FLAG_SETTINGS_PERSIST_VALUE: 1,
  43. FLAG_SETTINGS_PERSISTED: 2,
  44. SETTINGS_UPLOAD_BANDWIDTH: 1,
  45. SETTINGS_DOWNLOAD_BANDWIDTH: 2,
  46. SETTINGS_ROUND_TRIP_TIME: 3,
  47. SETTINGS_MAX_CONCURRENT_STREAMS: 4,
  48. SETTINGS_CURRENT_CWND: 5,
  49. SETTINGS_DOWNLOAD_RETRANS_RATE: 6,
  50. SETTINGS_INITIAL_WINDOW_SIZE: 7,
  51. SETTINGS_CLIENT_CERTIFICATE_VECTOR_SIZE: 8
  52. }
  53. exports.settingsIndex = [
  54. null,
  55. 'upload_bandwidth',
  56. 'download_bandwidth',
  57. 'round_trip_time',
  58. 'max_concurrent_streams',
  59. 'current_cwnd',
  60. 'download_retrans_rate',
  61. 'initial_window_size',
  62. 'client_certificate_vector_size'
  63. ]
  64. exports.DEFAULT_WINDOW = 64 * 1024
  65. exports.MAX_INITIAL_WINDOW_SIZE = 2147483647
  66. exports.goaway = {
  67. OK: 0,
  68. PROTOCOL_ERROR: 1,
  69. INTERNAL_ERROR: 2
  70. }
  71. exports.goawayByCode = base.utils.reverse(exports.goaway)
  72. exports.statusReason = {
  73. 100: 'Continue',
  74. 101: 'Switching Protocols',
  75. 102: 'Processing', // RFC 2518, obsoleted by RFC 4918
  76. 200: 'OK',
  77. 201: 'Created',
  78. 202: 'Accepted',
  79. 203: 'Non-Authoritative Information',
  80. 204: 'No Content',
  81. 205: 'Reset Content',
  82. 206: 'Partial Content',
  83. 207: 'Multi-Status', // RFC 4918
  84. 300: 'Multiple Choices',
  85. 301: 'Moved Permanently',
  86. 302: 'Moved Temporarily',
  87. 303: 'See Other',
  88. 304: 'Not Modified',
  89. 305: 'Use Proxy',
  90. 307: 'Temporary Redirect',
  91. 308: 'Permanent Redirect', // RFC 7238
  92. 400: 'Bad Request',
  93. 401: 'Unauthorized',
  94. 402: 'Payment Required',
  95. 403: 'Forbidden',
  96. 404: 'Not Found',
  97. 405: 'Method Not Allowed',
  98. 406: 'Not Acceptable',
  99. 407: 'Proxy Authentication Required',
  100. 408: 'Request Time-out',
  101. 409: 'Conflict',
  102. 410: 'Gone',
  103. 411: 'Length Required',
  104. 412: 'Precondition Failed',
  105. 413: 'Request Entity Too Large',
  106. 414: 'Request-URI Too Large',
  107. 415: 'Unsupported Media Type',
  108. 416: 'Requested Range Not Satisfiable',
  109. 417: 'Expectation Failed',
  110. 418: 'I\'m a teapot', // RFC 2324
  111. 422: 'Unprocessable Entity', // RFC 4918
  112. 423: 'Locked', // RFC 4918
  113. 424: 'Failed Dependency', // RFC 4918
  114. 425: 'Unordered Collection', // RFC 4918
  115. 426: 'Upgrade Required', // RFC 2817
  116. 428: 'Precondition Required', // RFC 6585
  117. 429: 'Too Many Requests', // RFC 6585
  118. 431: 'Request Header Fields Too Large', // RFC 6585
  119. 500: 'Internal Server Error',
  120. 501: 'Not Implemented',
  121. 502: 'Bad Gateway',
  122. 503: 'Service Unavailable',
  123. 504: 'Gateway Time-out',
  124. 505: 'HTTP Version Not Supported',
  125. 506: 'Variant Also Negotiates', // RFC 2295
  126. 507: 'Insufficient Storage', // RFC 4918
  127. 509: 'Bandwidth Limit Exceeded',
  128. 510: 'Not Extended', // RFC 2774
  129. 511: 'Network Authentication Required' // RFC 6585
  130. }