if (limits != NULL) {
hdr_limits = limits->header;
max_payload_size = limits->max_payload_size;
} else {
i_zero(&hdr_limits);
max_payload_size = 0;
}
/* substitute default limits */
if (parser->max_target_length == 0)
parser->max_target_length = HTTP_REQUEST_DEFAULT_MAX_TARGET_LENGTH;
if (hdr_limits.max_size == 0)
hdr_limits.max_size = HTTP_REQUEST_DEFAULT_MAX_HEADER_SIZE;
if (hdr_limits.max_field_size == 0)
hdr_limits.max_field_size = HTTP_REQUEST_DEFAULT_MAX_HEADER_FIELD_SIZE;
if (hdr_limits.max_fields == 0)
hdr_limits.max_fields = HTTP_REQUEST_DEFAULT_MAX_HEADER_FIELDS;
if (max_payload_size == 0)
max_payload_size = HTTP_REQUEST_DEFAULT_MAX_PAYLOAD_SIZE;
if ((flags & HTTP_REQUEST_PARSE_FLAG_STRICT) != 0)
msg_flags |= HTTP_MESSAGE_PARSE_FLAG_STRICT;
http_message_parser_init(&parser->parser, input,
&hdr_limits, max_payload_size, msg_flags);
return parser;