From cd29781e131de453482ec4193b5df8bcaabbc34a Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 21 Apr 2016 19:08:41 +0100 Subject: [PATCH] [Feature] Allow sending empty requests using client --- src/client/rspamc.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/client/rspamc.c b/src/client/rspamc.c index 44999ea65..5280914b9 100644 --- a/src/client/rspamc.c +++ b/src/client/rspamc.c @@ -55,6 +55,7 @@ static gboolean headers = FALSE; static gboolean raw = FALSE; static gboolean extended_urls = FALSE; static gboolean mime_output = FALSE; +static gboolean empty_input = FALSE; static gchar *key = NULL; static GList *children; @@ -125,6 +126,8 @@ static GOptionEntry entries[] = "Add custom HTTP header to query (can be repeated)", NULL}, {"sort", 0, 0, G_OPTION_ARG_STRING, &sort, "Sort output in a specific order (name, weight, time)", NULL}, + { "empty", 'E', 0, G_OPTION_ARG_NONE, &empty_input, + "Allow empty input instead of reading from stdin", NULL }, { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL } }; @@ -1466,7 +1469,12 @@ main (gint argc, gchar **argv, gchar **env) if (start_argc == argc) { /* Do command without input or with stdin */ - rspamc_process_input (ev_base, cmd, in, "stdin", kwattrs); + if (empty_input) { + rspamc_process_input (ev_base, cmd, NULL, "empty", kwattrs); + } + else { + rspamc_process_input (ev_base, cmd, in, "stdin", kwattrs); + } } else { for (i = start_argc; i < argc; i++) { -- 2.39.5