Class H1ProtocolConfigBuilder
H1ProtocolConfig.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbuild()BuildsH1ProtocolConfig.headersEncodedSizeEstimate(int headersEncodedSizeEstimate) Sets the value used to calculate an exponential moving average of the encoded size of the HTTP start line and header fields for a guess for future buffer allocations.headersFactory(HttpHeadersFactory headersFactory) Sets theHttpHeadersFactoryto be used for creatingHttpHeaderswhen decoding HTTP messages.maxHeaderFieldLength(int maxHeaderFieldLength) Sets the maximum length (size in bytes) of an individual HTTP header field or trailer field to parse.maxPipelinedRequests(int maxPipelinedRequests) Sets the maximum number of pipelined HTTP requests to queue up.maxStartLineLength(int maxStartLineLength) Sets the maximum length (size in bytes) of the HTTP start line for an HTTP message.maxTotalHeaderFieldsLength(int maxTotalHeaderFieldsLength) Sets the maximum total allowed length (size in bytes) of the HTTP start line and all header fields, or all trailer fields.specExceptions(H1SpecExceptions specExceptions) Sets additional exceptions for HTTP/1.1 specification.trailersEncodedSizeEstimate(int trailersEncodedSizeEstimate) Sets the value used to calculate an exponential moving average of the encoded size of the HTTP trailer fields for a guess for future buffer allocations.
-
Method Details
-
headersFactory
Sets theHttpHeadersFactoryto be used for creatingHttpHeaderswhen decoding HTTP messages.- Parameters:
headersFactory-HttpHeadersFactoryto be used for creatingHttpHeaderswhen decoding HTTP messages- Returns:
this
-
maxPipelinedRequests
Sets the maximum number of pipelined HTTP requests to queue up.Anything above this value will be rejected,
1means pipelining is disabled and requests/responses are processed sequentially. Default value is1.Note:
reserved connectionswill not be restricted by this setting.- Parameters:
maxPipelinedRequests- maximum number of pipelined requests to queue up- Returns:
this
-
maxStartLineLength
Sets the maximum length (size in bytes) of the HTTP start line for an HTTP message.Default value is 8192 bytes.
Note: a decoder will close the connection with
TooLongFrameExceptionif the start line exceeds this value, including CRLF delimiter at the end.- Parameters:
maxStartLineLength- maximum length (size in bytes) of the HTTP start line for an HTTP message- Returns:
this
-
maxTotalHeaderFieldsLength
Sets the maximum total allowed length (size in bytes) of the HTTP start line and all header fields, or all trailer fields.This limit protects against memory exhaustion attacks where an attacker sends many small headers or trailers that individually pass
field validationbut collectively consume excessive memory.Note: a decoder will close the connection with
TooLongFrameExceptionif the total headers or trailers block size exceeds this value, including CRLF delimiter at the end of each line.This is an HTTP/1.x equivalent of HTTP/2's SETTINGS_MAX_HEADER_LIST_SIZE that can be configured via
Http2Settings.maxHeaderListSize()forH2ProtocolConfigBuilder.initialSettings(Http2Settings).The default value is 32768 bytes. Users who unexpectedly hit the default limit can temporarily (until they can adjust the limit via this method) set
io.servicetalk.http.netty.temporaryDefaultMaxTotalHeaderFieldsLengthto a new value. However, this is a temporary property that will be removed in the future releases.- Parameters:
maxTotalHeaderFieldsLength- maximum total allowed length (size in bytes) of the start line and all headers, or all trailers- Returns:
this- See Also:
-
maxHeaderFieldLength
Sets the maximum length (size in bytes) of an individual HTTP header field or trailer field to parse.Default value is 16384 bytes.
Note: a decoder will close the connection with
TooLongFrameExceptionif the length of a header or trailer field exceeds this value, including CRLF delimiter at the end.- Parameters:
maxHeaderFieldLength- maximum length (size in bytes) of an individual HTTP header field or trailer field to parse- Returns:
this- See Also:
-
headersEncodedSizeEstimate
Sets the value used to calculate an exponential moving average of the encoded size of the HTTP start line and header fields for a guess for future buffer allocations.- Parameters:
headersEncodedSizeEstimate- value used to calculate an exponential moving average of the encoded size of the HTTP start line and header fields- Returns:
this
-
trailersEncodedSizeEstimate
Sets the value used to calculate an exponential moving average of the encoded size of the HTTP trailer fields for a guess for future buffer allocations.- Parameters:
trailersEncodedSizeEstimate- value used to calculate an exponential moving average of the encoded size of the HTTP trailer fields- Returns:
this
-
specExceptions
Sets additional exceptions for HTTP/1.1 specification.- Parameters:
specExceptions- exceptions for HTTP/1.1 specification- Returns:
this
-
build
BuildsH1ProtocolConfig.- Returns:
- a new
H1ProtocolConfig
-