io.netty.handler.codec.http2.Http2HeadersEncoder.SensitivityDetector Java Examples
The following examples show how to use
io.netty.handler.codec.http2.Http2HeadersEncoder.SensitivityDetector.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HpackEncoder.java From netty-4.1.22 with Apache License 2.0 | 6 votes |
private void encodeHeadersEnforceMaxHeaderListSize(int streamId, ByteBuf out, Http2Headers headers, SensitivityDetector sensitivityDetector) throws Http2Exception { long headerSize = 0; // To ensure we stay consistent with our peer check the size is valid before we potentially modify HPACK state. for (Map.Entry<CharSequence, CharSequence> header : headers) { CharSequence name = header.getKey(); CharSequence value = header.getValue(); // OK to increment now and check for bounds after because this value is limited to unsigned int and will not // overflow. headerSize += HpackHeaderField.sizeOf(name, value); if (headerSize > maxHeaderListSize) { headerListSizeExceeded(streamId, maxHeaderListSize, false); } } encodeHeadersIgnoreMaxHeaderListSize(out, headers, sensitivityDetector); }
Example #2
Source File: HpackEncoder.java From netty-4.1.22 with Apache License 2.0 | 5 votes |
/** * Encode the header field into the header block. * * <strong>The given {@link CharSequence}s must be immutable!</strong> */ public void encodeHeaders(int streamId, ByteBuf out, Http2Headers headers, SensitivityDetector sensitivityDetector) throws Http2Exception { if (ignoreMaxHeaderListSize) { encodeHeadersIgnoreMaxHeaderListSize(out, headers, sensitivityDetector); } else { encodeHeadersEnforceMaxHeaderListSize(streamId, out, headers, sensitivityDetector); } }
Example #3
Source File: HpackEncoder.java From netty-4.1.22 with Apache License 2.0 | 5 votes |
private void encodeHeadersIgnoreMaxHeaderListSize(ByteBuf out, Http2Headers headers, SensitivityDetector sensitivityDetector) throws Http2Exception { for (Map.Entry<CharSequence, CharSequence> header : headers) { CharSequence name = header.getKey(); CharSequence value = header.getValue(); encodeHeader(out, name, value, sensitivityDetector.isSensitive(name, value), HpackHeaderField.sizeOf(name, value)); } }
Example #4
Source File: DefaultHttp2FrameWriter.java From netty-4.1.22 with Apache License 2.0 | 4 votes |
public DefaultHttp2FrameWriter(SensitivityDetector headersSensitivityDetector) { this(new DefaultHttp2HeadersEncoder(headersSensitivityDetector)); }
Example #5
Source File: DefaultHttp2FrameWriter.java From netty-4.1.22 with Apache License 2.0 | 4 votes |
public DefaultHttp2FrameWriter(SensitivityDetector headersSensitivityDetector, boolean ignoreMaxHeaderListSize) { this(new DefaultHttp2HeadersEncoder(headersSensitivityDetector, ignoreMaxHeaderListSize)); }
Example #6
Source File: AbstractHttp2ConnectionHandlerBuilder.java From netty-4.1.22 with Apache License 2.0 | 4 votes |
/** * Returns the {@link SensitivityDetector} to use. */ protected SensitivityDetector headerSensitivityDetector() { return headerSensitivityDetector != null ? headerSensitivityDetector : DEFAULT_HEADER_SENSITIVITY_DETECTOR; }