summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/client/rspamc.c7
-rw-r--r--src/libserver/protocol.c11
2 files changed, 11 insertions, 7 deletions
diff --git a/src/client/rspamc.c b/src/client/rspamc.c
index 9c2e1976d..393441925 100644
--- a/src/client/rspamc.c
+++ b/src/client/rspamc.c
@@ -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);
}
diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c
index d735d62fd..0c2937c34 100644
--- a/src/libserver/protocol.c
+++ b/src/libserver/protocol.c
@@ -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);
}