summaryrefslogtreecommitdiffstats
path: root/src/ragel/smtp_date.rl
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-06-14 16:36:20 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-06-14 16:36:20 +0100
commit7e6126e0169e6397d1e9e989433f590398d20fd8 (patch)
tree691986e20bf64a560ce19be6ee77eca154c22189 /src/ragel/smtp_date.rl
parente1955662ec5a6d1b3b6b3d939d7d9be9346aa87d (diff)
downloadrspamd-7e6126e0169e6397d1e9e989433f590398d20fd8.tar.gz
rspamd-7e6126e0169e6397d1e9e989433f590398d20fd8.zip
[Feature] Implement ragel parser for received headers
Diffstat (limited to 'src/ragel/smtp_date.rl')
-rw-r--r--src/ragel/smtp_date.rl27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/ragel/smtp_date.rl b/src/ragel/smtp_date.rl
new file mode 100644
index 000000000..d2efe61a6
--- /dev/null
+++ b/src/ragel/smtp_date.rl
@@ -0,0 +1,27 @@
+%%{
+ machine smtp_date;
+
+ include smtp_whitespace "smtp_whitespace.rl";
+
+ # SMTP date spec
+ # Obtained from: http://tools.ietf.org/html/rfc5322#section_3.3
+
+ digit_2 = digit{2};
+ digit_4 = digit{4};
+ day_name = "Mon" | "Tue" | "Wed" | "Thu" |
+ "Fri" | "Sat" | "Sun";
+ day_of_week = FWS? day_name;
+ day = FWS? digit_2+ FWS;
+ month = "Jan" | "Feb" | "Mar" | "Apr" |
+ "May" | "Jun" | "Jul" | "Aug" |
+ "Sep" | "Oct" | "Nov" | "Dec";
+ year = FWS digit{4,} FWS;
+ date = day month year;
+ hour = digit_2;
+ minute = digit_2;
+ second = digit_2;
+ time_of_day = hour ":" minute ( ":" second );
+ zone = (FWS ( "+" |"_" ) digit_4);
+ time = time_of_day zone;
+ date_time = (day_of_week ",")? date time CFWS?;
+}%% \ No newline at end of file