Http2HeadersSink Class — netty Architecture
Architecture documentation for the Http2HeadersSink class in HpackDecoder.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 09e943af_04b7_39e7_f2dd_47f3684d790f["Http2HeadersSink"] 0349111a_08cf_8a81_958c_9daf941c0bac["HpackDecoder.java"] 09e943af_04b7_39e7_f2dd_47f3684d790f -->|defined in| 0349111a_08cf_8a81_958c_9daf941c0bac 1274ec90_f9d7_b6b8_bfb2_b9981266b7f0["Http2HeadersSink()"] 09e943af_04b7_39e7_f2dd_47f3684d790f -->|method| 1274ec90_f9d7_b6b8_bfb2_b9981266b7f0 3d97e02b_938f_df8f_b607_d74819f6fa66["finish()"] 09e943af_04b7_39e7_f2dd_47f3684d790f -->|method| 3d97e02b_938f_df8f_b607_d74819f6fa66 43fd3d2d_f851_d2d8_22e4_2146ae2443f8["appendToHeaderList()"] 09e943af_04b7_39e7_f2dd_47f3684d790f -->|method| 43fd3d2d_f851_d2d8_22e4_2146ae2443f8
Relationship Graph
Source Code
codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDecoder.java lines 524–570
private static final class Http2HeadersSink {
private final Http2Headers headers;
private final long maxHeaderListSize;
private final int streamId;
private final boolean validateHeaders;
private long headersLength;
private boolean exceededMaxLength;
private HeaderType previousType;
private Http2Exception validationException;
Http2HeadersSink(int streamId, Http2Headers headers, long maxHeaderListSize, boolean validateHeaders) {
this.headers = headers;
this.maxHeaderListSize = maxHeaderListSize;
this.streamId = streamId;
this.validateHeaders = validateHeaders;
}
void finish() throws Http2Exception {
if (exceededMaxLength) {
headerListSizeExceeded(streamId, maxHeaderListSize, true);
} else if (validationException != null) {
throw validationException;
}
}
void appendToHeaderList(AsciiString name, AsciiString value) {
headersLength += HpackHeaderField.sizeOf(name, value);
exceededMaxLength |= headersLength > maxHeaderListSize;
if (exceededMaxLength || validationException != null) {
// We don't store the header since we've already failed validation requirements.
return;
}
try {
headers.add(name, value);
if (validateHeaders) {
previousType = validateHeader(streamId, name, value, previousType);
}
} catch (IllegalArgumentException ex) {
validationException = streamError(streamId, PROTOCOL_ERROR, ex,
"Validation failed for header '%s': %s", name, ex.getMessage());
} catch (Http2Exception ex) {
validationException = streamError(streamId, PROTOCOL_ERROR, ex, ex.getMessage());
}
}
}
Source
Frequently Asked Questions
What is the Http2HeadersSink class?
Http2HeadersSink is a class in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDecoder.java.
Where is Http2HeadersSink defined?
Http2HeadersSink is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDecoder.java at line 524.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free