]> source.dussan.org Git - rspamd.git/commitdiff
Tune extended urls output.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 25 Nov 2014 18:35:22 +0000 (18:35 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 25 Nov 2014 18:35:22 +0000 (18:35 +0000)
src/client/rspamc.c
src/libserver/protocol.c

index 9c2e1976d3d2f70f28a466c72dc6f6ab5317eb97..39344192535f7a2459b0ec05f64aa4879d295010 100644 (file)
@@ -494,7 +494,12 @@ rspamc_symbols_output (ucl_object_t *obj)
                                ucl_object_tostring (cur));
                }
                else if (g_ascii_strcasecmp (ucl_object_key (cur), "urls") == 0) {
-                       emitted = ucl_object_emit (cur, UCL_EMIT_JSON_COMPACT);
+                       if (!extended_urls) {
+                               emitted = ucl_object_emit (cur, UCL_EMIT_JSON_COMPACT);
+                       }
+                       else {
+                               emitted = ucl_object_emit (cur, UCL_EMIT_JSON);
+                       }
                        rspamd_fprintf (stdout, "Urls: %s\n", emitted);
                        free (emitted);
                }
index d735d62fd217ed9461f6b679607b83be942cd073..0c2937c34e1c4f357ca843857fc3f745656f4e03 100644 (file)
@@ -504,13 +504,12 @@ urls_protocol_cb (gpointer key, gpointer value, gpointer ud)
                elt = ucl_object_fromstring (url->string);
                ucl_object_insert_key (obj, elt, "url", 0, false);
 
-               elt = ucl_object_fromlstring (url->host, url->hostlen);
-               ucl_object_insert_key (obj, elt, "host", 0, false);
-
-               elt = ucl_object_fromlstring (url->data, url->datalen);
-               ucl_object_insert_key (obj, elt, "data", 0, false);
+               if (url->hostlen > 0) {
+                       elt = ucl_object_fromlstring (url->host, url->hostlen);
+                       ucl_object_insert_key (obj, elt, "host", 0, false);
+               }
 
-               if (url->surbl) {
+               if (url->surbllen > 0) {
                        elt = ucl_object_fromlstring (url->surbl, url->surbllen);
                        ucl_object_insert_key (obj, elt, "surbl", 0, false);
                }