if (conn != NULL) {
cbdata = g_malloc0 (sizeof (struct rspamc_callback_data));
cbdata->cmd = cmd;
- cbdata->filename = g_strdup (name);
+
+ if (name) {
+ cbdata->filename = g_strdup (name);
+ }
if (cmd->need_input) {
rspamd_client_command (conn, cmd->path, attrs, in, rspamc_client_cb,
- cbdata, compressed, dictionary, &err);
+ cbdata, compressed, dictionary, cbdata->filename, &err);
}
else {
rspamd_client_command (conn,
- cmd->path,
- attrs,
- NULL,
- rspamc_client_cb,
- cbdata,
- compressed,
- dictionary,
- &err);
+ cmd->path,
+ attrs,
+ NULL,
+ rspamc_client_cb,
+ cbdata,
+ compressed,
+ dictionary,
+ cbdata->filename,
+ &err);
}
}
else {
FILE *in, rspamd_client_callback cb,
gpointer ud, gboolean compressed,
const gchar *comp_dictionary,
+ const gchar *filename,
GError **err)
{
struct rspamd_client_request *req;
}
}
+ if (filename) {
+ rspamd_http_message_add_header (req->msg, "Filename", filename);
+ }
+
req->msg->url = rspamd_fstring_append (req->msg->url, "/", 1);
req->msg->url = rspamd_fstring_append (req->msg->url, command, strlen (command));
* @return
*/
gboolean rspamd_client_command (
- struct rspamd_client_connection *conn,
- const gchar *command,
- GQueue *attrs,
- FILE *in,
- rspamd_client_callback cb,
- gpointer ud,
- gboolean compressed,
- const gchar *comp_dictionary,
- GError **err);
+ struct rspamd_client_connection *conn,
+ const gchar *command,
+ GQueue *attrs,
+ FILE *in,
+ rspamd_client_callback cb,
+ gpointer ud,
+ gboolean compressed,
+ const gchar *comp_dictionary,
+ const gchar *filename,
+ GError **err);
/**
* Destroy a connection to rspamd
#include "unix-std.h"
#include "protocol_internal.h"
#include "libserver/mempool_vars_internal.h"
+#include "task.h"
#include <math.h>
static GQuark
task->flags |= RSPAMD_TASK_FLAG_BROKEN_HEADERS;
}
}
+ IF_HEADER (FILENAME_HEADER) {
+ task->msg.fpath = rspamd_mempool_ftokdup (task->task_pool,
+ hv_tok);
+ debug_task ("read filename header, value: %s", task->msg.fpath);
+ }
else {
debug_task ("wrong header: %V", hn);
}
#define TLS_VERSION_HEADER "TLS-Version"
#define MTA_NAME_HEADER "MTA-Name"
#define MILTER_HEADER "Milter"
+#define FILENAME_HEADER "Filename"
#endif //RSPAMD_PROTOCOL_INTERNAL_H