mailio
mailio copied to clipboard
problem parsing a header body
I am using master (a7ba9c2) and I have this header which is not being parsed:
Received: from tango.tkos.co.il (tango.tkos.co.il [62.219.50.35])by mx.google.com with ESMTP id 8si5141689fxm.107.2009.03.01.10.19.34;Sun, 01 Mar 2009 10:19:35 -0800 (PST)
Seems like the header field (name) is parsed OK, but it does not pass as header value. Looking into HEADER_VALUE_REGEX and I see /:
- should it be \:
? (BTW, with that change, I can validate the string using online tools - and the line passes. However gcc 11.3 on linux still does not accept this line properly.
My stack trace ends at mime::parse_header_name_value()
.
I cannot reproduce the issue. The following snippet works fine in my case (also Linux):
string msg_str = "From: mailio <[email protected]>\r\n"
"To: mailio <[email protected]>\r\n"
"Received: from tango.tkos.co.il (tango.tkos.co.il [62.219.50.35])by mx.google.com with ESMTP id 8si5141689fxm.107.2009.03.01.10.19.34;Sun, 01 Mar 2009 10:19:35 -0800 (PST)\r\n"
"Subject: Zdravo\r\n"
"\r\n"
"Zdravo, Svete!\r\n";
message msg;
msg.line_policy(codec::line_len_policy_t::MANDATORY, codec::line_len_policy_t::MANDATORY);
msg.parse(msg_str);
auto headers = msg.headers();
cout << headers.begin()->first << endl << headers.begin()->second << endl;
I have a new issue, small snipet to reproduce (you will have to fix parse_content_type()
to public ):
auto s = "video/x-ms-wmv; name=\"11111\"; name=\"׳³ֲ³ײ²ֲ³׳³ֲ³ײ²ֲ³׳³ֲ³ײ²ֲ³ ׳³�\"";
std::string s1;
std::map<std::string, std::string, mailio::mime::attr_comp_t> s2;
mailio::mime m;
mailio::mime::media_type_t mt;
m.parse_content_type(s, mt, s1, s2);
I think that strict mode should enhanced... I modified the case state_t::QATTR_VALUE_BEGIN:
to this code:
if (strict_mode())
throw mime_error("Parsing attribute value failure at `" + string(1, *ch) + "`.");
else
attribute_value += *ch;
EDIT: seems that another problem fails in another of my email... this line breaks parse_header_name_value()
- the HEADER_VALUE_REGEX
does not match:
"Subject: =?windows-1255?Q?=F6=E5=E5=FA_=F9=EC_=F8=E1=F0=E9=ED_=EE=EE=FA=E9=EF?= =?windows-1255?Q?_=EC=EA_=F2=ED_=EB=EC_=E4=FA=F9=E5=E1=E5=FA_=EC=F9?= =?windows-1255?Q?=E0=EC=E5=FA_=F9=EE=E8=F8=E9=E3=E5=FA_=E0=E5=FA=EA?="