aboutsummaryrefslogtreecommitdiffstats
path: root/src/ragel
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-12-21 14:18:42 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-12-21 14:18:42 +0000
commit81e8e5e413ad8ba9dfb8b8f7da5ab2939dac4534 (patch)
treea14b6ebb14c83f03c8dd056b7be4a4843cd56b51 /src/ragel
parentd73a3db2211150ec12bd3c91e7e78b74b6ad19a0 (diff)
downloadrspamd-81e8e5e413ad8ba9dfb8b8f7da5ab2939dac4534.tar.gz
rspamd-81e8e5e413ad8ba9dfb8b8f7da5ab2939dac4534.zip
[Feature] Use own code for parsing of date
Diffstat (limited to 'src/ragel')
-rw-r--r--src/ragel/smtp_date_parser.rl28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/ragel/smtp_date_parser.rl b/src/ragel/smtp_date_parser.rl
new file mode 100644
index 000000000..84b63f1bd
--- /dev/null
+++ b/src/ragel/smtp_date_parser.rl
@@ -0,0 +1,28 @@
+%%{
+
+ machine smtp_date_parser;
+ include smtp_date "smtp_date.rl";
+
+ main := date_time;
+}%%
+
+#include "smtp_parsers.h"
+#include "util.h"
+
+%% write data;
+
+guint64
+rspamd_parse_smtp_date (const char *data, size_t len)
+{
+ const gchar *p = data, *pe = data + len, *eof = data + len, *tmp = data;
+ struct tm tm;
+ glong tz = 0;
+ gint cs = 0;
+
+ memset (&tm, 0, sizeof (tm));
+
+ %% write init;
+ %% write exec;
+
+ return rspamd_tm_to_time (&tm, tz);
+} \ No newline at end of file