public final class HttpServerCodec extends CombinedChannelDuplexHandler<HttpRequestDecoder,HttpResponseEncoder> implements HttpServerUpgradeHandler.SourceCodec
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
ChannelHandler.Sharable
构造器和说明 |
---|
HttpServerCodec()
Creates a new instance with the default decoder options
(
maxInitialLineLength (4096) , maxHeaderSize (8192) , and
maxChunkSize (8192) ). |
HttpServerCodec(HttpDecoderConfig config)
Creates a new instance with the specified decoder configuration.
|
HttpServerCodec(int maxInitialLineLength,
int maxHeaderSize,
int maxChunkSize)
Creates a new instance with the specified decoder options.
|
HttpServerCodec(int maxInitialLineLength,
int maxHeaderSize,
int maxChunkSize,
boolean validateHeaders)
已过时。
Prefer the
HttpServerCodec(HttpDecoderConfig) constructor,
to always enable header validation. |
HttpServerCodec(int maxInitialLineLength,
int maxHeaderSize,
int maxChunkSize,
boolean validateHeaders,
int initialBufferSize)
已过时。
Prefer the
HttpServerCodec(HttpDecoderConfig) constructor, to always enable header
validation. |
HttpServerCodec(int maxInitialLineLength,
int maxHeaderSize,
int maxChunkSize,
boolean validateHeaders,
int initialBufferSize,
boolean allowDuplicateContentLengths)
已过时。
Prefer the
HttpServerCodec(HttpDecoderConfig) constructor,
to always enable header validation. |
HttpServerCodec(int maxInitialLineLength,
int maxHeaderSize,
int maxChunkSize,
boolean validateHeaders,
int initialBufferSize,
boolean allowDuplicateContentLengths,
boolean allowPartialChunks)
已过时。
Prefer the
HttpServerCodec(HttpDecoderConfig) constructor,
to always enable header validation. |
限定符和类型 | 方法和说明 |
---|---|
void |
upgradeFrom(ChannelHandlerContext ctx)
Upgrades to another protocol from HTTP.
|
bind, channelActive, channelInactive, channelRead, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, close, connect, deregister, disconnect, exceptionCaught, flush, handlerAdded, handlerRemoved, inboundHandler, init, outboundHandler, read, removeInboundHandler, removeOutboundHandler, userEventTriggered, write
ensureNotSharable, isSharable
public HttpServerCodec()
maxInitialLineLength (4096)
, maxHeaderSize (8192)
, and
maxChunkSize (8192)
).public HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize)
@Deprecated public HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders)
HttpServerCodec(HttpDecoderConfig)
constructor,
to always enable header validation.@Deprecated public HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders, int initialBufferSize)
HttpServerCodec(HttpDecoderConfig)
constructor, to always enable header
validation.@Deprecated public HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders, int initialBufferSize, boolean allowDuplicateContentLengths)
HttpServerCodec(HttpDecoderConfig)
constructor,
to always enable header validation.@Deprecated public HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders, int initialBufferSize, boolean allowDuplicateContentLengths, boolean allowPartialChunks)
HttpServerCodec(HttpDecoderConfig)
constructor,
to always enable header validation.public HttpServerCodec(HttpDecoderConfig config)
public void upgradeFrom(ChannelHandlerContext ctx)
HttpRequestDecoder
and
HttpResponseEncoder
from the pipeline.