public final class HttpDecoderConfig
extends java.lang.Object
implements java.lang.Cloneable
HttpObjectDecoder
and its subclasses.
The HttpDecoderConfig
objects are mutable to reduce allocation,
but also Cloneable
in case a defensive copy is needed.
构造器和说明 |
---|
HttpDecoderConfig() |
限定符和类型 | 方法和说明 |
---|---|
HttpDecoderConfig |
clone() |
HttpHeadersFactory |
getHeadersFactory() |
int |
getInitialBufferSize() |
int |
getMaxChunkSize() |
int |
getMaxHeaderSize() |
int |
getMaxInitialLineLength() |
HttpHeadersFactory |
getTrailersFactory() |
boolean |
isAllowDuplicateContentLengths() |
boolean |
isAllowPartialChunks() |
boolean |
isChunkedSupported() |
HttpDecoderConfig |
setAllowDuplicateContentLengths(boolean allowDuplicateContentLengths)
Set whether more than one
Content-Length header is allowed. |
HttpDecoderConfig |
setAllowPartialChunks(boolean allowPartialChunks)
Set whether chunks can be split into multiple messages, if their chunk size exceeds the size of the input buffer.
|
HttpDecoderConfig |
setChunkedSupported(boolean chunkedSupported)
Set whether
Transfer-Encoding: Chunked should be supported. |
HttpDecoderConfig |
setHeadersFactory(HttpHeadersFactory headersFactory)
Set the
HttpHeadersFactory to use when creating new HTTP headers objects. |
HttpDecoderConfig |
setInitialBufferSize(int initialBufferSize)
Set the initial size of the temporary buffer used when parsing the lines of the HTTP headers.
|
HttpDecoderConfig |
setMaxChunkSize(int maxChunkSize)
Set the maximum chunk size.
|
HttpDecoderConfig |
setMaxHeaderSize(int maxHeaderSize)
Set the maximum line length of header lines.
|
HttpDecoderConfig |
setMaxInitialLineLength(int maxInitialLineLength)
Set the maximum length of the first line of the HTTP header.
|
HttpDecoderConfig |
setTrailersFactory(HttpHeadersFactory trailersFactory)
Set the
HttpHeadersFactory used to create HTTP trailers. |
HttpDecoderConfig |
setValidateHeaders(boolean validateHeaders)
Set whether header validation should be enabled or not.
|
public int getInitialBufferSize()
public HttpDecoderConfig setInitialBufferSize(int initialBufferSize)
initialBufferSize
- The buffer size in bytes.public int getMaxInitialLineLength()
public HttpDecoderConfig setMaxInitialLineLength(int maxInitialLineLength)
setMaxHeaderSize(int)
.maxInitialLineLength
- The maximum length, in bytes.public int getMaxHeaderSize()
public HttpDecoderConfig setMaxHeaderSize(int maxHeaderSize)
setMaxInitialLineLength(int)
.maxHeaderSize
- The maximum length, in bytes.public int getMaxChunkSize()
public HttpDecoderConfig setMaxChunkSize(int maxChunkSize)
maxChunkSize
- The maximum chunk size, in bytes.public boolean isChunkedSupported()
public HttpDecoderConfig setChunkedSupported(boolean chunkedSupported)
Transfer-Encoding: Chunked
should be supported.chunkedSupported
- if false
, then a Transfer-Encoding: Chunked
header will produce an error,
instead of a stream of chunks.public boolean isAllowPartialChunks()
public HttpDecoderConfig setAllowPartialChunks(boolean allowPartialChunks)
allowPartialChunks
- set to false
to only allow sending whole chunks down the pipeline.public HttpHeadersFactory getHeadersFactory()
public HttpDecoderConfig setHeadersFactory(HttpHeadersFactory headersFactory)
HttpHeadersFactory
to use when creating new HTTP headers objects.
The default headers factory is DefaultHttpHeadersFactory.headersFactory()
.
For the purpose of clone()
, it is assumed that the factory is either immutable, or can otherwise be
shared across different decoders and decoder configs.
headersFactory
- The header factory to use.public boolean isAllowDuplicateContentLengths()
public HttpDecoderConfig setAllowDuplicateContentLengths(boolean allowDuplicateContentLengths)
Content-Length
header is allowed.
You usually want to disallow this (which is the default) as multiple Content-Length
headers can indicate
a request- or response-splitting attack.allowDuplicateContentLengths
- set to true
to allow multiple content length headers.public HttpDecoderConfig setValidateHeaders(boolean validateHeaders)
You usually want header validation enabled (which is the default) in order to prevent request-/response-splitting attacks.
validateHeaders
- set to false
to disable header validation.public HttpHeadersFactory getTrailersFactory()
public HttpDecoderConfig setTrailersFactory(HttpHeadersFactory trailersFactory)
HttpHeadersFactory
used to create HTTP trailers.
This differs from setHeadersFactory(HttpHeadersFactory)
in that trailers have different validation
requirements.
The default trailer factory is DefaultHttpHeadersFactory.headersFactory()
.
For the purpose of clone()
, it is assumed that the factory is either immutable, or can otherwise be
shared across different decoders and decoder configs.
trailersFactory
- The headers factory to use for creating trailers.public HttpDecoderConfig clone()
clone
在类中 java.lang.Object