- From: Hallvord R. M. Steen <hallvord@opera.com>
- Date: Tue, 12 Feb 2008 19:45:53 +0100
- To: "Alexey Proskuryakov" <ap@webkit.org>
- Cc: "Web API WG (public)" <public-webapi@w3.org>
>>> http://tc.labs.opera.com/apis/XMLHttpRequest/setRequestHeader/001.htm
>>
>> Hm.. This passes in some browsers for me. It fails in Firefox (and
>> correctly outputs failed). It passes in Opera and IE7. I can't even
>> figure out why it fails in Safari - it doesn't send the request..
> With shipping Mac Safari, I see the request being sent.
Yes, happens for me too today. Don't know what my Safari was up to
yesterday - XMLHttp fatigue after too many tests in a row? :-p
> The failure looks like a bug in the test script: HTTP headers are
> case-insensitive, but it only allows "x-custom-header", not
> "X-Custom-Header".
I'm not so sure. Given the
setRequestHeader('x-custom-header', 'foo');
do we want to allow browsers to camelcase the header name whenever it
pleases them? Since some do and some don't this would be an obvious source
of compatibility issues. The spec doesn't say anything but maybe we should
choose one or the other and update the spec?
I'd consider Safari's current behaviour a nasty gotcha for developers, so
I'd like the spec to say case of strings passed to setRequestHeader must
be preserved. It does create corner cases like
setRequestHeader('x-test','foo');setRequestHeader('X-Test','bar') though.
In that case I'd say use the case the header was first set with. Suggested
text changes, marking my changes with <ins>/<del>:
Step 8 and 9 of setRequestHeader algorithm:
<p>If the <var>header</var> argument is not in the list of request
headers <ins>when doing a case-insensitive comparison with all
current header names,</ins>
append the <var>header</var> with its associated
<var>value</var> to the list and terminate these steps. <ins>Case
of the header string must be preserved.</ins>
<li>
<p>If the <var>header</var> argument <del>is in the list
of</del><ins>case-insensitively matches one of the</ins> request headers
either use multiple headers, combine the values or use a combination
of those (section 4.2, RFC 2616). [<cite><a
href="#ref-rfc2616">RFC2616</a></cite>]
--
Hallvord R. M. Steen
Core QA JavaScript tester, Opera Software
http://www.opera.com/
Opera - simply the best Internet experience
Received on Tuesday, 12 February 2008 18:45:20 UTC