From: Vsevolod Stakhov Date: Tue, 25 Aug 2015 15:48:10 +0000 (+0100) Subject: Insert query arguments as http headers. X-Git-Tag: 1.0.0~164 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6f3d45840be0c65cb451ba4f163c5f22697c7c63;p=rspamd.git Insert query arguments as http headers. --- diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c index 0928f0ad0..162f75f40 100644 --- a/src/libserver/protocol.c +++ b/src/libserver/protocol.c @@ -150,11 +150,13 @@ rspamd_protocol_handle_url (struct rspamd_task *task, { GList *cur; GHashTable *query_args; + GHashTableIter it; struct custom_command *cmd; struct http_parser_url u; const gchar *p; gsize pathlen; - GString lookup, *res; + GString lookup, *res, *key, *value; + gpointer k, v; if (msg->url == NULL || msg->url->len == 0) { g_set_error (&task->err, rspamd_protocol_quark(), 400, "missing command"); @@ -278,6 +280,17 @@ rspamd_protocol_handle_url (struct rspamd_task *task, task->flags |= RSPAMD_TASK_FLAG_FILE; + /* Insert the rest of query params as HTTP headers */ + g_hash_table_iter_init (&it, query_args); + + while (g_hash_table_iter_next (&it, &k, &v)) { + key = k; + value = v; + /* Steal strings */ + g_hash_table_iter_steal (&it); + g_hash_table_insert (task->request_headers, key, value); + } + g_hash_table_unref (query_args); }