Skip to content
Snippets Groups Projects
Commit 73cd1fdd authored by rswindell's avatar rswindell
Browse files

Fixed head field property name.

Now supports folded header fields.
parent 5482edc5
No related branches found
No related tags found
No related merge requests found
......@@ -9,13 +9,17 @@
// msgtxt is an array of lines from the source (RFC822) message text
function parse_msg_header(msgtxt)
{
var last_field;
var hdr={};
for(i in msgtxt) {
if(msgtxt[i].length==0) /* Header delimiter */
if(msgtxt[i].length==0) // Header terminator
break;
var match = msgtxt[i].match(/\s*(\S+)\s*:\s*(.*)/);
hdr[match[0]]=match[1];
var match = msgtxt[i].match(/(\S+)\s*:\s*(.*)/);
if(match)
hdr[last_field=match[1]]=match[2];
else if(last_field) // Folded header field
hdr[last_field]+=msgtxt[i];
}
return(hdr);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment