]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Allow sending empty requests using client
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 21 Apr 2016 18:08:41 +0000 (19:08 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 21 Apr 2016 18:08:41 +0000 (19:08 +0100)
src/client/rspamc.c

index 44999ea6510f48de3250bb8331177fbb9d3ab87e..5280914b9ce39b8b4925225a4808bcc200c8ba21 100644 (file)
@@ -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++) {