跳到主要内容

7. Error Codes

Error codes 是 32-bit 字段, 用于 RST_STREAM 和 GOAWAY frames, 以传达 stream 或 connection 终止的原因.

Error Code Registry

NameCode描述
NO_ERROR0x0优雅关闭
PROTOCOL_ERROR0x1检测到 protocol error
INTERNAL_ERROR0x2Internal error
FLOW_CONTROL_ERROR0x3超出 flow-control limits
SETTINGS_TIMEOUT0x4SETTINGS 未被确认
STREAM_CLOSED0x5stream 关闭后收到 frame
FRAME_SIZE_ERROR0x6frame size 不正确
REFUSED_STREAM0x7stream 未被处理
CANCEL0x8stream 已取消
COMPRESSION_ERROR0x9compression state 无效
CONNECT_ERROR0xaTCP connection error
ENHANCE_YOUR_CALM0xb超出 processing capacity
INADEQUATE_SECURITY0xc不满足 security requirements
HTTP_1_1_REQUIRED0xd改用 HTTP/1.1

Usage

Error codes 用于:

  • RST_STREAM frames: 终止单个 streams
  • GOAWAY frames: 终止 connections

未知 error codes MUST 被视为 INTERNAL_ERROR.