aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-02-23 20:21:38 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-02-23 20:21:38 +0300
commit44d9cd1d59b340e8111ae57dafd06f65734b12d1 (patch)
tree981154fe56072150f4f31b4f4a7ab288d074eb4a /src
parentcb34e117a397a6d27734cf3564001bfec97ec0ea (diff)
downloadrspamd-44d9cd1d59b340e8111ae57dafd06f65734b12d1.tar.gz
rspamd-44d9cd1d59b340e8111ae57dafd06f65734b12d1.zip
Save separator inside raw_header struct.
Requested by: Victor Ustugov
Diffstat (limited to 'src')
-rw-r--r--src/lua/lua_task.c4
-rw-r--r--src/message.c15
-rw-r--r--src/message.h2
3 files changed, 21 insertions, 0 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 16b59efe4..48db4c833 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -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);
diff --git a/src/message.c b/src/message.c
index 38f9a663e..2056e87ca 100644
--- a/src/message.c
+++ b/src/message.c
@@ -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;
}
diff --git a/src/message.h b/src/message.h
index e5859738a..7ac598460 100644
--- a/src/message.h
+++ b/src/message.h
@@ -49,6 +49,8 @@ struct raw_header {
gchar *name;
gchar *value;
gboolean tab_separated;
+ gboolean empty_separator;
+ gchar *separator;
};
/**