]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: client: Base forcing shared context debug logging on the settings of the...
authorStephan Bosch <stephan.bosch@dovecot.fi>
Fri, 29 Dec 2017 00:47:16 +0000 (01:47 +0100)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Mon, 12 Mar 2018 07:09:09 +0000 (09:09 +0200)
src/lib-http/http-client.c

index 8b3ed5083d180c33c0a809abb3de876920e8e65e..a967126293522ff462b3c11dade18ac7cf61eec5 100644 (file)
@@ -537,11 +537,30 @@ void http_client_context_unref(struct http_client_context **_cctx)
        pool_unref(&cctx->pool);
 }
 
+static void
+http_client_context_update_settings(struct http_client_context *cctx)
+{
+       struct http_client *client;
+       bool debug;
+
+       /* revert back to context settings */
+       debug = cctx->set.debug;
+
+       /* merge with available client settings */
+       for (client = cctx->clients_list; client != NULL;
+            client = client->next) {
+               debug = debug || client->set.debug;
+       }
+
+       event_set_forced_debug(cctx->event, debug);
+}
+
 static void
 http_client_context_add_client(struct http_client_context *cctx,
                               struct http_client *client)
 {
        DLLIST_PREPEND(&cctx->clients_list, client);
+       http_client_context_update_settings(cctx);
 }
 
 static void
@@ -549,6 +568,7 @@ http_client_context_remove_client(struct http_client_context *cctx,
                                  struct http_client *client)
 {
        DLLIST_REMOVE(&cctx->clients_list, client);
+       http_client_context_update_settings(cctx);
 }
 
 void http_client_context_switch_ioloop(struct http_client_context *cctx)