diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-07-23 19:34:10 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-07-23 19:34:10 +0100 |
commit | 1f8e3540a3596fd8dcac7aa9026bf8dad2e88613 (patch) | |
tree | 0e359475a9e445541f069b9a82b01234116eb725 /src/ragel | |
parent | f5dcf4b8a4a6a9881d95e4d4b1edd4c27c077d08 (diff) | |
download | rspamd-1f8e3540a3596fd8dcac7aa9026bf8dad2e88613.tar.gz rspamd-1f8e3540a3596fd8dcac7aa9026bf8dad2e88613.zip |
[Fix] Simplify state machine by ignoring multiple spaces
Diffstat (limited to 'src/ragel')
-rw-r--r-- | src/ragel/newlines_strip.rl | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ragel/newlines_strip.rl b/src/ragel/newlines_strip.rl index a2f5620bd..190a759ac 100644 --- a/src/ragel/newlines_strip.rl +++ b/src/ragel/newlines_strip.rl @@ -2,7 +2,8 @@ machine newlines_strip; action Double_CRLF { - if (!crlf_added) { + if (!crlf_added && p > c) { + (*newlines_count)++; g_byte_array_append (data, (const guint8 *)"\n", 1); c = p; } @@ -48,9 +49,8 @@ CRLF = ("\r" . "\n") | ( "\r" ) | ("\n"); DOUBLE_CRLF = (CRLF <: (WSP* CRLF)+) %Double_CRLF; ANY_CRLF = CRLF | DOUBLE_CRLF; - LINE_ELT = ((WSP+ %WSP)** :> ((^space)+) >Text_Start %Text_End <: (WSP+ %WSP)**); - LINE = LINE_ELT+; - TEXT = ANY_CRLF** . (LINE <: ANY_CRLF %Line_CRLF)+ | LINE | ANY_CRLF %Line_CRLF; + LINE = (([^\r\n]+) >Text_Start %Text_End); + TEXT = ANY_CRLF* . (LINE <: ANY_CRLF %Line_CRLF)+ | LINE | ANY_CRLF %Line_CRLF; main := TEXT; }%% |