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

Re: XHR setting headers

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Wed, 14 May 2008 15:48:33 +0200
To: Julian Reschke <julian.reschke@gmx.de>
Cc: Peter Michaux <petermichaux@gmail.com>, public-webapi@w3.org
Message-ID: <2rql245vt9a5l695pevjlm32ld7add7oj8@hive.bjoern.hoehrmann.de>

* Julian Reschke wrote:
>Peter Michaux wrote:
>> I think all XMLHttpRequest headers should be specified as blank when
>> the object is created. Then the JavaScript can add any headers it
>> needs to add. If, when the call to send() occurs, some essential
>> header(s) is missing the XHMLHttpRequest object should add these
>> automatically but only according to specified behavior.
>The whole "append" semantics is problematic as long as the user can't 
>find out what the current value is.
>IMHO we need either removeRequestHeader(), getRequestHeader(), or both.

I once suggested making setRequestHeader with null remove the stored
value, I am not sure why this has no effect instead. I do note that it
is unlikely that the set of headers the implementation will ultimately
pass on to the next hop will ever be fully deterministic based only on
published specifications. Similarily, I don't think mixing control over
your own headers, and those added or modified by the implementation in
the same API is a good idea: it cannot know whether removeRH is meant
to simply clear a previous setRequestHeader value, or meant to somehow
surpress an implementation default; the implementation also may not be
able to accurately predict the value of certain headers at the point
where the script wants to know them (or what it does report becomes in-
valid because other headers are set by the script). One case here is if
the client learns about certain features of the server only the moment
before the request is dispatched (like whether it supports HTTP/1.1 or
pipelined requests or has some particular bug that needs to be worked
around). So I would suggest a separate API is in order here, if one is
needed at all.
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
Received on Wednesday, 14 May 2008 13:49:19 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:16:26 UTC