From: Vsevolod Stakhov Date: Thu, 21 Apr 2016 18:08:41 +0000 (+0100) Subject: [Feature] Allow sending empty requests using client X-Git-Tag: 1.3.0~675 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cd29781e131de453482ec4193b5df8bcaabbc34a;p=rspamd.git [Feature] Allow sending empty requests using client --- 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++) {