Hi Dinesh,
The basic approach would be to write a parser for headers and union the
pattern for header names with specific header name values. Have a look
at mailbox1.rl in the test case directory. It is close to what you want.
Regards,
Adrian
On 14-05-19 03:36 PM, dinesh rtp wrote:
Hi,
I am new to ragel and finding it difficult to solve this problem.
I need to check if certain headers exists in the input to ragel machine.
The easier way is to parse header and check if the header I am looking
for is present or not. The problem with this, I need to compare every
header that is present in the input to figure if the headers I am
looking for is present. Is there a way in ragel to say "Given a list of
headers are these headers present in any order" ?
For example:
Input:
|Content-Description: Delivery report
Content-Type: message/delivery-status
Reporting-MTA: dns; xxx
Arrival-Date: Fri, 04 May 2012 15:25:09 +0200
Final-Recipient: rfc822; test-dsn-fail...@gmail.com
Status: 5.1.1
Action: failed
Last-Attempt-Date: Fri, 04 May 2012 15:25:09 +0200
Diagnostic-Code: smtp; 550-5.1.1 The email account that you tried to reach does
not exist. Please try
550-5.1.1 double-checking the recipient's email addressfor typosor
550-5.1.1 unnecessary spaces. Learn more at
550 5.1.1 http://support.google.com/mail/bin/answer.py?answer=6596
t12si10077186weq.36
|
|I just need to check if the headers:|
|Reporting-MTA:|
|Final-Recipient:|
Status:
Action:
are present.
For now I have come with the following:
key = print - [:];
action headerName {headerName.append(1,fc);}
action onHeader {
if (headerName.compare("Reporting-MTA") == 0) {
cout << "Reporting-MTA header is present" << endl;
} else if ...
}
header = key+ @headerName ':' @onHeader;
Is there a easier way to check if these headers exist?
_______________________________________________
ragel-users mailing list
ragel-users@complang.org
http://www.complang.org/mailman/listinfo/ragel-users
_______________________________________________
ragel-users mailing list
ragel-users@complang.org
http://www.complang.org/mailman/listinfo/ragel-users