Re: FormData questions

Just to follow up on this one more time with regards to the current state  
of the specification.

On Sat, 13 Feb 2010 02:32:18 +0100, Jonas Sicking <jonas@sicking.cc> wrote:
> First of all, I assume that it is intended that a FromData object can
> be submitted several times. I.e. that the following code is ok:
>
> fd = new FormData;
> fd.append("name1", "foo");
> xhr1 = new XMLHttpRequest;
> xhr1.open(...);
> xhr1.send(fd);
> fd.append("name2", "bar");
> xhr2 = new XMLHttpRequest;
> xhr2.open(...);
> xhr2.send(fd);
>
> where the first XHR will send 1 name/value pair, and the second XHR
> will send 2. I do think this should be allowed, but I wanted to make
> sure others agreed.

Yes, the object does not suddenly become immutable.


> Second, what encoding should be used when submitting a FromData
> object? A few options are:
> * Always use UTF-8

It is now clear that it should always be UTF-8.


> Lastly, there is a bug in the spec where it says that the mimetype
> should be "multipart/form-data". It needs to be "multipart/form-data;
> boundary=" plus the boundary used while encoding.

Hmm yeah. XMLHttpRequest is using the "multipart/form-data encoding  
algorithm" from HTML. I guess that should return the boundary used somehow  
so I can use that. I filed a bug:

http://www.w3.org/Bugs/Public/show_bug.cgi?id=12006


> This also brings up
> the question what to do if a Content-Type header has already been set.
> Should a boundary mime parameter be added, or is the server side
> simply out of luck and won't get to know what the boundary is?

Per the current specification it is simply out of luck. Consistent with  
how we handle this for other type of objects passed to send().


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Tuesday, 8 February 2011 09:35:34 UTC