W3C home > Mailing lists > Public > public-webapi@w3.org > April 2008

[XHR] Overriding Request Headers with setRequestHeader()

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Wed, 23 Apr 2008 12:42:24 +0200
Message-ID: <480F1290.3040804@lachy.id.au>
To: public-webapi <public-webapi@w3.org>

In the XMLHttpRequest spec, for setRequestHeader(), the spec states:

   "If the header argument is in the list of request headers either use
    multiple headers, combine the values or use a combination of those
    (section 4.2, RFC 2616). [RFC2616]"

And RFC 2616 states:

   "Multiple message-header fields with the same field-name MAY be
    present in a message if and only if the entire field-value for that
    header field is defined as a comma-separated list"

So, what should the UA do for headers that are not defined to be 
comma-separated?  For example, in the case of setting Content-Type twice 
to two different values, does the latter override the former?

[...]
client.setRequestHeader("Content-Type", "text/plain");
client.setRequestHeader("Content-Type", "text/html");
client.send(data);

-- 
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/
Received on Wednesday, 23 April 2008 10:42:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 23 April 2008 10:43:00 GMT