public HttpHeadersOptionsBuilder withValidator(Consumer<RawHttpHeaders> validator) { requireNonNull(validator, "Validator must not be null"); options = new HttpHeadersOptions(options.maxHeaderNameLength, options.maxHeaderValueLength, validator); return this; }
StringBuilder metadataBuilder = new StringBuilder(); int length = 0; int lengthLimit = options.getHttpHeadersOptions().getMaxHeaderNameLength(); parsingValue = true; length = -1; lengthLimit = options.getHttpHeadersOptions().getMaxHeaderValueLength(); } else if (c == '\n' || c == '\r') { throw createError.apply("Invalid header: missing the ':' separator", lineNumber);
StringBuilder metadataBuilder = new StringBuilder(); int length = 0; int lengthLimit = options.getHttpHeadersOptions().getMaxHeaderNameLength(); parsingValue = true; length = -1; lengthLimit = options.getHttpHeadersOptions().getMaxHeaderValueLength(); } else if (c == '\n' || c == '\r') { throw createError.apply("Invalid header: missing the ':' separator", lineNumber);
/** * Parses the HTTP messages' headers from the given input stream. * * @param inputStream supplying the header fields * @param createError error factory - used in case an error is encountered * @return the {@link RawHttpHeaders} * @throws IOException if an error occurs while consuming the stream */ public RawHttpHeaders parseHeaders(InputStream inputStream, BiFunction<String, Integer, RuntimeException> createError) throws IOException { RawHttpHeaders headers = buildHeaders(inputStream, createError).build(); options.getHttpHeadersOptions().getHeadersValidator().accept(headers); return headers; }
/** * Set the maximum header value length allowed. * * @param length maximum allowed * @return this */ public HttpHeadersOptionsBuilder withMaxHeaderValueLength(int length) { options = new HttpHeadersOptions(options.maxHeaderNameLength, length, options.headersValidator); return this; }
/** * Set the maximum header name length allowed. * * @param length maximum allowed * @return this */ public HttpHeadersOptionsBuilder withMaxHeaderNameLength(int length) { options = new HttpHeadersOptions(length, options.maxHeaderValueLength, options.headersValidator); return this; }
/** * Parses the HTTP messages' headers from the given input stream. * * @param inputStream supplying the header fields * @param createError error factory - used in case an error is encountered * @return the {@link RawHttpHeaders} * @throws IOException if an error occurs while consuming the stream */ public RawHttpHeaders parseHeaders(InputStream inputStream, BiFunction<String, Integer, RuntimeException> createError) throws IOException { RawHttpHeaders headers = buildHeaders(inputStream, createError).build(); options.getHttpHeadersOptions().getHeadersValidator().accept(headers); return headers; }
public HttpHeadersOptionsBuilder withValidator(Consumer<RawHttpHeaders> validator) { requireNonNull(validator, "Validator must not be null"); options = new HttpHeadersOptions(options.maxHeaderNameLength, options.maxHeaderValueLength, validator); return this; }
/** * Set the maximum header value length allowed. * * @param length maximum allowed * @return this */ public HttpHeadersOptionsBuilder withMaxHeaderValueLength(int length) { options = new HttpHeadersOptions(options.maxHeaderNameLength, length, options.headersValidator); return this; }
/** * Set the maximum header name length allowed. * * @param length maximum allowed * @return this */ public HttpHeadersOptionsBuilder withMaxHeaderNameLength(int length) { options = new HttpHeadersOptions(length, options.maxHeaderValueLength, options.headersValidator); return this; }