]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: client: queue: Improved construction of timeout log message.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sat, 9 Sep 2017 10:58:12 +0000 (12:58 +0200)
committerTimo Sirainen <tss@dovecot.fi>
Sat, 9 Sep 2017 14:46:03 +0000 (17:46 +0300)
Earlier change used a literal prefix size, rather than inferring the size from the actual prefix string.

src/lib-http/http-client-queue.c

index acea74444877e98867fe9e0d689ca2141b59fa9c..ebd7c8398e796a7b2c4ef0fa3fb0b68245f818cc 100644 (file)
@@ -705,6 +705,7 @@ http_client_queue_request_timeout(struct http_client_queue *queue)
        ARRAY_TYPE(http_client_request) failed_requests;
        struct timeval new_to = { 0, 0 };
        string_t *str;
+       size_t prefix_size;
        unsigned int count, i;
 
        http_client_queue_debug(queue, "Timeout (now: %s.%03lu)",
@@ -733,6 +734,7 @@ http_client_queue_request_timeout(struct http_client_queue *queue)
 
        str = t_str_new(64);
        str_append(str, "Request ");
+       prefix_size = str_len(str);
 
        /* abort all failed request */
        reqs = array_get(&failed_requests, &count);
@@ -740,7 +742,7 @@ http_client_queue_request_timeout(struct http_client_queue *queue)
        for (i = 0; i < count; i++) {
                struct http_client_request *req = reqs[i];
 
-               str_truncate(str, 8);
+               str_truncate(str, prefix_size);
                http_client_request_append_stats_text(req, str);
 
                http_client_queue_debug(queue,