[XHR] Content-Type fixups

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[XHR] Content-Type fixups

Cameron McCormack-4

If the Content-Type header has to be fixed up to match the encoding
being used to send a String, what should happen if the user-specified
header is malformed?

  var r = new XMLHttpRequest();
  r.open("POST", "somewhere");
  r.setRequestHeader("Content-Type",
                     "text/plain; a=b; charset==US-ASCII; c=d");
  r.send("something");

Would it be fair for the a=b and c=d parameters to be ditched and the
header replaced with:

  Content-Type: text/plain; charset=UTF-8

?  How about if the type/subtype part is malformed?

--
Cameron McCormack ≝ http://mcc.id.au/