Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Commit c9d352b

Browse files
committed
Add HTTP2 error code registry
1 parent 1b3c989 commit c9d352b

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

hyper/http20/error_code_registry.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
hyper/http20/error_code_registry
4+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5+
6+
Global error code registry containing the established HTTP/2 error codes.
7+
The registry is based on a 32-bit space so we use the error code to index into
8+
the array.
9+
10+
The current registry is available at:
11+
https://tools.ietf.org/html/draft-ietf-httpbis-http2-17#section-11.4
12+
"""
13+
14+
NO_ERROR = {'Name': 'NO_ERROR',
15+
'Description': 'Graceful shutdown'}
16+
PROTOCOL_ERROR = {'Name': 'PROTOCOL_ERROR',
17+
'Description': 'Protocol error detected'}
18+
INTERNAL_ERROR = {'Name': 'INTERNAL_ERROR',
19+
'Description': 'Implementation fault'}
20+
FLOW_CONTROL_ERROR = {'Name': 'FLOW_CONTROL_ERROR',
21+
'Description': 'Flow control limits exceeded'}
22+
SETTINGS_TIMEOUT = {'Name': 'SETTINGS_TIMEOUT',
23+
'Description': 'Settings not acknowledged'}
24+
STREAM_CLOSED = {'Name': 'STREAM_CLOSED',
25+
'Description': 'Frame received for closed stream'}
26+
FRAME_SIZE_ERROR = {'Name': 'FRAME_SIZE_ERROR',
27+
'Description': 'Frame size incorrect'}
28+
REFUSED_STREAM = {'Name': 'REFUSED_STREAM ',
29+
'Description': 'Stream not processed'}
30+
CANCEL = {'Name': 'CANCEL',
31+
'Description': 'Stream cancelled'}
32+
COMPRESSION_ERROR = {'Name': 'COMPRESSION_ERROR',
33+
'Description': 'Compression state not updated'}
34+
CONNECT_ERROR = {'Name': 'CONNECT_ERROR',
35+
'Description':
36+
'TCP connection error for CONNECT method'}
37+
ENHANCE_YOUR_CALM = {'Name': 'ENHANCE_YOUR_CALM',
38+
'Description': 'Processing capacity exceeded'}
39+
INADEQUATE_SECURITY = {'Name': 'INADEQUATE_SECURITY',
40+
'Description':
41+
'Negotiated TLS parameters not acceptable'}
42+
HTTP_1_1_REQUIRED = {'Name': 'HTTP_1_1_REQUIRED',
43+
'Description': 'Use HTTP/1.1 for the request'}
44+
45+
H2_ERROR_CODE_REGISTRY = [NO_ERROR, PROTOCOL_ERROR, INTERNAL_ERROR,
46+
FLOW_CONTROL_ERROR, SETTINGS_TIMEOUT, STREAM_CLOSED,
47+
FRAME_SIZE_ERROR, REFUSED_STREAM, CANCEL,
48+
COMPRESSION_ERROR, CONNECT_ERROR, ENHANCE_YOUR_CALM,
49+
INADEQUATE_SECURITY, HTTP_1_1_REQUIRED]

0 commit comments

Comments
 (0)