From: Vsevolod Stakhov Date: Sat, 23 Jul 2016 18:34:10 +0000 (+0100) Subject: [Fix] Simplify state machine by ignoring multiple spaces X-Git-Tag: 1.3.0~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f8e3540a3596fd8dcac7aa9026bf8dad2e88613;p=thirdparty%2Frspamd.git [Fix] Simplify state machine by ignoring multiple spaces --- diff --git a/src/ragel/newlines_strip.rl b/src/ragel/newlines_strip.rl index a2f5620bd2..190a759ac2 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; }%%