1 /*
2 * Copyright 2020 The Netty Project
3 *
4 * The Netty Project licenses this file to you under the Apache License,
5 * version 2.0 (the "License"); you may not use this file except in compliance
6 * with the License. You may obtain a copy of the License at:
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations
14 * under the License.
15 */
16 package io.netty.handler.codec.http3;
17
18 /**
19 * Different <a href="https://datatracker.ietf.org/doc/html/rfc9114#name-http-3-error-codes">HTTP3 error codes</a>.
20 */
21 public enum Http3ErrorCode {
22
23 /**
24 * Datagram or Capsule Protocol parse error
25 * <a href="https://www.rfc-editor.org/rfc/rfc9297.html#name-http-3-error-code">rfc9297</a>
26 * registered in IANA http3
27 * <a href="https://www.iana.org/assignments/http3-parameters/http3-parameters.xhtml#http3-parameters-error-codes"
28 * >
29 * IANA Http3 Error Codes</a>
30 */
31 H3_DATAGRAM_ERROR(0x33),
32
33 /**
34 * No error. This is used when the connection or stream needs to be closed, but there is no error to signal.
35 */
36 H3_NO_ERROR(0x100),
37
38 /**
39 * Peer violated protocol requirements in a way that does not match a more specific error code,
40 * or endpoint declines to use the more specific error code.
41 */
42 H3_GENERAL_PROTOCOL_ERROR(0x101),
43
44 /**
45 * An internal error has occurred in the HTTP stack.
46 */
47 H3_INTERNAL_ERROR(0x102),
48
49 /**
50 * The endpoint detected that its peer created a stream that it will not accept.
51 */
52 H3_STREAM_CREATION_ERROR(0x103),
53
54 /**
55 * A stream required by the HTTP/3 connection was closed or reset.
56 */
57 H3_CLOSED_CRITICAL_STREAM(0x104),
58
59 /**
60 * A frame was received that was not permitted in the current state or on the current stream.
61 */
62 H3_FRAME_UNEXPECTED(0x105),
63
64 /**
65 * A frame that fails to satisfy layout requirements or with an invalid size was received.
66 */
67 H3_FRAME_ERROR(0x106),
68
69 /**
70 * The endpoint detected that its peer is exhibiting a behavior that might be generating excessive load.
71 */
72 H3_EXCESSIVE_LOAD(0x107),
73
74 /**
75 * A Stream ID or Push ID was used incorrectly, such as exceeding a limit, reducing a limit, or being reused.
76 */
77 H3_ID_ERROR(0x108),
78
79 /**
80 * An endpoint detected an error in the payload of a SETTINGS frame.
81 */
82 H3_SETTINGS_ERROR(0x109),
83
84 /**
85 * No SETTINGS frame was received at the beginning of the control stream.
86 */
87 H3_MISSING_SETTINGS(0x10a),
88
89 /**
90 * A server rejected a request without performing any application processing.
91 */
92 H3_REQUEST_REJECTED(0x10b),
93
94 /**
95 * The request or its response (including pushed response) is cancelled.
96 */
97 H3_REQUEST_CANCELLED(0x10c),
98
99 /**
100 * The client's stream terminated without containing a fully-formed request.
101 */
102 H3_REQUEST_INCOMPLETE(0x10d),
103
104 /**
105 * An HTTP message was malformed and cannot be processed.
106 */
107 H3_MESSAGE_ERROR(0x10e),
108
109 /**
110 * The TCP connection established in response to a CONNECT request was reset or abnormally closed.
111 */
112 H3_CONNECT_ERROR(0x10f),
113
114 /**
115 * The requested operation cannot be served over HTTP/3. The peer should retry over HTTP/1.1.
116 */
117 H3_VERSION_FALLBACK(0x110),
118
119 /**
120 * The decoder failed to interpret an encoded field section and is not able to continue decoding that field section.
121 */
122 QPACK_DECOMPRESSION_FAILED(0x200),
123
124 /**
125 * The decoder failed to interpret an encoder instruction received on the encoder stream.
126 */
127 QPACK_ENCODER_STREAM_ERROR(0x201),
128
129 /**
130 * The encoder failed to interpret a decoder instruction received on the decoder stream.
131 */
132 QPACK_DECODER_STREAM_ERROR(0x202);
133
134 final int code;
135
136 Http3ErrorCode(int code) {
137 this.code = code;
138 }
139
140 public int code() {
141 return code;
142 }
143 }