Sfoglia il codice sorgente

[Feature] Allow to specify custom User-Agent for rspamc

tags/1.6.2
Vsevolod Stakhov 7 anni fa
parent
commit
3b8cd37388
1 ha cambiato i file con 7 aggiunte e 2 eliminazioni
  1. 7
    2
      src/client/rspamc.c

+ 7
- 2
src/client/rspamc.c Vedi File

@@ -63,6 +63,7 @@ static gboolean profile = FALSE;
static gboolean skip_images = FALSE;
static gboolean skip_attachments = FALSE;
static gchar *key = NULL;
static gchar *user_agent = "rspamc";
static GList *children;

#define ADD_CLIENT_HEADER(o, n, v) do { \
@@ -131,7 +132,7 @@ static GOptionEntry entries[] =
"Use specified pubkey to encrypt request", NULL },
{ "exec", 'e', 0, G_OPTION_ARG_STRING, &execute,
"Execute the specified command and pass output to it", NULL },
{ "mime", 'e', 0, G_OPTION_ARG_NONE, &mime_output,
{ "mime", 'm', 0, G_OPTION_ARG_NONE, &mime_output,
"Write mime body of message with headers instead of just a scan's result", NULL },
{"header", 0, 0, G_OPTION_ARG_STRING_ARRAY, &http_headers,
"Add custom HTTP header to query (can be repeated)", NULL},
@@ -151,6 +152,8 @@ static GOptionEntry entries[] =
"Skip images when learning/unlearning fuzzy", NULL },
{ "skip-attachments", '\0', 0, G_OPTION_ARG_NONE, &skip_attachments,
"Skip attachments when learning/unlearning fuzzy", NULL },
{ "user-agent", 'U', 0, G_OPTION_ARG_STRING, &user_agent,
"Use specific User-Agent instead of \"rspamc\"", NULL },
{ NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
};

@@ -553,7 +556,9 @@ add_options (GQueue *opts)
GString *numbuf;
gchar **hdr, **rcpt;

ADD_CLIENT_HEADER (opts, "User-Agent", "rspamc");
if (user_agent) {
ADD_CLIENT_HEADER (opts, "User-Agent", user_agent);
}

if (ip != NULL) {
rspamd_inet_addr_t *addr = NULL;

Loading…
Annulla
Salva