[whatwg/fetch] Clarification of Body package data algorithm with bytes, FormData and multipart/form-data MIME type (#392)

The Body package data algorithm with bytes, FormData and multipart/form-data MIME type step 1 says
> Parse bytes, using the value of the `boundary` parameter from MIME type and utf-8 as encoding, per the rules set forth in Returning Values from Forms: multipart/form-data. [RFC2388]

That is not very detailed parsing specification.
While implementing the algorithm for Chromium, I ran into interpretation issues.
My main question is how to parse different kind of multipart parts.

Parts whose Content-Disposition header field contains a filename parameter must surely be parsed into **Blob**s. That is what Mozilla does.

What about multipart parts which have a Content-Type header field but whose Content-Disposition header field does not contain a filename parameter? To my understanding, it is not possible to construct such parts with **FormData** because **USVString**s will never generate a Content-Type header field and **Blob**s have a default file name ("blob"). Should these parts be parsed into **Blob**s in spite of the missing filename parameter?

Should a multipart part with a name "_charset_" have no effect on decoding encoding?
I think that probably yes, because RFC2388 does not even describe that name (but RFC7578 does) and because  the body package data algorithm with bytes, FormData and application/x-www-form-urlencoded MIME type runs the application/x-www-form-urlencoded parser steps with a use_charset_flag implicitly unset thus it does not change decoding encoding based on the "_charset_" component.

If string parts can never have a Content-Type header field, they can never have a charset parameter either. The multipart part with a name "_charset_" does not seem to have an effect on decoding, either. Does it thus follow that string parts must always be decoded using utf-8 encoding?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/392

Received on Thursday, 29 September 2016 14:48:48 UTC