]> source.dussan.org Git - rspamd.git/commitdiff
Save separator inside raw_header struct.
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Wed, 23 Feb 2011 17:21:38 +0000 (20:21 +0300)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Wed, 23 Feb 2011 17:21:38 +0000 (20:21 +0300)
Requested by: Victor Ustugov

src/lua/lua_task.c
src/message.c
src/message.h

index 16b59efe403eedd5f08bb3e89978a7db29ac190c..48db4c8333491ce54a2ab139de10cd17c3e08df8 100644 (file)
@@ -358,6 +358,10 @@ lua_task_get_raw_header_common (lua_State * L, gboolean strong)
                        lua_pushstring (L, "tab_separated");
                        lua_pushboolean (L, rh->tab_separated);
                        lua_settable (L, -3);
+                       lua_pushstring (L, "empty_separator");
+                       lua_pushboolean (L, rh->empty_separator);
+                       lua_settable (L, -3);
+                       lua_set_table_index (L, "separator", rh->separator);
                        lua_rawseti (L, -2, i++);
                        /* Process next element */
                        cur = g_list_next (cur);
index 38f9a663ec441453abfed45c5f55b4f2f5965710..2056e87ca5bdb39661f312ff090feb53604582ad 100644 (file)
@@ -499,6 +499,7 @@ process_raw_headers (struct worker_task *task)
                                new->name = tmp;
                                p ++;
                                state = 2;
+                               c = p;
                        }
                        else if (g_ascii_isspace (*p)) {
                                /* Not header but some garbadge */
@@ -513,20 +514,34 @@ process_raw_headers (struct worker_task *task)
                        /* We got header's name, so skip any \t or spaces */
                        if (*p == '\t') {
                                new->tab_separated = TRUE;
+                               new->empty_separator = FALSE;
                                p ++;
                        }
                        else if (*p == ' '){
+                               new->empty_separator = FALSE;
                                p ++;
                        }
                        else if (*p == '\n' || *p == '\r') {
                                /* Process folding */
                                state = 99;
+                               l = p - c - 1;
+                               if (l > 0) {
+                                       tmp = memory_pool_alloc (task->task_pool, l + 1);
+                                       rspamd_strlcpy (tmp, c, l + 1);
+                                       new->separator = tmp;
+                               }
                                next_state = 3;
                                err_state = 5;
                                c = p;
                        }
                        else {
                                /* Process value */
+                               l = p - c - 1;
+                               if (l > 0) {
+                                       tmp = memory_pool_alloc (task->task_pool, l + 1);
+                                       rspamd_strlcpy (tmp, c, l + 1);
+                                       new->separator = tmp;
+                               }
                                c = p;
                                state = 3;
                        }
index e5859738a40719c27a35d54113b2386e47700f1c..7ac598460940e1705b4ec7622e56cd47b888cc49 100644 (file)
@@ -49,6 +49,8 @@ struct raw_header {
        gchar *name;
        gchar *value;
        gboolean tab_separated;
+       gboolean empty_separator;
+       gchar *separator;
 };
 
 /**