Browse Source

move the splitting of Multipart messages from the caller into the body of handle_multipart()

MIME-10
Roker 2 years ago
parent
commit
48c224276b
1 changed files with 7 additions and 9 deletions
  1. +7
    -9
      src/bodyparser.cc

+ 7
- 9
src/bodyparser.cc View File

@ -147,8 +147,12 @@ void set_longmsg(message* msg, const Message& m)
}
void handle_multipart(message* msg, const MimeHeaders& mh, const MultipartMessage& mm, unsigned level = 1)
void handle_multipart(message* msg, const MimeHeaders& mh, const BodyLines& body, unsigned level = 1)
{
const sv boundary = header_value(mh.tparams, "boundary");
MultipartMessage mm = parse_multipart( body, boundary );
LOG << "MULTIPART/" << mh.subtype << ": " << mm.size() << " parts. Boundary = “" << boundary << "” :\n";
LOG << "MM.size=" << mm.size() << ", level=" << level << ":\n";
for(const auto& m : mm)
{
@ -162,10 +166,7 @@ void handle_multipart(message* msg, const MimeHeaders& mh, const MultipartMessag
{
if(level < MaxMultipartNestingLevel)
{
const sv boundary = header_value(m.mh.tparams, "boundary");
MultipartMessage mm_nested = parse_multipart( m.body, boundary );
LOG << "MULTIPART/" << m.mh.subtype << ": " << mm.size() << " parts. Boundary = “" << boundary << "” :\n";
handle_multipart(msg, m.mh, mm_nested, level+1);
handle_multipart(msg, m.mh, m.body, level+1);
}else{
add_attachment(msg, m.body, m.mh);
}
@ -215,10 +216,7 @@ void handle_mime(message* msg, const MimeHeaders& mh, const BodyLines& body)
}
}else if(mh.type == "multipart")
{
const sv boundary = header_value(mh.tparams, "boundary");
MultipartMessage mm = parse_multipart( body, boundary );
LOG << "MULTIPART/" << mh.subtype << ": " << mm.size() << " parts. Boundary = “" << boundary << "” :\n";
handle_multipart(msg, mh, mm, 1);
handle_multipart(msg, mh, body, 1);
}else if(mh.type == "message")
{
// TODO: What shall I do with this MimeType?


Loading…
Cancel
Save