aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/str_util.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-07 16:02:01 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-07 16:02:01 +0100
commit65a811fb43b0d0e3557e53c9cf18131e20ba5456 (patch)
tree20f3b694f72c32904d220eb15c622a015d7d695c /src/libutil/str_util.c
parentfcd2daa1c3d0613f6adb9bbb3f7cccac8318cf50 (diff)
downloadrspamd-65a811fb43b0d0e3557e53c9cf18131e20ba5456.tar.gz
rspamd-65a811fb43b0d0e3557e53c9cf18131e20ba5456.zip
[Fix] More fixes to end of headers detection
Diffstat (limited to 'src/libutil/str_util.c')
-rw-r--r--src/libutil/str_util.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/libutil/str_util.c b/src/libutil/str_util.c
index 1ce81bc9e..c39dcb7ee 100644
--- a/src/libutil/str_util.c
+++ b/src/libutil/str_util.c
@@ -1413,7 +1413,7 @@ rspamd_substring_search_twoway (const gchar *in, gint inlen,
goffset
-rspamd_string_find_eoh (GString *input)
+rspamd_string_find_eoh (GString *input, goffset *body_start)
{
const gchar *p, *c = NULL, *end;
enum {
@@ -1459,6 +1459,10 @@ rspamd_string_find_eoh (GString *input)
}
else {
/* We have \r\r[^\n] */
+ if (body_start) {
+ *body_start = p - input->str + 1;
+ }
+
return p - input->str;
}
}
@@ -1474,6 +1478,9 @@ rspamd_string_find_eoh (GString *input)
case got_lf:
if (*p == '\n') {
/* We have \n\n, which is obviously end of headers */
+ if (body_start) {
+ *body_start = p - input->str + 1;
+ }
return p - input->str;
}
else if (*p == '\r') {
@@ -1517,11 +1524,21 @@ rspamd_string_find_eoh (GString *input)
break;
case got_linebreak_lf:
g_assert (c != NULL);
+ if (body_start) {
+ /* \r\n\r\n */
+ *body_start = p - input->str;
+ }
+
return c - input->str;
}
}
if (state == got_linebreak_lf) {
+ if (body_start) {
+ /* \r\n\r\n */
+ *body_start = p - input->str;
+ }
+
return c - input->str;
}