summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-04-21 19:08:41 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-04-21 19:08:41 +0100
commitcd29781e131de453482ec4193b5df8bcaabbc34a (patch)
tree3ac320306717a21add97aeac1d0448efe88b6f5b /src/client
parent63532aa614b45d67b9bf2ad70745867bbc550339 (diff)
downloadrspamd-cd29781e131de453482ec4193b5df8bcaabbc34a.tar.gz
rspamd-cd29781e131de453482ec4193b5df8bcaabbc34a.zip
[Feature] Allow sending empty requests using client
Diffstat (limited to 'src/client')
-rw-r--r--src/client/rspamc.c10
1 files changed, 9 insertions, 1 deletions
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++) {