HttpRequestDecoder and HttpResponseEncoder
which enables easier server side HTTP implementation.
Without header validation, your system can become vulnerable to CWE-113: Improper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Response Splitting') .
This recommendation stands even when both peers in the HTTP exchange are trusted, as it helps with defence-in-depth.
HttpClientCodec
| Modifier and Type | Class and Description |
|---|---|
| private class | |
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private final Queue | queue
A queue that is used for correlating a request and a response. |
| Access | Constructor and Description |
|---|---|
| public | HttpServerCodec()
Creates a new instance with the default decoder options
( |
| public | HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize)
Creates a new instance with the specified decoder options. |
| public | HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders)
Deprecated
Prefer the
Creates a new instance with the specified decoder options.
HttpServerCodec(HttpDecoderConfig) constructor,
to always enable header validation.
|
| public | HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders, int initialBufferSize)
Deprecated
Prefer the
Creates a new instance with the specified decoder options.
HttpServerCodec(HttpDecoderConfig) constructor, to always enable header
validation.
|
| public | HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders, int initialBufferSize, boolean allowDuplicateContentLengths)
Deprecated
Prefer the
Creates a new instance with the specified decoder options.
HttpServerCodec(HttpDecoderConfig) constructor,
to always enable header validation.
|
| public | HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders, int initialBufferSize, boolean allowDuplicateContentLengths, boolean allowPartialChunks)
Deprecated
Prefer the
Creates a new instance with the specified decoder options.
HttpServerCodec(HttpDecoderConfig) constructor,
to always enable header validation.
|
| public | HttpServerCodec(HttpDecoderConfig config)
Creates a new instance with the specified decoder configuration. |
| Modifier and Type | Method and Description |
|---|---|
| public void | upgradeFrom(ChannelHandlerContext ctx)
Implements io. |
| queue | back to summary |
|---|---|
| private final Queue<HttpMethod> queue A queue that is used for correlating a request and a response. | |
| HttpServerCodec | back to summary |
|---|---|
| public HttpServerCodec() Creates a new instance with the default decoder options
( | |
| HttpServerCodec | back to summary |
|---|---|
| public HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize) Creates a new instance with the specified decoder options. | |
| HttpServerCodec | back to summary |
|---|---|
| public HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders)
Deprecated Prefer the Creates a new instance with the specified decoder options.
| |
| HttpServerCodec | back to summary |
|---|---|
| public HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders, int initialBufferSize)
Deprecated Prefer the Creates a new instance with the specified decoder options.
| |
| HttpServerCodec | back to summary |
|---|---|
| public HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders, int initialBufferSize, boolean allowDuplicateContentLengths)
Deprecated Prefer the Creates a new instance with the specified decoder options.
| |
| HttpServerCodec | back to summary |
|---|---|
| public HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders, int initialBufferSize, boolean allowDuplicateContentLengths, boolean allowPartialChunks)
Deprecated Prefer the Creates a new instance with the specified decoder options.
| |
| HttpServerCodec | back to summary |
|---|---|
| public HttpServerCodec(HttpDecoderConfig config) Creates a new instance with the specified decoder configuration. | |
| upgradeFrom | back to summary |
|---|---|
| public void upgradeFrom(ChannelHandlerContext ctx) Implements io. Upgrades to another protocol from HTTP. Removes the
| |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| protected void | decode(ChannelHandlerContext
the ctx, ByteBuf ChannelHandlerContext which this ByteToMessageDecoder belongs tothe buffer, List<Object> ByteBuf from which to read datathe out)List to which decoded messages should be addedOverrides io. ByteBuf to an other.
|
| HttpServerRequestDecoder | back to summary |
|---|---|
| pack-priv HttpServerRequestDecoder(HttpDecoderConfig config) | |
| decode | back to summary |
|---|---|
| protected void decode(ChannelHandlerContext ctx, ByteBuf buffer, List<Object> out) throws Exception Overrides io. Doc from io. Decode the from one
| |
| Modifier and Type | Field and Description |
|---|---|
| private HttpMethod |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| protected boolean | isContentAlwaysEmpty(HttpResponse
the message to test msg)Overrides io. |
| protected void | sanitizeHeadersBeforeEncode(HttpResponse msg, boolean isAlwaysEmpty)
Overrides io. |
| method | back to summary |
|---|---|
| private HttpMethod method | |
| HttpServerResponseEncoder | back to summary |
|---|---|
| private HttpServerResponseEncoder() | |
| isContentAlwaysEmpty | back to summary |
|---|---|
| protected boolean isContentAlwaysEmpty(HttpResponse msg) Overrides io. Doc from io. Determine whether a message has a content or not. Some message may have headers indicating a content without having an actual content, e.g the response to an HEAD or CONNECT request.
| |
| sanitizeHeadersBeforeEncode | back to summary |
|---|---|
| protected void sanitizeHeadersBeforeEncode(HttpResponse msg, boolean isAlwaysEmpty) Overrides io. Doc from io. Allows to sanitize headers of the message before encoding these.
| |