Subject: | Parse failure on BODYSTRUCTURE response with undocumented extension fields |
Hi!
I ran into this in the wild:
* 7 FETCH (BODYSTRUCTURE (("TEXT" "plain" ("charset" "utf-8") NIL NIL "base64" 534 8 NIL NIL NIL NIL NIL NIL)("TEXT" "html" ("charset" "utf-8") NIL NIL "base64" 1266 18 NIL NIL NIL NIL NIL NIL) "alternative" ("boundary" "--_com.samsung.android.email_2722452845804670") NIL NIL NIL NIL NIL) UID 1139)
This came from an Axigen IMAP server (not under my control). As you can see, it has several extraneous NIL fields in each part.
I have read the IMAP specs in rfc3501 and did not see a reference to additional params after body location, but it does say
body location
A string list giving the body content URI as defined in
[LOCATION].
Any following extension data are not yet defined in this
version of the protocol, and would be as described above under
multipart extension data.
That last paragraph gives me enough justification for adding a placeholder for these undefined extension fields. I have prepared a PR in github for your consideration. I did not include the regenerated parsers, because it would add a lot of noise to the PR. If you want, I can still add a commit for that of course.