Hello Team, 

We are running dovecot version (2.3.7.2 (3c910f64b)) on ubuntu 20.04.

Using the doveadm tool via http api we can create emails and move them 
accordingly to the draft folder by sending http requests via cURL from another 
server.
We can even attach files. However once we create a http API request bigger than 
1MB in size we get the “PAYLOAD TO LARGE” response from dovecot.

Going through the config I see no option to increase the allowed payload size 
for doveadm http api requests.

However in the source code itself I see that there is a default limit/size of:
#define HTTP_REQUEST_DEFAULT_MAX_PAYLOAD_SIZE       (1 * 1024 * 1024)

Further I found out that the default is only used if no limit is provided:
===
    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;

The question arises … how can we change / set the allowed payload size for the 
doveadm http api, so we can store bigger emails and attachments?
Can we store the desired allowed payload size in an env file somewhere or are 
there any options to take control of the allowed payload size without changing 
the source code?

Thanks in advance
Tony

 


Reply via email to