MBOX-Line: From xims at xylon.de  Wed Jan 29 05:57:41 2014
To: imap-protocol@u.washington.edu
From: Xims <xims@xylon.de>
Date: Fri Jun  8 12:34:52 2018
Subject: [Imap-protocol] ABNF Question regarding parsing of BODYSTRUCTURE
	FETCH responses
Message-ID: <b0ab0850338d4c523024e7c6cd274a50@xylon.de>

Dear all,

I seem to be missing a crucial information or some fundamental 
understanding. Probably the latter. :)

I have a standard BODYSTRUCTURE response in the following form (I 
removed the leading stuff):

((("text" "plain" ("charset" "UTF-8") NIL NIL "quoted-printable" 5143 
177 NIL NIL NIL NIL)("text" "html" ("charset" "UTF-8") NIL NIL 
"quoted-printable" 38975 930 NIL NIL NIL NIL) "alternative" ("boundary" 
"----=_NextPart_001_0080_01CEC0E1.57D56320") NIL NIL NIL)("image" "jpeg" 
("name" "image001.jpg") "<image001.jpg@01CE182E.2F3DBAE0>" NIL "base64" 
5634 NIL NIL NIL NIL) "related" ("boundary" 
"----=_NextPart_000_007F_01CEC0E1.57D56320") NIL ("de") NIL)


Now if I follow the ABNF, I get from msg-att-static to body. So far so 
good. But if I look at the body definition, it recursively calls body 
from body-type-mpart (because of the parentheses). But that rule states:

   body-type-mpart = 1*body SP media-subtype [SP body-ext-mpart]


which to me seems as after every body a SP and media-subtype etc should 
follow. So I parse the first body-type-1part correctly, but then my 
parser expects a space afterwards. Where did I go wrong when following 
the ABNF rules or what am I missing?


Thank you a lot in advance and best regards,
Florian


