Discussion:
XHR LC comments
Julian Reschke
2008-05-04 09:47:13 UTC
Permalink
Review of <http://www.w3.org/TR/2008/WD-XMLHttpRequest-20080415/>.

General points:

a) I'm confused about the approach to this document. On the one hand,
we're being told that it can't define anything not already in use (and
that new stuff belongs into XHR2), on the other hand it relies on HTML5,
which is a moving target. It's good that this stuff is being written
down, but if it relies on HTML5, I'd propose to consider other
publication options.

b) Algorithms: the spec uses a method to describe algorithms that IMHO
is extremely hard to read (see for instance send() method). This may be
good for implementors, but seems to be bad for everybody else.
Minimally, the lists should be structured for better readability.

c) Structure: It would be nice if Section 4 had more structure. Right
now it's ugly to navigate and refer to.



2.1 Dependencies

"DOM

A conforming user agent must support some subset of the
functionality defined in DOM Events and DOM Core that this specification
relies upon. [DOM2Events] [DOM3Core]"

That reads a bit strange. Must the subset be non-empty?


2.2 Terminology

"Two URIs are same-origin if after performing scheme-based normalization
on both URIs as described in section 5.3.3 of RFC 3987 the scheme, ihost
and port components are identical. If either URI does not have an ihost
component the URIs must not be considered same-origin. [RFC3987]"

Why are we referring to the IRI spec (RFC3987) when talking about URIs,
as defined RFC3986?


3. Security Considerations

"Apart from requirements affecting security made throughout this
specification implementations may, at their discretion, not expose
certain headers, such as HttpOnly cookies."

"...such as headers containing HttpOnly cookies".

Besides that: this may be a non-optimal example unless we can point to a
definition of "HttpOnly cookies". Can we?


4. The XMLHttpRequest Object

"onreadystatechange of type EventListener

This attribute is an event handler DOM attribute and must be
invoked whenever a readystatechange event is targated at the object."

s/targated/targeted/

"If stored method case-insensitively matches CONNECT, DELETE, GET,
HEAD, OPTIONS POST, PUT, TRACE, or TRACK let stored method be the
canonical uppercase form of the matched method name."

- missing comma after OPTIONS
- TRACK??? There's probably a rational for that. If there is, please
include it in the spec.


"If the user argument was not omitted and is not null let stored user be
user encoded using the encoding specified in the relevant
authentication scheme or UTF-8 if the scheme fails to specify an encoding."

Why is XHR talking about the encoding here? Is "stored user" a string or
a byte array?

(same for password)


"Abort the send() algorithm, set response entity body to "null" and
reset the list of request headers."

This is a very confusing statement, until one realizes that it's in the
description of "open", not "send". It would be good to rephrase this so
it becomes clear that this aborts a *previous* send request.



"If the value argument is null terminate these steps. (Do not raise an
exception.)."

This makes it impossible to set empty headers, which are allowed in
HTTP. Even worse, it silently fails.

This is profiling of the base spec, and I don't see any compelling
reason to do so. Don't do it.


"For security reasons, these steps should be terminated if the header
argument case-insensitively matches one of the following headers:

* Accept-Charset
* Accept-Encoding
* Connection
* Content-Length
* Content-Transfer-Encoding
* Date
* Expect
* Host
* Keep-Alive
* Referer
* TE
* Trailer
* Transfer-Encoding
* Upgrade
* Via "

It's unclear why there's a security reason not to allow things like
"Accept-Charset" or "Accept-Encoding". Please explain.


General comment on "setRequestHeader(header, value), method": the way it
is specified makes it impossible for a client to reliably set headers.
We need a way to either retrieve the current value for inspection, or a
way to reset the header. Or both.


"If stored method is GET act as if the data argument is null."

Another case of HTTP/1.1 being profiled. Don't do it.


"Serialize data into a namespace well-formed XML document and encoded
using the encoding given by data.inputEncoding, when not null, or UTF-8
otherwise. Or, if this fails because the Document cannot be serialized
act as if data is null."

Silent failure????


"If no Content-Type header has been set using setRequestHeader() append
a Content-Type header to the list of request headers with a value of
application/xml;charset=charset where charset is the encoding used to
encode the document."

This will result in an invalid Content-Type header if the UA has
initialized the headers with a default (which I think the spec currently
allows; and at least one UA was reported to do). See comment above about
header handling.


"While downloading the resource the following rules are to be observed."

That reads strange. HTTP requests do not "download" resources. Say
"while executing the request".


"If the user agent supports HTTP State Management it should persist,
discard and send cookies (as received in the Set-Cookie and Set-Cookie2
response headers, and sent in the Cookie header) as applicable. [RFC2965]"

This should probably include a reference to the Set-Cookie (not
Set-Cookie2) spec as well (RFC2109).


"If the user agent implements server-driven content-negotiation it
should set Accept-Encoding and Accept-Charset headers as appropriate; it
must not automatically set the Accept."

s/set the Accept/set the Accept header/


"Responses to such requests must have the content-encodings
automatically decoded. [RFC2616]"

"Such requests" is a bit fuzzy here. Please rephrase in terms of what
the response contains (such as Content-Encoding header being present etc).


"// The following script:
var client = new XMLHttpRequest();
client.open("GET", "test.txt", true);
client.send();
client.onreadystatechange = function() {
if(this.readyState == 3) {
print(this.getAllResponseHeaders());
}
}

// ...should output something similar to the following text:
Date: Sun, 24 Oct 2004 04:58:38 GMT
Server: Apache/1.3.31 (Unix)
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/plain; charset=utf-8"

I think examples like this would be more readable (and take less space)
when using the syncr. mode.


"status of type unsigned short, readonly

On getting, if available, it must return the HTTP status code sent by
the server (typically 200 for a successful request). Otherwise, if not
available, the user agent must raise an INVALID_STATE_ERR exception."

This may be incorrect when the UA caches (304 vs 200).


"statusText of type DOMString, readonly

On getting, if available, it must return the HTTP status text sent
by the server (appears after the status code). Otherwise, if not
available, the user agent must raise an INVALID_STATE_ERR exception."

Really? It seems to me that if somebody really implements this, clients
are likely to break. Why not allow an empty string here?


Finally, my main other issue with this spec that it is silent about the
recommended behaviour for unsafe methods, about which RFC2616 says in
Section 9.1.1
(<http://greenbytes.de/tech/webdav/rfc2616.html#rfc.section.9.1.1>):

"Implementors should be aware that the software represents the user in
their interactions over the Internet, and should be careful to allow the
user to be aware of any actions they might take which may have an
unexpected significance to themselves or others.

In particular, the convention has been established that the GET and HEAD
methods SHOULD NOT have the significance of taking an action other than
retrieval. These methods ought to be considered "safe". This allows user
agents to represent other methods, such as POST, PUT and DELETE, in a
special way, so that the user is made aware of the fact that a possibly
unsafe action is being requested."

Thus, allowing a web page to submit a PUT, POST or DELETE request
without user interaction seems to be a very dangerous thing to me, and
the spec should point that out (see also
<http://ietf.osafoundation.org:8080/bugzilla/show_bug.cgi?id=237>).
Sunava Dutta
2008-05-05 21:58:35 UTC
Permalink
Julian Reschke wrote:
a) I'm confused about the approach to this document. On the one hand,
we're being told that it can't define anything not already in use (and
that new stuff belongs into XHR2), on the other hand it relies on HTML5,
which is a moving target. It's good that this stuff is being written
down, but if it relies on HTML5, I'd propose to consider other
publication options.
+1. I had suggested something along the lines of not linking to other specifications that are moving targets but other publication options if we do decide to go this route are fine.
"Ensure all new entities like constants, flags etc are versioned or in a new object.
The draft frequently cross references specifications in the W3C.For example, the spec makes references to the DOM 3 events and core, namespaces in XML, Window Object 1.0 etc (Some of which are drafts themselves). We fail to see the value in implicitly embedding other large specs. Simplicity and standing on its own would be good."

Julian Reschke wrote:

b) Algorithms: the spec uses a method to describe algorithms that IMHO
is extremely hard to read (see for instance send() method). This may be
good for implementors, but seems to be bad for everybody else.
Minimally, the lists should be structured for better readability.
+1
Julian Reschke wrote:
c)
"- TRACK??? There's probably a rational for that. If there is, please
include it in the spec."
TRACK is unsafe and should be removed. I remember reading about this awhile back. Here's something I found on the web: http://www.aqtronix.com/Advisories/AQ-2003-02.txt
Julian Reschke wrote:
d)
""If the user argument was not omitted and is not null let stored user be
user encoded using the encoding specified in the relevant
authentication scheme or UTF-8 if the scheme fails to specify an encoding."

Why is XHR talking about the encoding here? Is "stored user" a string or
a byte array?

(same for password)"
+1. I'm not quite sure what this means and the relevancy.
Julian Reschke wrote:
e)
"For security reasons, these steps should be terminated if the header
argument case-insensitively matches one of the following headers:

* Accept-Charset
* Accept-Encoding
* Connection
* Content-Length
* Content-Transfer-Encoding
* Date
* Expect
* Host
* Keep-Alive
* Referer
* TE
* Trailer
* Transfer-Encoding
* Upgrade
* Via "

It's unclear why there's a security reason not to allow things like
"Accept-Charset" or "Accept-Encoding". Please explain."
+1. I've given this feedback before but haven't heard back anything. We should mention why these are bad and also consider what is currently allowed today by UA's.
http://lists.w3.org/Archives/Public/public-webapi/2008Apr/0191.html




-----Original Message-----
From: public-webapi-***@w3.org [mailto:public-webapi-***@w3.org] On Behalf Of Julian Reschke
Sent: Sunday, May 04, 2008 2:47 AM
To: public-***@w3.org
Subject: XHR LC comments


Review of <http://www.w3.org/TR/2008/WD-XMLHttpRequest-20080415/>.

General points:

a) I'm confused about the approach to this document. On the one hand,
we're being told that it can't define anything not already in use (and
that new stuff belongs into XHR2), on the other hand it relies on HTML5,
which is a moving target. It's good that this stuff is being written
down, but if it relies on HTML5, I'd propose to consider other
publication options.

b) Algorithms: the spec uses a method to describe algorithms that IMHO
is extremely hard to read (see for instance send() method). This may be
good for implementors, but seems to be bad for everybody else.
Minimally, the lists should be structured for better readability.

c) Structure: It would be nice if Section 4 had more structure. Right
now it's ugly to navigate and refer to.



2.1 Dependencies

"DOM

A conforming user agent must support some subset of the
functionality defined in DOM Events and DOM Core that this specification
relies upon. [DOM2Events] [DOM3Core]"

That reads a bit strange. Must the subset be non-empty?


2.2 Terminology

"Two URIs are same-origin if after performing scheme-based normalization
on both URIs as described in section 5.3.3 of RFC 3987 the scheme, ihost
and port components are identical. If either URI does not have an ihost
component the URIs must not be considered same-origin. [RFC3987]"

Why are we referring to the IRI spec (RFC3987) when talking about URIs,
as defined RFC3986?


3. Security Considerations

"Apart from requirements affecting security made throughout this
specification implementations may, at their discretion, not expose
certain headers, such as HttpOnly cookies."

"...such as headers containing HttpOnly cookies".

Besides that: this may be a non-optimal example unless we can point to a
definition of "HttpOnly cookies". Can we?


4. The XMLHttpRequest Object

"onreadystatechange of type EventListener

This attribute is an event handler DOM attribute and must be
invoked whenever a readystatechange event is targated at the object."

s/targated/targeted/

"If stored method case-insensitively matches CONNECT, DELETE, GET,
HEAD, OPTIONS POST, PUT, TRACE, or TRACK let stored method be the
canonical uppercase form of the matched method name."

- missing comma after OPTIONS
- TRACK??? There's probably a rational for that. If there is, please
include it in the spec.


"If the user argument was not omitted and is not null let stored user be
user encoded using the encoding specified in the relevant
authentication scheme or UTF-8 if the scheme fails to specify an encoding."

Why is XHR talking about the encoding here? Is "stored user" a string or
a byte array?

(same for password)


"Abort the send() algorithm, set response entity body to "null" and
reset the list of request headers."

This is a very confusing statement, until one realizes that it's in the
description of "open", not "send". It would be good to rephrase this so
it becomes clear that this aborts a *previous* send request.



"If the value argument is null terminate these steps. (Do not raise an
exception.)."

This makes it impossible to set empty headers, which are allowed in
HTTP. Even worse, it silently fails.

This is profiling of the base spec, and I don't see any compelling
reason to do so. Don't do it.


"For security reasons, these steps should be terminated if the header
argument case-insensitively matches one of the following headers:

* Accept-Charset
* Accept-Encoding
* Connection
* Content-Length
* Content-Transfer-Encoding
* Date
* Expect
* Host
* Keep-Alive
* Referer
* TE
* Trailer
* Transfer-Encoding
* Upgrade
* Via "

It's unclear why there's a security reason not to allow things like
"Accept-Charset" or "Accept-Encoding". Please explain.


General comment on "setRequestHeader(header, value), method": the way it
is specified makes it impossible for a client to reliably set headers.
We need a way to either retrieve the current value for inspection, or a
way to reset the header. Or both.


"If stored method is GET act as if the data argument is null."

Another case of HTTP/1.1 being profiled. Don't do it.


"Serialize data into a namespace well-formed XML document and encoded
using the encoding given by data.inputEncoding, when not null, or UTF-8
otherwise. Or, if this fails because the Document cannot be serialized
act as if data is null."

Silent failure????


"If no Content-Type header has been set using setRequestHeader() append
a Content-Type header to the list of request headers with a value of
application/xml;charset=charset where charset is the encoding used to
encode the document."

This will result in an invalid Content-Type header if the UA has
initialized the headers with a default (which I think the spec currently
allows; and at least one UA was reported to do). See comment above about
header handling.


"While downloading the resource the following rules are to be observed."

That reads strange. HTTP requests do not "download" resources. Say
"while executing the request".


"If the user agent supports HTTP State Management it should persist,
discard and send cookies (as received in the Set-Cookie and Set-Cookie2
response headers, and sent in the Cookie header) as applicable. [RFC2965]"

This should probably include a reference to the Set-Cookie (not
Set-Cookie2) spec as well (RFC2109).


"If the user agent implements server-driven content-negotiation it
should set Accept-Encoding and Accept-Charset headers as appropriate; it
must not automatically set the Accept."

s/set the Accept/set the Accept header/


"Responses to such requests must have the content-encodings
automatically decoded. [RFC2616]"

"Such requests" is a bit fuzzy here. Please rephrase in terms of what
the response contains (such as Content-Encoding header being present etc).


"// The following script:
var client = new XMLHttpRequest();
client.open("GET", "test.txt", true);
client.send();
client.onreadystatechange = function() {
if(this.readyState == 3) {
print(this.getAllResponseHeaders());
}
}

// ...should output something similar to the following text:
Date: Sun, 24 Oct 2004 04:58:38 GMT
Server: Apache/1.3.31 (Unix)
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/plain; charset=utf-8"

I think examples like this would be more readable (and take less space)
when using the syncr. mode.


"status of type unsigned short, readonly

On getting, if available, it must return the HTTP status code sent by
the server (typically 200 for a successful request). Otherwise, if not
available, the user agent must raise an INVALID_STATE_ERR exception."

This may be incorrect when the UA caches (304 vs 200).


"statusText of type DOMString, readonly

On getting, if available, it must return the HTTP status text sent
by the server (appears after the status code). Otherwise, if not
available, the user agent must raise an INVALID_STATE_ERR exception."

Really? It seems to me that if somebody really implements this, clients
are likely to break. Why not allow an empty string here?


Finally, my main other issue with this spec that it is silent about the
recommended behaviour for unsafe methods, about which RFC2616 says in
Section 9.1.1
(<http://greenbytes.de/tech/webdav/rfc2616.html#rfc.section.9.1.1>):

"Implementors should be aware that the software represents the user in
their interactions over the Internet, and should be careful to allow the
user to be aware of any actions they might take which may have an
unexpected significance to themselves or others.

In particular, the convention has been established that the GET and HEAD
methods SHOULD NOT have the significance of taking an action other than
retrieval. These methods ought to be considered "safe". This allows user
agents to represent other methods, such as POST, PUT and DELETE, in a
special way, so that the user is made aware of the fact that a possibly
unsafe action is being requested."

Thus, allowing a web page to submit a PUT, POST or DELETE request
without user interaction seems to be a very dangerous thing to me, and
the spec should point that out (see also
<http://ietf.osafoundation.org:8080/bugzilla/show_bug.cgi?id=237>).
Julian Reschke
2008-05-06 07:34:25 UTC
Permalink
Sunava,

it would be helpful if you'd use a mail client that can properly quote
:-) In your mail your text appears as if it was indirectly quoted by
myself... I have reformatted your reply so it becomes clear again who
said what.
Post by Sunava Dutta
c)
"- TRACK??? There's probably a rational for that. If there is, please
include it in the spec."
TRACK is unsafe and should be removed. I remember reading about this awhile back. Here's something I found on the web: http://www.aqtronix.com/Advisories/AQ-2003-02.txt
That implies that Microsoft closed the vulnerability with IIS 6.0, so
I'm not entirely sure why a spec in last call in 2008 needs to speak
about it.

There are surely other old servers that have other vulnerabilities that
could be exploited using XHR, should we consider all of these?

That being said, I'm ok with *mentioning* the issue somewhere, but just
enumerating TRACK along with TRACE, as if this was a standard HTTP
method, is *highly* confusing.
...
BR, Julian
Sunava Dutta
2008-05-06 18:34:20 UTC
Permalink
Ahh, I see my mail client can do that. I just need to make a few changes. Having a standardized guidance here would be very helpful -:p.


-----Original Message-----
From: Julian Reschke [mailto:***@gmx.de]
Sent: Tuesday, May 06, 2008 12:34 AM
To: Sunava Dutta
Cc: public-***@w3.org; IE8 Core AJAX SWAT Team
Subject: Re: XHR LC comments

Sunava,

it would be helpful if you'd use a mail client that can properly quote
:-) In your mail your text appears as if it was indirectly quoted by
myself... I have reformatted your reply so it becomes clear again who
said what.
Post by Sunava Dutta
c)
"- TRACK??? There's probably a rational for that. If there is, please
include it in the spec."
TRACK is unsafe and should be removed. I remember reading about this awhile back. Here's something I found on the web: http://www.aqtronix.com/Advisories/AQ-2003-02.txt
That implies that Microsoft closed the vulnerability with IIS 6.0, so
I'm not entirely sure why a spec in last call in 2008 needs to speak
about it.

There are surely other old servers that have other vulnerabilities that
could be exploited using XHR, should we consider all of these?

That being said, I'm ok with *mentioning* the issue somewhere, but just
enumerating TRACK along with TRACE, as if this was a standard HTTP
method, is *highly* confusing.
...
BR, Julian
Anne van Kesteren
2008-05-12 15:53:04 UTC
Permalink
On Sun, 04 May 2008 11:47:13 +0200, Julian Reschke <***@gmx.d=
e> =
Post by Julian Reschke
Review of <http://www.w3.org/TR/2008/WD-XMLHttpRequest-20080415/>.
a) I'm confused about the approach to this document. On the one hand, =
=
Post by Julian Reschke
we're being told that it can't define anything not already in use (and=
=
Post by Julian Reschke
that new stuff belongs into XHR2), on the other hand it relies on HTML=
5, =
Post by Julian Reschke
which is a moving target. It's good that this stuff is being written =
down, but if it relies on HTML5, I'd propose to consider other =
publication options.
The problem is that concepts such "origin" and determining the encoding =
of =

a text/html stream are not defined anywhere else. It's not really clear =
to =

me what to do about that.
Post by Julian Reschke
b) Algorithms: the spec uses a method to describe algorithms that IMHO=
=
Post by Julian Reschke
is extremely hard to read (see for instance send() method). This may b=
e =
Post by Julian Reschke
good for implementors, but seems to be bad for everybody else. =
Minimally, the lists should be structured for better readability.
Could you elaborate on what kind of change you envision? I'm not sure ho=
w =

they are not structured right now.
Post by Julian Reschke
c) Structure: It would be nice if Section 4 had more structure. Right =
=
Post by Julian Reschke
now it's ugly to navigate and refer to.
This is better in XMLHttpRequest Level 2. I rather not revise that entir=
e =

section editorially as it might introduce new errors.
Post by Julian Reschke
2.1 Dependencies
"DOM
A conforming user agent must support some subset of the =
functionality defined in DOM Events and DOM Core that this specificati=
on =
Post by Julian Reschke
relies upon. [DOM2Events] [DOM3Core]"
That reads a bit strange. Must the subset be non-empty?
Yes, as stated it must be a subset that matches what XMLHttpRequest =

requires from the eventing and core specifications.
Post by Julian Reschke
2.2 Terminology
"Two URIs are same-origin if after performing scheme-based normalizati=
on =
Post by Julian Reschke
on both URIs as described in section 5.3.3 of RFC 3987 the scheme, iho=
st =
Post by Julian Reschke
and port components are identical. If either URI does not have an ihos=
t =
Post by Julian Reschke
component the URIs must not be considered same-origin. [RFC3987]"
Why are we referring to the IRI spec (RFC3987) when talking about URIs=
, =
Post by Julian Reschke
as defined RFC3986?
For scheme-bases normalization and ihost. Maybe I should use IRI instead=
=

of URI?
Post by Julian Reschke
3. Security Considerations
"Apart from requirements affecting security made throughout this =
specification implementations may, at their discretion, not expose =
certain headers, such as HttpOnly cookies."
"...such as headers containing HttpOnly cookies".
Done.
Post by Julian Reschke
Besides that: this may be a non-optimal example unless we can point to=
a =
Post by Julian Reschke
definition of "HttpOnly cookies". Can we?
I don't believe we can, but since this was put in mostly for HttpOnly =

cookies I rather not remove that. I think it will be clear enough for =

people reading the document.
Post by Julian Reschke
4. The XMLHttpRequest Object
"onreadystatechange of type EventListener
This attribute is an event handler DOM attribute and must be =
invoked whenever a readystatechange event is targated at the object."
s/targated/targeted/
Already fixed.
Post by Julian Reschke
"If stored method case-insensitively matches CONNECT, DELETE, GET, =
HEAD, OPTIONS POST, PUT, TRACE, or TRACK let stored method be the =
canonical uppercase form of the matched method name."
- missing comma after OPTIONS
Fixed.
Post by Julian Reschke
- TRACK??? There's probably a rational for that. If there is, please =
include it in the spec.
It's a security issue, as should be clear from the next bullet point.
Post by Julian Reschke
"If the user argument was not omitted and is not null let stored user =
be =
Post by Julian Reschke
user encoded using the encoding specified in the relevant =
authentication scheme or UTF-8 if the scheme fails to specify an =
encoding."
Why is XHR talking about the encoding here? Is "stored user" a string =
or =
Post by Julian Reschke
a byte array?
(same for password)
They're a string (in the API).
Post by Julian Reschke
"Abort the send() algorithm, set response entity body to "null" and =
reset the list of request headers."
This is a very confusing statement, until one realizes that it's in th=
e =
Post by Julian Reschke
description of "open", not "send". It would be good to rephrase this s=
o =
Post by Julian Reschke
it becomes clear that this aborts a *previous* send request.
Added a note.
Post by Julian Reschke
"If the value argument is null terminate these steps. (Do not raise an=
=
Post by Julian Reschke
exception.)."
This makes it impossible to set empty headers, which are allowed in =
HTTP. Even worse, it silently fails.
Empty headers can be set using the empty string, no? Not raising an =

exception is consistent with implementations and I don't think it matter=
s =

much as it doesn't have any effect.
Post by Julian Reschke
This is profiling of the base spec, and I don't see any compelling =
reason to do so. Don't do it.
How is it profiling?
Post by Julian Reschke
"For security reasons, these steps should be terminated if the header =
=
Post by Julian Reschke
* Accept-Charset
* Accept-Encoding
* Connection
* Content-Length
* Content-Transfer-Encoding
* Date
* Expect
* Host
* Keep-Alive
* Referer
* TE
* Trailer
* Transfer-Encoding
* Upgrade
* Via "
It's unclear why there's a security reason not to allow things like =
"Accept-Charset" or "Accept-Encoding". Please explain.
This was done based on implementation feedback. I haven't investigated =

what the reasons were for the various headers. If implementors read this=
=

maybe they could chime in and point it out.
Post by Julian Reschke
General comment on "setRequestHeader(header, value), method": the way =
it =
Post by Julian Reschke
is specified makes it impossible for a client to reliably set headers.=
=
Post by Julian Reschke
We need a way to either retrieve the current value for inspection, or =
a =
Post by Julian Reschke
way to reset the header. Or both.
http://lists.w3.org/Archives/Public/public-webapi/2008May/0139.html
Post by Julian Reschke
"If stored method is GET act as if the data argument is null."
Another case of HTTP/1.1 being profiled. Don't do it.
This was done on request of implementations.
Post by Julian Reschke
"Serialize data into a namespace well-formed XML document and encoded =
=
Post by Julian Reschke
using the encoding given by data.inputEncoding, when not null, or UTF-=
8 =
Post by Julian Reschke
otherwise. Or, if this fails because the Document cannot be serialized=
=
Post by Julian Reschke
act as if data is null."
Silent failure????
Yes.
Post by Julian Reschke
"If no Content-Type header has been set using setRequestHeader() appen=
d =
Post by Julian Reschke
a Content-Type header to the list of request headers with a value of =
application/xml;charset=3Dcharset where charset is the encoding used =
to =
Post by Julian Reschke
encode the document."
This will result in an invalid Content-Type header if the UA has =
initialized the headers with a default (which I think the spec current=
ly =
Post by Julian Reschke
allows; and at least one UA was reported to do). See comment above abo=
ut =
Post by Julian Reschke
header handling.
Rephrased.
Post by Julian Reschke
"While downloading the resource the following rules are to be observed=
."
Post by Julian Reschke
That reads strange. HTTP requests do not "download" resources. Say =
"while executing the request".
Thanks, fixed.
Post by Julian Reschke
"If the user agent supports HTTP State Management it should persist, =
discard and send cookies (as received in the Set-Cookie and Set-Cookie=
2 =
Post by Julian Reschke
response headers, and sent in the Cookie header) as applicable. =
[RFC2965]"
This should probably include a reference to the Set-Cookie (not =
Set-Cookie2) spec as well (RFC2109).
I believe it used to do that and it was pointed out that that =

specification is not useful in practice and would actually do more harm =
=

than good. I'm not really sure what to do here.
Post by Julian Reschke
"If the user agent implements server-driven content-negotiation it =
should set Accept-Encoding and Accept-Charset headers as appropriate; =
it =
Post by Julian Reschke
must not automatically set the Accept."
s/set the Accept/set the Accept header/
Fixed due to other changes.
Post by Julian Reschke
"Responses to such requests must have the content-encodings =
automatically decoded. [RFC2616]"
"Such requests" is a bit fuzzy here. Please rephrase in terms of what =
=
Post by Julian Reschke
the response contains (such as Content-Encoding header being present =
etc).
I simply dropped "to such requests". I hope that's ok.
Post by Julian Reschke
var client =3D new XMLHttpRequest();
client.open("GET", "test.txt", true);
client.send();
client.onreadystatechange =3D function() {
if(this.readyState =3D=3D 3) {
print(this.getAllResponseHeaders());
}
}
Date: Sun, 24 Oct 2004 04:58:38 GMT
Server: Apache/1.3.31 (Unix)
Keep-Alive: timeout=3D15, max=3D99
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/plain; charset=3Dutf-8"
I think examples like this would be more readable (and take less space=
) =
Post by Julian Reschke
when using the syncr. mode.
I would like to avoid encouraging authors to use the synchronous API.
Post by Julian Reschke
"status of type unsigned short, readonly
On getting, if available, it must return the HTTP status code sent by =
=
Post by Julian Reschke
the server (typically 200 for a successful request). Otherwise, if not=
=
Post by Julian Reschke
available, the user agent must raise an INVALID_STATE_ERR exception."
This may be incorrect when the UA caches (304 vs 200).
That's why it says typically.
Post by Julian Reschke
"statusText of type DOMString, readonly
On getting, if available, it must return the HTTP status text sen=
t =
Post by Julian Reschke
by the server (appears after the status code). Otherwise, if not =
available, the user agent must raise an INVALID_STATE_ERR exception."
Really? It seems to me that if somebody really implements this, client=
s =
Post by Julian Reschke
are likely to break. Why not allow an empty string here?
This is what clients have implemented as far as I can tell. Though the =

HTTP status text could be the empty string, if that's what you mean...
Post by Julian Reschke
Finally, my main other issue with this spec that it is silent about th=
e =
Post by Julian Reschke
recommended behaviour for unsafe methods, about which RFC2616 says in =
=
Post by Julian Reschke
Section 9.1.1 =
"Implementors should be aware that the software represents the user in=
=
Post by Julian Reschke
their interactions over the Internet, and should be careful to allow t=
he =
Post by Julian Reschke
user to be aware of any actions they might take which may have an =
unexpected significance to themselves or others.
In particular, the convention has been established that the GET and HE=
AD =
Post by Julian Reschke
methods SHOULD NOT have the significance of taking an action other tha=
n =
Post by Julian Reschke
retrieval. These methods ought to be considered "safe". This allows us=
er =
Post by Julian Reschke
agents to represent other methods, such as POST, PUT and DELETE, in a =
=
Post by Julian Reschke
special way, so that the user is made aware of the fact that a possibl=
y =
Post by Julian Reschke
unsafe action is being requested."
Thus, allowing a web page to submit a PUT, POST or DELETE request =
without user interaction seems to be a very dangerous thing to me, and=
=
Post by Julian Reschke
the spec should point that out (see also =
<http://ietf.osafoundation.org:8080/bugzilla/show_bug.cgi?id=3D237>).
All requirements from HTTP are taken over unless explicitly stated so I =
=

don't think this is needed.

Kind regards,


-- =

Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>
Julian Reschke
2008-05-14 13:02:10 UTC
Permalink
Post by Anne van Kesteren
On Sun, 04 May 2008 11:47:13 +0200, Julian Reschke
Post by Julian Reschke
Review of <http://www.w3.org/TR/2008/WD-XMLHttpRequest-20080415/>.
a) I'm confused about the approach to this document. On the one hand,
we're being told that it can't define anything not already in use (and
that new stuff belongs into XHR2), on the other hand it relies on
HTML5, which is a moving target. It's good that this stuff is being
written down, but if it relies on HTML5, I'd propose to consider other
publication options.
The problem is that concepts such "origin" and determining the encoding
of a text/html stream are not defined anywhere else. It's not really
clear to me what to do about that.
In some cases, it may be possible to copy the current definition. In
other cases, it may be possible just not to depend on it (for instance,
by not specifying encoding sniffing).
Post by Anne van Kesteren
Post by Julian Reschke
b) Algorithms: the spec uses a method to describe algorithms that IMHO
is extremely hard to read (see for instance send() method). This may
be good for implementors, but seems to be bad for everybody else.
Minimally, the lists should be structured for better readability.
Could you elaborate on what kind of change you envision? I'm not sure
how they are not structured right now.
An example would be steps 8..11 in the description of open():

- these steps deal with credentials, and the whole list would be more
readable if each group of steps that belong together would me structured
that way;

- optimally, thing like this shouldn't be expressed as a set of
instructions, but in a declarative way.
Post by Anne van Kesteren
Post by Julian Reschke
c) Structure: It would be nice if Section 4 had more structure. Right
now it's ugly to navigate and refer to.
This is better in XMLHttpRequest Level 2. I rather not revise that
entire section editorially as it might introduce new errors.
But then, it makes a comparison with XHR2 harder. Please reconsider.
Post by Anne van Kesteren
Post by Julian Reschke
2.1 Dependencies
"DOM
A conforming user agent must support some subset of the
functionality defined in DOM Events and DOM Core that this
specification relies upon. [DOM2Events] [DOM3Core]"
That reads a bit strange. Must the subset be non-empty?
Yes, as stated it must be a subset that matches what XMLHttpRequest
requires from the eventing and core specifications.
Then it would be clearer if it said "the subset" instead of "some subset".
Post by Anne van Kesteren
Post by Julian Reschke
2.2 Terminology
"Two URIs are same-origin if after performing scheme-based
normalization on both URIs as described in section 5.3.3 of RFC 3987
the scheme, ihost and port components are identical. If either URI
does not have an ihost component the URIs must not be considered
same-origin. [RFC3987]"
Why are we referring to the IRI spec (RFC3987) when talking about
URIs, as defined RFC3986?
For scheme-bases normalization and ihost. Maybe I should use IRI instead
of URI?
Well, if we're talking about URIs (and I think we do), then we need to
refer to RFC3986 grammar and comparison rules.
Post by Anne van Kesteren
Post by Julian Reschke
Besides that: this may be a non-optimal example unless we can point to
a definition of "HttpOnly cookies". Can we?
I don't believe we can, but since this was put in mostly for HttpOnly
cookies I rather not remove that. I think it will be clear enough for
people reading the document.
So why don't we refer to the specification for httpOnly? Do you consider
it a problem that it's a Microsoft document?
Post by Anne van Kesteren
Post by Julian Reschke
- TRACK??? There's probably a rational for that. If there is, please
include it in the spec.
It's a security issue, as should be clear from the next bullet point.
As TRACK doesn't seem to be documented anywhere, and not implemented in
current IIS versions anymore, I'd really like to see this made a foot
node. The way it's written now is just totally confusing to every reader
who doesn't know the full story around it.
Post by Anne van Kesteren
Post by Julian Reschke
"If the user argument was not omitted and is not null let stored user
be user encoded using the encoding specified in the relevant
authentication scheme or UTF-8 if the scheme fails to specify an encoding."
Why is XHR talking about the encoding here? Is "stored user" a string
or a byte array?
(same for password)
They're a string (in the API).
When they are a string, then taking about character encoding doesn't
make any sense here.
Post by Anne van Kesteren
Post by Julian Reschke
"If the value argument is null terminate these steps. (Do not raise an
exception.)."
This makes it impossible to set empty headers, which are allowed in
HTTP. Even worse, it silently fails.
Empty headers can be set using the empty string, no? Not raising an
exception is consistent with implementations and I don't think it
matters much as it doesn't have any effect.
Sorry, was reading one thing, but thinking about something else.

Thinking of it, could you please add a clarification that setting to an
empty string is legal, and MUST NOT be ignored? I recall that
Microsoft's original XHR (ActiveX) implementation got that wrong, not
setting the header at all.
Post by Anne van Kesteren
Post by Julian Reschke
"For security reasons, these steps should be terminated if the header
* Accept-Charset
* Accept-Encoding
* Connection
* Content-Length
* Content-Transfer-Encoding
* Date
* Expect
* Host
* Keep-Alive
* Referer
* TE
* Trailer
* Transfer-Encoding
* Upgrade
* Via "
It's unclear why there's a security reason not to allow things like
"Accept-Charset" or "Accept-Encoding". Please explain.
This was done based on implementation feedback. I haven't investigated
what the reasons were for the various headers. If implementors read this
maybe they could chime in and point it out.
Please. And if they don't, please remove all headers for which nobody
can explain why they are in this list.
Post by Anne van Kesteren
Post by Julian Reschke
General comment on "setRequestHeader(header, value), method": the way
it is specified makes it impossible for a client to reliably set
headers. We need a way to either retrieve the current value for
inspection, or a way to reset the header. Or both.
http://lists.w3.org/Archives/Public/public-webapi/2008May/0139.html
Yes, we continue to disagree on this.
Post by Anne van Kesteren
Post by Julian Reschke
"If stored method is GET act as if the data argument is null."
Another case of HTTP/1.1 being profiled. Don't do it.
This was done on request of implementations.
That's IMHO not sufficient reason to do it. Please add a convincing
rational, or leave this to the HTTP WG.
Post by Anne van Kesteren
Post by Julian Reschke
"Serialize data into a namespace well-formed XML document and encoded
using the encoding given by data.inputEncoding, when not null, or
UTF-8 otherwise. Or, if this fails because the Document cannot be
serialized act as if data is null."
Silent failure????
Yes.
Very bad.

Does anybody rely on that? I would be very suprised.
Post by Anne van Kesteren
Post by Julian Reschke
"If no Content-Type header has been set using setRequestHeader()
append a Content-Type header to the list of request headers with a
value of application/xml;charset=charset where charset is the
encoding used to encode the document."
This will result in an invalid Content-Type header if the UA has
initialized the headers with a default (which I think the spec
currently allows; and at least one UA was reported to do). See comment
above about header handling.
Rephrased.
Pointer?
Post by Anne van Kesteren
Post by Julian Reschke
"If the user agent supports HTTP State Management it should persist,
discard and send cookies (as received in the Set-Cookie and
Set-Cookie2 response headers, and sent in the Cookie header) as
applicable. [RFC2965]"
This should probably include a reference to the Set-Cookie (not
Set-Cookie2) spec as well (RFC2109).
I believe it used to do that and it was pointed out that that
specification is not useful in practice and would actually do more harm
than good. I'm not really sure what to do here.
Well, the one that is not used in practice is RFC2965, not RFC2109. That
being said, you probably need to reference both.
Post by Anne van Kesteren
Post by Julian Reschke
var client = new XMLHttpRequest();
client.open("GET", "test.txt", true);
client.send();
client.onreadystatechange = function() {
if(this.readyState == 3) {
print(this.getAllResponseHeaders());
}
}
Date: Sun, 24 Oct 2004 04:58:38 GMT
Server: Apache/1.3.31 (Unix)
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/plain; charset=utf-8"
I think examples like this would be more readable (and take less
space) when using the syncr. mode.
I would like to avoid encouraging authors to use the synchronous API.
Disagreed. I think readability and compactness is more important here.
Post by Anne van Kesteren
Post by Julian Reschke
"status of type unsigned short, readonly
On getting, if available, it must return the HTTP status code sent by
the server (typically 200 for a successful request). Otherwise, if not
available, the user agent must raise an INVALID_STATE_ERR exception."
This may be incorrect when the UA caches (304 vs 200).
That's why it says typically.
Hm, no.

When the UA caches, and the server sent 304, the client will potentially
see a 200. This would contradict what *this* paragraph says.
Post by Anne van Kesteren
Post by Julian Reschke
"statusText of type DOMString, readonly
On getting, if available, it must return the HTTP status text
sent by the server (appears after the status code). Otherwise, if not
available, the user agent must raise an INVALID_STATE_ERR exception."
Really? It seems to me that if somebody really implements this,
clients are likely to break. Why not allow an empty string here?
This is what clients have implemented as far as I can tell. Though the
HTTP status text could be the empty string, if that's what you mean...
Does the "if not available" apply to any of the existing
implementations? Why would it be "not available"? Please clarify.
Post by Anne van Kesteren
Post by Julian Reschke
Finally, my main other issue with this spec that it is silent about
the recommended behaviour for unsafe methods, about which RFC2616 says
in Section 9.1.1
"Implementors should be aware that the software represents the user in
their interactions over the Internet, and should be careful to allow
the user to be aware of any actions they might take which may have an
unexpected significance to themselves or others.
In particular, the convention has been established that the GET and
HEAD methods SHOULD NOT have the significance of taking an action
other than retrieval. These methods ought to be considered "safe".
This allows user agents to represent other methods, such as POST, PUT
and DELETE, in a special way, so that the user is made aware of the
fact that a possibly unsafe action is being requested."
Thus, allowing a web page to submit a PUT, POST or DELETE request
without user interaction seems to be a very dangerous thing to me, and
the spec should point that out (see also
<http://ietf.osafoundation.org:8080/bugzilla/show_bug.cgi?id=237>).
All requirements from HTTP are taken over unless explicitly stated so I
don't think this is needed.
Well, the spec repeats lots of things specified somewhere else already.

The warning from the HTTP spec is relevant and should appear here, as
XHR is related to UAs, and existing UAs are known to ignore this
security consideration.

BR, Julian
Ian Hickson
2008-05-14 20:18:51 UTC
Permalink
Post by Julian Reschke
Post by Anne van Kesteren
The problem is that concepts such "origin" and determining the
encoding of a text/html stream are not defined anywhere else. It's not
really clear to me what to do about that.
In some cases, it may be possible to copy the current definition. In
other cases, it may be possible just not to depend on it (for instance,
by not specifying encoding sniffing).
I don't have an opinion on the exact issue here, but as a general rule I
recommend against making decisions based on the political status (rather
than technical status) of working groups and specs. Otherwise we just end
up reinforcing the Web's experiment with Conway's Law. That is to say, we
should rather change the rules that prevent us from doing the right thing,
than blindly follow those rules and change our technology to match.
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Julian Reschke
2008-05-15 09:03:25 UTC
Permalink
Post by Ian Hickson
Post by Julian Reschke
Post by Anne van Kesteren
The problem is that concepts such "origin" and determining the
encoding of a text/html stream are not defined anywhere else. It's not
really clear to me what to do about that.
In some cases, it may be possible to copy the current definition. In
other cases, it may be possible just not to depend on it (for instance,
by not specifying encoding sniffing).
I don't have an opinion on the exact issue here, but as a general rule I
recommend against making decisions based on the political status (rather
than technical status) of working groups and specs. Otherwise we just end
Not sure what this means.

My understanding was that XHR1 is an intermediate step (documenting the
current state, and trying to make it more interoperable), while XHR2
would contain something that is really good.

If this is the case, it's totally pointless to let XHR1 have normative
references on something that won't be finished for a long time.
Post by Ian Hickson
...
BR, Julian
Ian Hickson
2008-05-15 10:07:02 UTC
Permalink
Post by Julian Reschke
Post by Ian Hickson
I don't have an opinion on the exact issue here, but as a general rule
I recommend against making decisions based on the political status
(rather than technical status) of working groups and specs. Otherwise
we just end [up invoking Conway's law]
My understanding was that XHR1 is an intermediate step (documenting the
current state, and trying to make it more interoperable), while XHR2
would contain something that is really good.
If this is the case, it's totally pointless to let XHR1 have normative
references on something that won't be finished for a long time.
Pragmatically, why does it matter when the references are finished?
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Julian Reschke
2008-05-15 10:11:29 UTC
Permalink
Post by Ian Hickson
Post by Julian Reschke
My understanding was that XHR1 is an intermediate step (documenting the
current state, and trying to make it more interoperable), while XHR2
would contain something that is really good.
If this is the case, it's totally pointless to let XHR1 have normative
references on something that won't be finished for a long time.
Pragmatically, why does it matter when the references are finished?
The spec can't be more "ready" than all normative references.

If these aren't getting ready in time, then I'm not sure why XHR1 needs
to be on the W3C REC track at all.

BR, Julian
Ian Hickson
2008-05-15 10:19:20 UTC
Permalink
Post by Julian Reschke
The spec can't be more "ready" than all normative references.
Sure it can. The concept of "origin" (for instance) is pretty well
understood by browser vendors, and HTML5 is getting progressively closer
to defining it. XHR1 doesn't need it to be perfectly defined to make use
of it. Same with Window, probably even more so in fact.
Post by Julian Reschke
If these aren't getting ready in time, then I'm not sure why XHR1 needs
to be on the W3C REC track at all.
Well, personally I don't mind what organisation publishes the spec. The
WHATWG would, I'm sure, be happy to publish the XHR spec if the W3C didn't
want to do it -- indeed, that's where XMLHttpRequest started its standards
career in the first place.
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Julian Reschke
2008-05-15 10:22:33 UTC
Permalink
Post by Ian Hickson
Post by Julian Reschke
The spec can't be more "ready" than all normative references.
Sure it can. The concept of "origin" (for instance) is pretty well
understood by browser vendors, and HTML5 is getting progressively closer
to defining it. XHR1 doesn't need it to be perfectly defined to make use
of it. Same with Window, probably even more so in fact.
So why then is the reference to HTML5 needed?
Post by Ian Hickson
...
BR, Julian
Ian Hickson
2008-05-15 10:27:33 UTC
Permalink
Post by Julian Reschke
Post by Ian Hickson
Post by Julian Reschke
The spec can't be more "ready" than all normative references.
Sure it can. The concept of "origin" (for instance) is pretty well
understood by browser vendors, and HTML5 is getting progressively closer to
defining it. XHR1 doesn't need it to be perfectly defined to make use of it.
Same with Window, probably even more so in fact.
So why then is the reference to HTML5 needed?
Wouldn't you just complain that Window and 'origin' were totally undefined
if we used them without referencing something?
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Julian Reschke
2008-05-15 11:07:51 UTC
Permalink
Post by Ian Hickson
Post by Julian Reschke
Post by Ian Hickson
Post by Julian Reschke
The spec can't be more "ready" than all normative references.
Sure it can. The concept of "origin" (for instance) is pretty well
understood by browser vendors, and HTML5 is getting progressively closer to
defining it. XHR1 doesn't need it to be perfectly defined to make use of it.
Same with Window, probably even more so in fact.
So why then is the reference to HTML5 needed?
Wouldn't you just complain that Window and 'origin' were totally undefined
if we used them without referencing something?
That wasn't what I was suggesting.

BR, Julian
Ian Hickson
2008-05-15 11:33:50 UTC
Permalink
Post by Julian Reschke
Post by Ian Hickson
Post by Julian Reschke
Post by Ian Hickson
Post by Julian Reschke
The spec can't be more "ready" than all normative references.
Sure it can. The concept of "origin" (for instance) is pretty well
understood by browser vendors, and HTML5 is getting progressively closer to
defining it. XHR1 doesn't need it to be perfectly defined to make use of it.
Same with Window, probably even more so in fact.
So why then is the reference to HTML5 needed?
Wouldn't you just complain that Window and 'origin' were totally undefined
if we used them without referencing something?
That wasn't what I was suggesting.
So what are you suggesting?
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Julian Reschke
2008-05-15 11:41:49 UTC
Permalink
Post by Ian Hickson
Post by Julian Reschke
Post by Ian Hickson
Post by Julian Reschke
Post by Ian Hickson
Post by Julian Reschke
The spec can't be more "ready" than all normative references.
Sure it can. The concept of "origin" (for instance) is pretty well
understood by browser vendors, and HTML5 is getting progressively closer to
defining it. XHR1 doesn't need it to be perfectly defined to make use of it.
Same with Window, probably even more so in fact.
So why then is the reference to HTML5 needed?
Wouldn't you just complain that Window and 'origin' were totally undefined
if we used them without referencing something?
That wasn't what I was suggesting.
So what are you suggesting?
I would suggest to either copy over what HTML5 currently says, or to
reference something that can be considered a stable reference.

BR, Julian
Ian Hickson
2008-05-15 11:49:30 UTC
Permalink
Post by Julian Reschke
Post by Julian Reschke
Post by Ian Hickson
Post by Julian Reschke
Post by Ian Hickson
Post by Julian Reschke
The spec can't be more "ready" than all normative
references.
Sure it can. The concept of "origin" (for instance) is pretty
well understood by browser vendors, and HTML5 is getting
progressively closer to defining it. XHR1 doesn't need it to
be perfectly defined to make use of it. Same with Window,
probably even more so in fact.
So why then is the reference to HTML5 needed?
Wouldn't you just complain that Window and 'origin' were totally
undefined if we used them without referencing something?
That wasn't what I was suggesting.
I would suggest to either copy over what HTML5 currently says, or to
reference something that can be considered a stable reference.
What HTML5 says on the matter runs to at least as many pages as the whole
of XHR1+XHR2+AC put together. And it's known to be wrong (if it wasn't,
HTML5 would be done by now).

If we had a stable reference, HTML5 would be using it, and would, again,
be done.

What's wrong with referencing HTML5? Why can't the spec be more ready than
its normative references? We're only really referencing the concept, the
details aren't particularly critical to XHR.
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Julian Reschke
2008-05-15 11:53:33 UTC
Permalink
Post by Ian Hickson
...
What's wrong with referencing HTML5? Why can't the spec be more ready than
its normative references? We're only really referencing the concept, the
details aren't particularly critical to XHR.
...
Because, by definition, normative references are part of the specification.

Sorry, don't know how to make that more clear.

BR, Julian
Ian Hickson
2008-05-15 19:53:55 UTC
Permalink
Post by Julian Reschke
Post by Ian Hickson
...
What's wrong with referencing HTML5? Why can't the spec be more ready than
its normative references? We're only really referencing the concept, the
details aren't particularly critical to XHR.
...
Because, by definition, normative references are part of the
specification.
But we don't have to limit ourselves to that definition. We could just as
easily say that XHR1's functionality is as defined in XHR1, and that it
uses terms and features that are currently underdefined. It wouldn't, in
practice, take anything away from the ability to get interoperable
implemenations of the feature described in XHR1.
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Julian Reschke
2008-05-15 20:24:01 UTC
Permalink
Post by Ian Hickson
Post by Julian Reschke
Post by Ian Hickson
...
What's wrong with referencing HTML5? Why can't the spec be more ready than
its normative references? We're only really referencing the concept, the
details aren't particularly critical to XHR.
...
Because, by definition, normative references are part of the
specification.
But we don't have to limit ourselves to that definition. We could just as
easily say that XHR1's functionality is as defined in XHR1, and that it
uses terms and features that are currently underdefined. It wouldn't, in
...in which case I'd say that (a) the references aren't normative after
all, and (b) the spec itself can't be normative as it is written.
Post by Ian Hickson
practice, take anything away from the ability to get interoperable
implemenations of the feature described in XHR1.
Really?

What if Apple implements the thing as defined by HTML5-as-of-2008, and
Microsoft as defined in HTML5-as-of-2009?

If it matters, then it's a problem. If it doesn't matter, leave it out
of the XHR spec, as apparently, it's irrelevant for the goal it's trying
to achieve.

BR, Julian
Ian Hickson
2008-05-15 20:34:46 UTC
Permalink
Post by Julian Reschke
Post by Ian Hickson
But we don't have to limit ourselves to that definition. We could just
as easily say that XHR1's functionality is as defined in XHR1, and
that it uses terms and features that are currently underdefined. It
wouldn't, in
...in which case I'd say that (a) the references aren't normative after
all, and (b) the spec itself can't be normative as it is written.
I don't mind calling the references "informative" if that's what it takes.
I'm not sure what practical difference it would make.
Post by Julian Reschke
Post by Ian Hickson
practice, take anything away from the ability to get interoperable
implemenations of the feature described in XHR1.
Really?
What if Apple implements the thing as defined by HTML5-as-of-2008, and
Microsoft as defined in HTML5-as-of-2009?
If it matters, then it's a problem. If it doesn't matter, leave it out
of the XHR spec, as apparently, it's irrelevant for the goal it's trying
to achieve.
The point is that Apple and Microsoft are both going to implement the
thing as required by the Web in 2000, not as defined in HTML5. HTML5 is
describing existing practice on these matters, not defining new material.
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Travis Leithead
2008-05-15 20:52:43 UTC
Permalink
Post by Ian Hickson
The point is that Apple and Microsoft are both going to implement the
thing as required by the Web in 2000, not as defined in HTML5. HTML5 is
describing existing practice on these matters, not defining new material.
Well, a _few_ bits of new material ;-)

-----Original Message-----
From: public-webapi-***@w3.org [mailto:public-webapi-***@w3.org] On Behalf Of Ian Hickson
Sent: Thursday, May 15, 2008 1:35 PM
To: Julian Reschke
Cc: Anne van Kesteren; public-***@w3.org
Subject: Re: XHR LC comments
Post by Ian Hickson
Post by Ian Hickson
But we don't have to limit ourselves to that definition. We could just
as easily say that XHR1's functionality is as defined in XHR1, and
that it uses terms and features that are currently underdefined. It
wouldn't, in
...in which case I'd say that (a) the references aren't normative after
all, and (b) the spec itself can't be normative as it is written.
I don't mind calling the references "informative" if that's what it takes.
I'm not sure what practical difference it would make.
Post by Ian Hickson
Post by Ian Hickson
practice, take anything away from the ability to get interoperable
implemenations of the feature described in XHR1.
Really?
What if Apple implements the thing as defined by HTML5-as-of-2008, and
Microsoft as defined in HTML5-as-of-2009?
If it matters, then it's a problem. If it doesn't matter, leave it out
of the XHR spec, as apparently, it's irrelevant for the goal it's trying
to achieve.
The point is that Apple and Microsoft are both going to implement the
thing as required by the Web in 2000, not as defined in HTML5. HTML5 is
describing existing practice on these matters, not defining new material.

--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Ian Hickson
2008-05-15 21:29:45 UTC
Permalink
Post by Travis Leithead
Post by Ian Hickson
The point is that Apple and Microsoft are both going to implement the
thing as required by the Web in 2000, not as defined in HTML5. HTML5 is
describing existing practice on these matters, not defining new material.
Well, a _few_ bits of new material ;-)
The bits that XHR depend on, which is the subject at hand, aren't new
relative to the Web in 2000.
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Julian Reschke
2008-05-16 07:03:12 UTC
Permalink
Post by Ian Hickson
Post by Julian Reschke
...in which case I'd say that (a) the references aren't normative after
all, and (b) the spec itself can't be normative as it is written.
I don't mind calling the references "informative" if that's what it takes.
I'm not sure what practical difference it would make.
You can't make them informative by just saying so. The question is, do I
need material from HTML5 to implement a conforming XHR implementation?
If yes, then XHR can't be published earlier. If no, let's rephrase stuff
so that HTML5 isn't required.
Post by Ian Hickson
Post by Julian Reschke
Post by Ian Hickson
practice, take anything away from the ability to get interoperable
implemenations of the feature described in XHR1.
Really?
What if Apple implements the thing as defined by HTML5-as-of-2008, and
Microsoft as defined in HTML5-as-of-2009?
If it matters, then it's a problem. If it doesn't matter, leave it out
of the XHR spec, as apparently, it's irrelevant for the goal it's trying
to achieve.
The point is that Apple and Microsoft are both going to implement the
thing as required by the Web in 2000, not as defined in HTML5. HTML5 is
describing existing practice on these matters, not defining new material.
Well, in that case pull that stuff out of HTML5 and insert it into the
XHR spec (or move it into something that can be published separately).

BR, Julian
Maciej Stachowiak
2008-05-15 20:52:21 UTC
Permalink
Post by Julian Reschke
Post by Ian Hickson
practice, take anything away from the ability to get interoperable
implemenations of the feature described in XHR1.
Really?
What if Apple implements the thing as defined by HTML5-as-of-2008,
and Microsoft as defined in HTML5-as-of-2009?
If it matters, then it's a problem. If it doesn't matter, leave it
out of the XHR spec, as apparently, it's irrelevant for the goal
it's trying to achieve.
In practice it is much more important for same-origin to be
implemented consistently between XHR and HTML5 (and other Web
standards) than for it to be precisely consistent cross-browser, as
inconsistencies in the same-origin policy could lead to security
holes. Thus, taking a snapshot of what HTML5 says and putting it in
XHR1 would be a dead letter, because if HTML5 changes and browsers
change to match it, they will not leave their XHR implementation using
an older version of the security policy.

Regards,
Maciej
Julian Reschke
2008-05-16 07:04:30 UTC
Permalink
In practice it is much more important for same-origin to be implemented
consistently between XHR and HTML5 (and other Web standards) than for it
to be precisely consistent cross-browser, as inconsistencies in the
same-origin policy could lead to security holes. Thus, taking a snapshot
of what HTML5 says and putting it in XHR1 would be a dead letter,
because if HTML5 changes and browsers change to match it, they will not
leave their XHR implementation using an older version of the security
policy.
Interesting enough, this seems to be exactly the opposite of what Ian
just said :-):

Ian> The point is that Apple and Microsoft are both going to implement the
Ian> thing as required by the Web in 2000, not as defined in HTML5.
HTML5 is
Ian> describing existing practice on these matters, not defining new
material.

BR, Julian
Laurens Holst
2008-05-15 18:57:44 UTC
Permalink
Post by Julian Reschke
Sorry, was reading one thing, but thinking about something else.
Thinking of it, could you please add a clarification that setting to
an empty string is legal, and MUST NOT be ignored? I recall that
Microsoft's original XHR (ActiveX) implementation got that wrong, not
setting the header at all.
When invoking request.setRequestHeader('Accept', ''):

- Firefox 3b5 removes the Accept header
- Internet Explorer 8 (in IE7 mode) sends Accept: */*
- Safari 3.1.1 sends Accept:
- Opera 9.24 sends Accept: text/html, application/xml;q=0.9,
application/xhtml+xml, image/png, image/jpeg, image/gif,
image/x-xbitmap, */*;q=0.1

When invoking request.setRequestHeader('Accept', null):

- Firefox 3b5 removes the Accept header
- Internet Explorer 8 (in IE7 mode) sends Accept: null
- Safari 3.1.1 sends Accept: null
- Opera 9.24 sends Accept: text/html, application/xml;q=0.9,
application/xhtml+xml, image/png, image/jpeg, image/gif,
image/x-xbitmap, */*;q=0.1

So it is clear that here, too, browsers are in great disagreement. I am
not sure what the correct approach here is, though '' meaning setting
“Accept” and null meaning removal of the header sounds sensible.

Note by the way that Opera always prepends the set Accept header to its
default value, resulting in e.g. Accept: */*, text/html,
application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg,
image/gif, image/x-xbitmap, */*;q=0.1 when invoking
request.setRequestHeader('Accept', null);

I can’t believe how horribly broken this all is. No wonder few people
depend on this header. Fortunately, as a result it can also be fixed
without breaking much.

I’ve also posted these results at http://www.grauw.nl/blog/entry/470 ,
the page source contains a test case.


~Grauw
--
Ushiko-san! Kimi wa doushite, Ushiko-san nan da!!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Laurens Holst, student, university of Utrecht, the Netherlands.
Website: www.grauw.nl. Backbase employee; www.backbase.com.
Julian Reschke
2008-05-15 19:14:12 UTC
Permalink
Post by Laurens Holst
Post by Julian Reschke
Sorry, was reading one thing, but thinking about something else.
Thinking of it, could you please add a clarification that setting to
an empty string is legal, and MUST NOT be ignored? I recall that
Microsoft's original XHR (ActiveX) implementation got that wrong, not
setting the header at all.
Laurens, thanks a *lot* for testing this.
Post by Laurens Holst
- Firefox 3b5 removes the Accept header
Ouch. Has this been raised as a bug yet?
Post by Laurens Holst
- Internet Explorer 8 (in IE7 mode) sends Accept: */*
Ouch. Has this been raised as a bug yet?
Good.
Post by Laurens Holst
- Opera 9.24 sends Accept: text/html, application/xml;q=0.9,
application/xhtml+xml, image/png, image/jpeg, image/gif,
image/x-xbitmap, */*;q=0.1
Not good.
Post by Laurens Holst
- Firefox 3b5 removes the Accept header
Makes sense, but isn't what XHR1 requires.
Post by Laurens Holst
- Internet Explorer 8 (in IE7 mode) sends Accept: null
You really mean the four characters n-u-l-l? Ouch,
Post by Laurens Holst
- Safari 3.1.1 sends Accept: null
- Opera 9.24 sends Accept: text/html, application/xml;q=0.9,
application/xhtml+xml, image/png, image/jpeg, image/gif,
image/x-xbitmap, */*;q=0.1
I notice that none of the browsers does what XHR1 requires, but at least
*one* (FF) does something useful.
Post by Laurens Holst
So it is clear that here, too, browsers are in great disagreement. I am
not sure what the correct approach here is, though '' meaning setting
“Accept” and null meaning removal of the header sounds sensible.
Note by the way that Opera always prepends the set Accept header to its
default value, resulting in e.g. Accept: */*, text/html,
application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg,
image/gif, image/x-xbitmap, */*;q=0.1 when invoking
request.setRequestHeader('Accept', null);
That should be considered a bug.
Post by Laurens Holst
I can’t believe how horribly broken this all is. No wonder few people
depend on this header. Fortunately, as a result it can also be fixed
without breaking much.
I’ve also posted these results at http://www.grauw.nl/blog/entry/470 ,
the page source contains a test case.
BR, Julian
Julian Reschke
2008-05-15 19:16:47 UTC
Permalink
Post by Laurens Holst
Post by Julian Reschke
Sorry, was reading one thing, but thinking about something else.
Thinking of it, could you please add a clarification that setting to
an empty string is legal, and MUST NOT be ignored? I recall that
Microsoft's original XHR (ActiveX) implementation got that wrong, not
setting the header at all.
Laurens, thanks a *lot* for testing this.
Post by Laurens Holst
- Firefox 3b5 removes the Accept header
Ouch. Has this been raised as a bug yet?
Post by Laurens Holst
- Internet Explorer 8 (in IE7 mode) sends Accept: */*
Ouch. Has this been raised as a bug yet?
Good.
Post by Laurens Holst
- Opera 9.24 sends Accept: text/html, application/xml;q=0.9,
application/xhtml+xml, image/png, image/jpeg, image/gif,
image/x-xbitmap, */*;q=0.1

Not good.
Post by Laurens Holst
- Firefox 3b5 removes the Accept header
Makes sense, but isn't what XHR1 requires.
Post by Laurens Holst
- Internet Explorer 8 (in IE7 mode) sends Accept: null
You really mean the four characters n-u-l-l? Ouch,
Post by Laurens Holst
- Safari 3.1.1 sends Accept: null
- Opera 9.24 sends Accept: text/html, application/xml;q=0.9,
application/xhtml+xml, image/png, image/jpeg, image/gif,
image/x-xbitmap, */*;q=0.1

I notice that none of the browsers does what XHR1 requires, but at least
*one* (FF) does something useful.
Post by Laurens Holst
So it is clear that here, too, browsers are in great disagreement. I
am not sure what the correct approach here is, though '' meaning setting
“Accept” and null meaning removal of the header sounds sensible.
Post by Laurens Holst
Note by the way that Opera always prepends the set Accept header to
its default value, resulting in e.g. Accept: */*, text/html,
application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg,
image/gif, image/x-xbitmap, */*;q=0.1 when invoking
request.setRequestHeader('Accept', null);

That should be considered a bug.
Post by Laurens Holst
I can’t believe how horribly broken this all is. No wonder few people
depend on this header. Fortunately, as a result it can also be fixed
without breaking much.

Also, this shows that it's *not* a good idea to just document what the
vendors happen to come up with.
Post by Laurens Holst
I’ve also posted these results at http://www.grauw.nl/blog/entry/470
, the page source contains a test case.

BR, Julian
Anne van Kesteren
2008-05-24 11:50:24 UTC
Permalink
On Thu, 15 May 2008 20:57:44 +0200, Laurens Holst
Post by Laurens Holst
- Firefox 3b5 removes the Accept header
- Internet Explorer 8 (in IE7 mode) sends Accept: */*
- Opera 9.24 sends Accept: text/html, application/xml;q=0.9,
application/xhtml+xml, image/png, image/jpeg, image/gif,
image/x-xbitmap, */*;q=0.1
Per the specification Safari is conformant.
Post by Laurens Holst
- Firefox 3b5 removes the Accept header
- Internet Explorer 8 (in IE7 mode) sends Accept: null
- Safari 3.1.1 sends Accept: null
- Opera 9.24 sends Accept: text/html, application/xml;q=0.9,
application/xhtml+xml, image/png, image/jpeg, image/gif,
image/x-xbitmap, */*;q=0.1
Per the updated specification which uses Web IDL IE and Safari are
conformant here. (null and undefined are simply stringified.)

(That Firefox removes the Accept header is because it treats null the same
as the empty string.)
Post by Laurens Holst
I can’t believe how horribly broken this all is. No wonder few people
depend on this header. Fortunately, as a result it can also be fixed
without breaking much.
Yeah, if you set Accept through setRequestHeader() it should just work
fine. If you don't the browser should provide it with a value of */*.

(The draft has not yet been updated because I'm still tweaking some bits
with respect to Web IDL.)
--
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>
Julian Reschke
2008-05-24 16:27:47 UTC
Permalink
Post by Anne van Kesteren
Post by Laurens Holst
- Firefox 3b5 removes the Accept header
- Internet Explorer 8 (in IE7 mode) sends Accept: null
- Safari 3.1.1 sends Accept: null
- Opera 9.24 sends Accept: text/html, application/xml;q=0.9,
application/xhtml+xml, image/png, image/jpeg, image/gif,
image/x-xbitmap, */*;q=0.1
Per the updated specification which uses Web IDL IE and Safari are
conformant here. (null and undefined are simply stringified.)
Not terrible useful, I would say. Is that something we have to live with
because of the IDL definition???
Post by Anne van Kesteren
...
BR, Julian
Anne van Kesteren
2008-05-24 21:07:15 UTC
Permalink
Post by Julian Reschke
Post by Anne van Kesteren
Per the updated specification which uses Web IDL IE and Safari are
conformant here. (null and undefined are simply stringified.)
Not terrible useful, I would say. Is that something we have to live with
because of the IDL definition???
It matches two implementations and is the default behavior for
null/undefined when passed to something that accepts a string.
--
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>
Julian Reschke
2008-05-25 16:04:14 UTC
Permalink
On Sat, 24 May 2008 18:27:47 +0200, Julian Reschke
Post by Julian Reschke
Post by Anne van Kesteren
Per the updated specification which uses Web IDL IE and Safari are
conformant here. (null and undefined are simply stringified.)
Not terrible useful, I would say. Is that something we have to live
with because of the IDL definition???
It matches two implementations and is the default behavior for
null/undefined when passed to something that accepts a string.
Apparently existing content does not rely on it (FF gets away with
implementing something that IMHO makes *much* more sense). So why
standardize it at all, or, when doing so, select something that doesn't
make sense in practice?

Or are you claiming that people who set a header to null *really* want
the specified behaviour?

BR, Julian
Jonas Sicking
2008-05-25 18:40:48 UTC
Permalink
Post by Julian Reschke
On Sat, 24 May 2008 18:27:47 +0200, Julian Reschke
Post by Julian Reschke
Post by Anne van Kesteren
Per the updated specification which uses Web IDL IE and Safari are
conformant here. (null and undefined are simply stringified.)
Not terrible useful, I would say. Is that something we have to live
with because of the IDL definition???
It matches two implementations and is the default behavior for
null/undefined when passed to something that accepts a string.
Apparently existing content does not rely on it (FF gets away with
implementing something that IMHO makes *much* more sense). So why
standardize it at all, or, when doing so, select something that doesn't
make sense in practice?
Or are you claiming that people who set a header to null *really* want
the specified behaviour?
Agreed. We have in the past said that in the cases where it doesn't seem
like the web is depending on a certain behavior one way or the other do
what is most useful. I don't really think it matters much if null is
treated as 'remove' or as 'do nothing', but appending 'null' seems
pretty useless in pretty much all cases.

We shouldn't let what webidl says dictate what we do one way or the
other. It's just a spec for the idl language, not a recommendation for
how interfaces should behave.

FWIW I think the webidl spec should be changed here, but i'll raise that
in a thread for that spec.

/ Jonas
Anne van Kesteren
2008-05-25 22:29:58 UTC
Permalink
Post by Jonas Sicking
Agreed. We have in the past said that in the cases where it doesn't seem
like the web is depending on a certain behavior one way or the other do
what is most useful. I don't really think it matters much if null is
treated as 'remove' or as 'do nothing', but appending 'null' seems
pretty useless in pretty much all cases.
It's pretty common behavior for a lot of APIs though Firefox seems to do
it differently from everyone else quite often if I remember correctly.
Post by Jonas Sicking
We shouldn't let what webidl says dictate what we do one way or the
other. It's just a spec for the idl language, not a recommendation for
how interfaces should behave.
null/undefined are not really part of the setRequestHeader() method. We
just need to deal with them somehow and doing what similar APIs do in such
cases makes sense.
Post by Jonas Sicking
FWIW I think the webidl spec should be changed here, but i'll raise that
in a thread for that spec.
I think it makes sense for Web IDL to specify the most common behavior as
default.
--
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>
Maciej Stachowiak
2008-05-25 23:29:25 UTC
Permalink
Post by Jonas Sicking
Post by Julian Reschke
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
Per the updated specification which uses Web IDL IE and Safari
are conformant here. (null and undefined are simply stringified.)
Not terrible useful, I would say. Is that something we have to
live with because of the IDL definition???
It matches two implementations and is the default behavior for
null/undefined when passed to something that accepts a string.
Apparently existing content does not rely on it (FF gets away with
implementing something that IMHO makes *much* more sense). So why
standardize it at all, or, when doing so, select something that
doesn't make sense in practice?
Or are you claiming that people who set a header to null *really*
want the specified behaviour?
Agreed. We have in the past said that in the cases where it doesn't
seem like the web is depending on a certain behavior one way or the
other do what is most useful. I don't really think it matters much
if null is treated as 'remove' or as 'do nothing', but appending
'null' seems pretty useless in pretty much all cases.
We shouldn't let what webidl says dictate what we do one way or the
other. It's just a spec for the idl language, not a recommendation
for how interfaces should behave.
Web IDL can be used to specify all sorts of different behaviors for
null and undefined. Its default setting is not really materially
relevant. To change the spec behavior we would just have to change the
IDL in the XHR spec.

I agree it is unlikely that content deeply depends on behavior for
null or undefined, but it might be worth doing some testing to
quantify this.

Regards,
Maciej
Anne van Kesteren
2008-05-25 22:19:25 UTC
Permalink
Post by Julian Reschke
Apparently existing content does not rely on it (FF gets away with
implementing something that IMHO makes *much* more sense). So why
standardize it at all, or, when doing so, select something that doesn't
make sense in practice?
Or are you claiming that people who set a header to null *really* want
the specified behaviour?
It's consistent with other JavaScript APIs were null also means "null".

Overloading this API to also do removal of the header is not a goal here
and is simply a bug in Firefox as it also does that for the empty string
value (Firefox simply treats null identically to the empty string, where
other browsers treat it identically to "null".
--
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>
Maciej Stachowiak
2008-05-25 23:30:48 UTC
Permalink
Post by Anne van Kesteren
Post by Julian Reschke
Apparently existing content does not rely on it (FF gets away with
implementing something that IMHO makes *much* more sense). So why
standardize it at all, or, when doing so, select something that
doesn't make sense in practice?
Or are you claiming that people who set a header to null *really*
want the specified behaviour?
It's consistent with other JavaScript APIs were null also means "null".
Overloading this API to also do removal of the header is not a goal
here and is simply a bug in Firefox as it also does that for the
empty string value (Firefox simply treats null identically to the
empty string, where other browsers treat it identically to "null".
Treating null as empty string here may be sensible (no strong opinion
either way) but removing the header when set to empty seems wrong. If
header removal is really essential we should add a method for it.

Regards,
Maciej
Julian Reschke
2008-05-26 06:06:22 UTC
Permalink
Post by Maciej Stachowiak
Treating null as empty string here may be sensible (no strong opinion
either way) but removing the header when set to empty seems wrong. If
header removal is really essential we should add a method for it.
In HTTP, absence of a header is different from having an empty value.

I can understand the argument that set(..., null) is the wrong way to
remove a value. But if it doesn't, it shouldn't do anything that a
non-null argument would do.

So yes, an explicit way to remove an header would be good. Otherwise
we'll see broken requests on the wire (as just seen in the example I
cited a few days ago).

BR, Julian
Maciej Stachowiak
2008-05-26 08:00:26 UTC
Permalink
Post by Julian Reschke
Post by Maciej Stachowiak
Treating null as empty string here may be sensible (no strong
opinion either way) but removing the header when set to empty seems
wrong. If header removal is really essential we should add a method
for it.
In HTTP, absence of a header is different from having an empty value.
I can understand the argument that set(..., null) is the wrong way
to remove a value.
Good!
Post by Julian Reschke
But if it doesn't, it shouldn't do anything that a non-null argument
would do.
Why not? In nearly every JS API that takes a string, the JS value null
is either treated the same as the empty string, or the same as the
string "null".
Post by Julian Reschke
So yes, an explicit way to remove an header would be good. Otherwise
we'll see broken requests on the wire (as just seen in the example I
cited a few days ago).
I am ok with deferring such a mechanism to XHR2 however. In WebKit
we'll likely implement it equally quickly whether it is in XHR1 or
XHR2 since it seems like useful functionality. But there are
complications, namely, how does it interact with headers that are set
automatically by the UA?

Regards,
Maciej
Anne van Kesteren
2008-05-26 09:09:07 UTC
Permalink
I am ok with deferring such a mechanism to XHR2 however. In WebKit we'll
likely implement it equally quickly whether it is in XHR1 or XHR2 since
it seems like useful functionality. But there are complications, namely,
how does it interact with headers that are set automatically by the UA?
It's not clear to me at all what problem it solves. The examples given so
far are all UA bugs.
--
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>
Ian Hickson
2008-05-26 10:18:34 UTC
Permalink
Post by Anne van Kesteren
I am ok with deferring such a mechanism to XHR2 however. In WebKit we'll
likely implement it equally quickly whether it is in XHR1 or XHR2 since it
seems like useful functionality. But there are complications, namely, how
does it interact with headers that are set automatically by the UA?
It's not clear to me at all what problem it solves. The examples given
so far are all UA bugs.
I do think that setting the header to the empty string (as if "" had been
passed instead) is better behaviour, from an author's point of view. If
that would resolve this issue then that seems like a good choice.
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Anne van Kesteren
2008-05-26 10:37:28 UTC
Permalink
Post by Ian Hickson
I do think that setting the header to the empty string (as if "" had been
passed instead) is better behaviour, from an author's point of view. If
that would resolve this issue then that seems like a good choice.
As far as I can tell three out of four browsers stringify to "null" /
"undefined" for arbitrary headers and since authors should pass a string
anyway I really don't think it's worth changing this.
--
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>
Julian Reschke
2008-05-26 11:15:49 UTC
Permalink
Post by Anne van Kesteren
Post by Ian Hickson
I do think that setting the header to the empty string (as if "" had been
passed instead) is better behaviour, from an author's point of view. If
that would resolve this issue then that seems like a good choice.
As far as I can tell three out of four browsers stringify to "null" /
"undefined" for arbitrary headers and since authors should pass a string
anyway I really don't think it's worth changing this.
That behavior simply is not useful, and likely will hide bugs.

FF3 (removing the header) demonstrates that this case (null value)
either should be left unspecified, or specified with a more useful behavior.

BR, Julian
Julian Reschke
2008-05-26 11:13:29 UTC
Permalink
Post by Ian Hickson
Post by Anne van Kesteren
I am ok with deferring such a mechanism to XHR2 however. In WebKit we'll
likely implement it equally quickly whether it is in XHR1 or XHR2 since it
seems like useful functionality. But there are complications, namely, how
does it interact with headers that are set automatically by the UA?
It's not clear to me at all what problem it solves. The examples given
so far are all UA bugs.
I do think that setting the header to the empty string (as if "" had been
passed instead) is better behaviour, from an author's point of view. If
that would resolve this issue then that seems like a good choice.
That is not sufficient for the case where a library wants to set a
header that may already have been set before.

If it does

xhr.setRequestHeader("foo", "");
xhr.setRequestHeader("foo", "bar");

currently would result in

foo: ,bar

being sent.

BR, Julian

PS: and no, FF3 doesn't do that.
Julian Reschke
2008-05-26 11:11:42 UTC
Permalink
Post by Anne van Kesteren
Post by Maciej Stachowiak
I am ok with deferring such a mechanism to XHR2 however. In WebKit
we'll likely implement it equally quickly whether it is in XHR1 or
XHR2 since it seems like useful functionality. But there are
complications, namely, how does it interact with headers that are set
automatically by the UA?
It's not clear to me at all what problem it solves. The examples given
so far are all UA bugs.
The problem that needs to be solved is that clients need a reliable way
to set a header.

Issues with the current spec are:

- implementations that preset headers on object creation

- implementations *adding* values before the request is being made

- library code that acts on an existing XHR instance but did not create
it, thus has no way what headers already have been set

(the last one IMHO is the most important one, and the one that really
requires new functionality)

BR, Julian
Julian Reschke
2008-05-26 11:09:02 UTC
Permalink
Post by Maciej Stachowiak
Post by Julian Reschke
But if it doesn't, it shouldn't do anything that a non-null argument
would do.
Why not? In nearly every JS API that takes a string, the JS value null
is either treated the same as the empty string, or the same as the
string "null".
That may be true for JavaScript, but not for other programming languages.

Imposing a JS-ish API on an interface that should work for more than JS
seems to be a bad idea to me.
Post by Maciej Stachowiak
Post by Julian Reschke
So yes, an explicit way to remove an header would be good. Otherwise
we'll see broken requests on the wire (as just seen in the example I
cited a few days ago).
I am ok with deferring such a mechanism to XHR2 however. In WebKit we'll
likely implement it equally quickly whether it is in XHR1 or XHR2 since
it seems like useful functionality. But there are complications, namely,
I personally do not care much in what spec it is being defined. What's
important is that it gets defined and implemented.
Post by Maciej Stachowiak
how does it interact with headers that are set automatically by the UA?
One approach would be to specify that the implementation should
distinguish client-provided values from headers set by the
implementation, and then define how these get merged when the request is
being made.

Some headers would always be set by the implementation, some only by the
caller, some would need to be merged.

BR, Julian
Anne van Kesteren
2008-05-26 11:45:01 UTC
Permalink
Post by Julian Reschke
Post by Maciej Stachowiak
Post by Julian Reschke
But if it doesn't, it shouldn't do anything that a non-null argument
would do.
Why not? In nearly every JS API that takes a string, the JS value null
is either treated the same as the empty string, or the same as the
string "null".
That may be true for JavaScript, but not for other programming languages.
Imposing a JS-ish API on an interface that should work for more than JS
seems to be a bad idea to me.
Other programming languages can pick a much better API for HTTP requests.
I added "It is the ECMAScript HTTP API." to the introduction.
--
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>
Maciej Stachowiak
2008-05-26 19:44:02 UTC
Permalink
Post by Julian Reschke
Post by Maciej Stachowiak
Post by Julian Reschke
But if it doesn't, it shouldn't do anything that a non-null
argument would do.
Why not? In nearly every JS API that takes a string, the JS value
null is either treated the same as the empty string, or the same as
the string "null".
That may be true for JavaScript, but not for other programming
languages.
Using XHR with non-JavaScript programming languages seems pretty
unlikely.
Post by Julian Reschke
Imposing a JS-ish API on an interface that should work for more than
JS seems to be a bad idea to me.
That being said, let's be clear, the Web IDL extended attributes being
used here define what the JavaScript language binding does with
various non-string values. I would not expect the Java language
binding for Web IDL to have any handling of undefined (since Java has
no such value) and to treat null either same as the empty string or as
a type error, but never as the string "null". JavaScript's odd type
conversion rules would only ever apply to the JavaScript language
binding. In Apple's Objective-C binding of the DOM we don't ever treat
null pointers as the string "null".

Given this perhaps the Web IDL extended attributes should be recast to
look more language-neutral. For example, [Null=Allowed] DOMString
would mean that null is allowed for this string argument in all
language bindings where there is a distinguished null value. But the
default DOMString would mean null is not allowed, which may lead to
language-specific type-conversion (which in JavaScript in particular
means null is converted to the string "null") or possibly a null
pointer exception, a compile-time type error, or treating same as the
empty string in languages where that is the natural behavior.
Post by Julian Reschke
Post by Maciej Stachowiak
Post by Julian Reschke
So yes, an explicit way to remove an header would be good.
Otherwise we'll see broken requests on the wire (as just seen in
the example I cited a few days ago).
I am ok with deferring such a mechanism to XHR2 however. In WebKit
we'll likely implement it equally quickly whether it is in XHR1 or
XHR2 since it seems like useful functionality. But there are
complications, namely,
I personally do not care much in what spec it is being defined.
What's important is that it gets defined and implemented.
Post by Maciej Stachowiak
how does it interact with headers that are set automatically by the UA?
One approach would be to specify that the implementation should
distinguish client-provided values from headers set by the
implementation, and then define how these get merged when the
request is being made.
Some headers would always be set by the implementation, some only by
the caller, some would need to be merged.
I think it would be reasonable to define that removal only removes a
header from the caller's requested set of additions, and the UA does
its normal postprocessing (which may include adding to or replacing
certain headers) at the time the request is issued.

Regards,
Maciej
Julian Reschke
2008-05-26 06:03:00 UTC
Permalink
Post by Anne van Kesteren
Post by Julian Reschke
Or are you claiming that people who set a header to null *really* want
the specified behaviour?
It's consistent with other JavaScript APIs were null also means "null".
Overloading this API to also do removal of the header is not a goal here
and is simply a bug in Firefox as it also does that for the empty string
value (Firefox simply treats null identically to the empty string, where
other browsers treat it identically to "null".
If you don't want to specify removal, then make it either undefined
behavior, or specify that an exception must be thrown.

It's all better than to let something on the wire that the caller of the
API didn't want there in the first place.

BR, Julian
Bjoern Hoehrmann
2008-05-14 13:34:04 UTC
Permalink
Post by Anne van Kesteren
Post by Julian Reschke
"For security reasons, these steps should be terminated if the header
* Accept-Charset
* Accept-Encoding
* Connection
* Content-Length
* Content-Transfer-Encoding
* Date
* Expect
* Host
* Keep-Alive
* Referer
* TE
* Trailer
* Transfer-Encoding
* Upgrade
* Via "
It's unclear why there's a security reason not to allow things like
"Accept-Charset" or "Accept-Encoding". Please explain.
This was done based on implementation feedback. I haven't investigated
what the reasons were for the various headers. If implementors read this
maybe they could chime in and point it out.
Note that there are more headers on the list than the ones listed above,
specifically Proxy-*, Sec-*, and it is unclear how to handle, say, the
Cookie and Authorization header.

The correct value, if any, of the Connection, Content-Length, Expect,
Keep-Alive, Trailer, Transfer-Encoding, and Upgrade depends on decisions
about how to transfer the message and how to maintain the connection
that the implementation alone can make, therefore the implementation
rather than the script controls these headers. The Host header is on the
list to ensure scripts cannot bypass same origin restrictions.

Date, Referer, and Via inform about the origin of the request, they are
controlled by the implementation to prevent origin spoofing. The case
for these is much less clear, considering that other headers like User-
Agent are not on the list, and that cross-site requests are not allowed.

Accept-Charset, Accept-Encoding, and TE inform about client capabilities
and it seems the worst that could happen for them is that the server
offers a response the implementation cannot handle, which the server may
do anyway. I don't think their presence is particularily justified. This
is also because some environments treat "X-Y" named headers as if they
were "X_Y" headers and vice versa, if, say, Accept-Encoding is a problem
so would be Accept_Encoding.

Why Content-Transfer-Encoding is on the list I have no idea, HTTP does
not use this header at all, and when I researched this some months ago,
I could not find any particular security problems associated to it, as
far as I remember.

I very much agree the rationale for each header needs to be in the spec,
in a manner that also allows telling why other headers are not.
--
Björn Höhrmann · mailto:***@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/
Ian Hickson
2008-05-14 20:45:32 UTC
Permalink
Post by Bjoern Hoehrmann
Note that there are more headers on the list than the ones listed above,
specifically Proxy-*, Sec-*, and it is unclear how to handle, say, the
Cookie and Authorization header.
I think I would lump the Cookie, Cookie2, and Authorization headers in the
same bucket as, e.g., Host -- these are headers that the UA should be
setting and not headers that should be under author control.

Incidentally, I think I would recommend removing the blacklist from AC,
since AC has a whitelist. Having both seems pointless.
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Julian Reschke
2008-05-15 08:02:03 UTC
Permalink
Post by Ian Hickson
...
Incidentally, I think I would recommend removing the blacklist from AC,
since AC has a whitelist. Having both seems pointless.
...
You mean disallowing all headers except a known list??? Nope.

Again, that would mean profiling HTTP, and make it impossible to deploy
new stuff.

BR, Julian
Ian Hickson
2008-05-15 09:19:01 UTC
Permalink
Post by Julian Reschke
Post by Ian Hickson
...
Incidentally, I think I would recommend removing the blacklist from AC,
since AC has a whitelist. Having both seems pointless.
...
You mean disallowing all headers except a known list??? Nope.
Again, that would mean profiling HTTP, and make it impossible to deploy new
stuff.
It's what XHR2+AC already requires, I'm just suggesting simplifying the
prose of AC to remove the redundant blacklist (since it doesn't have any
testable block-box effect).
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Anne van Kesteren
2008-05-16 09:01:38 UTC
Permalink
Post by Ian Hickson
Post by Bjoern Hoehrmann
Note that there are more headers on the list than the ones listed above,
specifically Proxy-*, Sec-*, and it is unclear how to handle, say, the
Cookie and Authorization header.
I think I would lump the Cookie, Cookie2, and Authorization headers in the
same bucket as, e.g., Host -- these are headers that the UA should be
setting and not headers that should be under author control.
Agreed, I added these.
Post by Ian Hickson
Incidentally, I think I would recommend removing the blacklist from AC,
since AC has a whitelist. Having both seems pointless.
Access Control for Cross-Site Requests does actually allow arbitrary
headers in the request, though a preflight request is required if they are
not in the whitelist. Therefore it is important that the blacklist is
still there to filter out all headers that should not be allowed even if
the server agrees. (Arguably this blacklist is not relevant in the
XMLHttpRequest case because there those headers are filtered at an earlier
level.)
--
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>
Maciej Stachowiak
2008-05-16 08:53:15 UTC
Permalink
Post by Julian Reschke
Post by Maciej Stachowiak
In practice it is much more important for same-origin to be
implemented
consistently between XHR and HTML5 (and other Web standards) than
for it
to be precisely consistent cross-browser, as inconsistencies in the
same-origin policy could lead to security holes. Thus, taking a
snapshot
of what HTML5 says and putting it in XHR1 would be a dead letter,
because if HTML5 changes and browsers change to match it, they will
not
leave their XHR implementation using an older version of the security
policy.
Interesting enough, this seems to be exactly the opposite of what Ian
HTML5 and browsers all differ slightly from each other on these
issues. Though HTML5 does not aim to invent anything in the area of
cross-domain security, I think there will be iterative convergence
among the implementations and the spec.

The point is, if XHR1 ends up requiring something different than HTML5
does, at least one of those will be ignored by implementors. Or to
look at it another way, either HTML5 will not change on anything it
requires on this, in which case citing its definitions won't actually
change the meaning of XHR1 in the future; or it will change, in which
case having an obsolete copy of the definitions in XHR1 will be
actively harmful.

So we should either cite by reference or be prepared to promptly issue
errata in the future.

Regards,
Maciej
Post by Julian Reschke
Ian> The point is that Apple and Microsoft are both going to
implement the
Ian> thing as required by the Web in 2000, not as defined in HTML5.
HTML5 is
Ian> describing existing practice on these matters, not defining new
material.
BR, Julian
Anne van Kesteren
2008-05-16 10:07:16 UTC
Permalink
Post by Julian Reschke
b) Algorithms: the spec uses a method to describe algorithms that IM=
HO =
Post by Julian Reschke
is extremely hard to read (see for instance send() method). This may=
be =
Post by Julian Reschke
good for implementors, but seems to be bad for everybody else. =
Minimally, the lists should be structured for better readability.
Could you elaborate on what kind of change you envision? I'm not =
surehow they are not structured right now.
- these steps deal with credentials, and the whole list would be more
readable if each group of steps that belong together would me structur=
ed
Post by Julian Reschke
that way;
Since this is the second Last Call and credentials are already following=
=

each other (and the same for other similar steps) I've decided not to =

change this.
Post by Julian Reschke
c) Structure: It would be nice if Section 4 had more structure. Righ=
t =
Post by Julian Reschke
now it's ugly to navigate and refer to.
This is better in XMLHttpRequest Level 2. I rather not revise =
thatentire section editorially as it might introduce new errors.
But then, it makes a comparison with XHR2 harder. Please reconsider.
Given that XMLHttpRequest Level 2 has more changes than just this in ter=
ms =

of structure I don't think it will help that much.
Post by Julian Reschke
Yes, as stated it must be a subset that matches what XMLHttpRequest =
requires from the eventing and core specifications.
Then it would be clearer if it said "the subset" instead of "some =
subset".
Changed:

http://dev.w3.org/2006/webapi/XMLHttpRequest/#dependencies
Post by Julian Reschke
Well, if we're talking about URIs (and I think we do), then we need to=
refer to RFC3986 grammar and comparison rules.
Ok, referenced RFC3986 as well.
Post by Julian Reschke
Besides that: this may be a non-optimal example unless we can point =
=
Post by Julian Reschke
toa definition of "HttpOnly cookies". Can we?
I don't believe we can, but since this was put in mostly for HttpOnly=
=
Post by Julian Reschke
cookies I rather not remove that. I think it will be clear enough for=
=
Post by Julian Reschke
people reading the document.
So why don't we refer to the specification for httpOnly? Do you consid=
er
Post by Julian Reschke
it a problem that it's a Microsoft document?
I added a pointer to http://msdn.microsoft.com/en-us/library/ms533046.as=
px
Post by Julian Reschke
As TRACK doesn't seem to be documented anywhere, and not implemented i=
n
Post by Julian Reschke
current IIS versions anymore, I'd really like to see this made a foot
node. The way it's written now is just totally confusing to every read=
er
Post by Julian Reschke
who doesn't know the full story around it.
I added a note.
Post by Julian Reschke
"If the user argument was not omitted and is not null let stored =
userbe user encoded using the encoding specified in the relevant =
authentication scheme or UTF-8 if the scheme fails to specify an =
encoding."
Why is XHR talking about the encoding here? Is "stored user" a =
stringor a byte array?
(same for password)
They're a string (in the API).
When they are a string, then taking about character encoding doesn't
make any sense here.
Actually, since you need to encode them for the request it does.
Post by Julian Reschke
"If the value argument is null terminate these steps. (Do not raise =
an =
Post by Julian Reschke
exception.)."
This makes it impossible to set empty headers, which are allowed in =
HTTP. Even worse, it silently fails.
Empty headers can be set using the empty string, no? Not raising an =
exception is consistent with implementations and I don't think =
itmatters much as it doesn't have any effect.
Sorry, was reading one thing, but thinking about something else.
Thinking of it, could you please add a clarification that setting to a=
n
Post by Julian Reschke
empty string is legal, and MUST NOT be ignored? I recall that
Microsoft's original XHR (ActiveX) implementation got that wrong, not
setting the header at all.
I added a note to that effect as it is already normatively required.
Post by Julian Reschke
"Serialize data into a namespace well-formed XML document and encode=
d =
Post by Julian Reschke
using the encoding given by data.inputEncoding, when not null, orUTF=
-8 =
Post by Julian Reschke
otherwise. Or, if this fails because the Document cannot beserialize=
d =
Post by Julian Reschke
act as if data is null."
Does anybody rely on that? I would be very suprised.
I don't know, but it seems safest to not require changes here for =

compatibility.
Post by Julian Reschke
"If no Content-Type header has been set using setRequestHeader()appe=
nd =
Post by Julian Reschke
a Content-Type header to the list of request headers with avalue of =
=
Post by Julian Reschke
application/xml;charset=3Dcharset where charset is theencoding used=
to =
Post by Julian Reschke
encode the document."
This will result in an invalid Content-Type header if the UA has =
initialized the headers with a default (which I think the =
speccurrently allows; and at least one UA was reported to do). See =
commentabove about header handling.
Rephrased.
Pointer?
http://dev.w3.org/2006/webapi/XMLHttpRequest/#send
Post by Julian Reschke
"If the user agent supports HTTP State Management it should persist,=
=
Post by Julian Reschke
discard and send cookies (as received in the Set-Cookie andSet-Cooki=
e2 =
Post by Julian Reschke
response headers, and sent in the Cookie header) asapplicable. =
[RFC2965]"
This should probably include a reference to the Set-Cookie (not =
Set-Cookie2) spec as well (RFC2109).
I believe it used to do that and it was pointed out that that =
specification is not useful in practice and would actually do more ha=
rm =
Post by Julian Reschke
than good. I'm not really sure what to do here.
Well, the one that is not used in practice is RFC2965, not RFC2109. Th=
at
Post by Julian Reschke
being said, you probably need to reference both.
Ok done.
Post by Julian Reschke
var client =3D new XMLHttpRequest();
client.open("GET", "test.txt", true);
client.send();
client.onreadystatechange =3D function() {
if(this.readyState =3D=3D 3) {
print(this.getAllResponseHeaders());
}
}
Date: Sun, 24 Oct 2004 04:58:38 GMT
Server: Apache/1.3.31 (Unix)
Keep-Alive: timeout=3D15, max=3D99
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/plain; charset=3Dutf-8"
I think examples like this would be more readable (and take lessspac=
e) =
Post by Julian Reschke
when using the syncr. mode.
I would like to avoid encouraging authors to use the synchronous API.=
Disagreed. I think readability and compactness is more important here.=
I disagree. It would also change the example as then the header =

information would only be made available after all data has been =

downloaded rather than when the header information is available.
Post by Julian Reschke
"status of type unsigned short, readonly
On getting, if available, it must return the HTTP status code sent b=
y =
Post by Julian Reschke
the server (typically 200 for a successful request). Otherwise, if n=
ot =
Post by Julian Reschke
available, the user agent must raise an INVALID_STATE_ERR exception.=
"
Post by Julian Reschke
This may be incorrect when the UA caches (304 vs 200).
That's why it says typically.
Hm, no.
When the UA caches, and the server sent 304, the client will potential=
ly
Post by Julian Reschke
see a 200. This would contradict what *this* paragraph says.
I fixed this by saying that in case of user agent conditional requests t=
he =

user agent must act as if the server gave a 200 response in case of a 30=
4 =

response.
Post by Julian Reschke
"statusText of type DOMString, readonly
On getting, if available, it must return the HTTP status textse=
nt =
Post by Julian Reschke
by the server (appears after the status code). Otherwise, if not =
available, the user agent must raise an INVALID_STATE_ERR exception.=
"
Post by Julian Reschke
Really? It seems to me that if somebody really implements this,clien=
ts =
Post by Julian Reschke
are likely to break. Why not allow an empty string here?
This is what clients have implemented as far as I can tell. Though th=
e =
Post by Julian Reschke
HTTP status text could be the empty string, if that's what you mean..=
.
Post by Julian Reschke
Does the "if not available" apply to any of the existing
implementations? Why would it be "not available"? Please clarify.
Added "(request is not initiated for instance)".
Post by Julian Reschke
All requirements from HTTP are taken over unless explicitly stated so=
I =
Post by Julian Reschke
don't think this is needed.
Well, the spec repeats lots of things specified somewhere else already=
.
Post by Julian Reschke
The warning from the HTTP spec is relevant and should appear here, as
XHR is related to UAs, and existing UAs are known to ignore this
security consideration.
In that case I'd be even more hesitant to repeat it in XMLHttpRequest as=
=

it seems like something HTTP should try to address one way or another.


-- =

Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>
Julian Reschke
2008-05-16 11:14:12 UTC
Permalink
Post by Anne van Kesteren
Since this is the second Last Call and credentials are already following
each other (and the same for other similar steps) I've decided not to
change this.
Unfortunately.
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
Post by Julian Reschke
c) Structure: It would be nice if Section 4 had more structure.
Rightnow it's ugly to navigate and refer to.
This is better in XMLHttpRequest Level 2. I rather not revise
thatentire section editorially as it might introduce new errors.
But then, it makes a comparison with XHR2 harder. Please reconsider.
Given that XMLHttpRequest Level 2 has more changes than just this in
terms of structure I don't think it will help that much.
At this point, I'm not sure why we're bothering with XHR1 at all. It is
*not* what the current implementations do anyway.
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
Yes, as stated it must be a subset that matches what
XMLHttpRequestrequires from the eventing and core specifications.
Then it would be clearer if it said "the subset" instead of "some
subset".
http://dev.w3.org/2006/webapi/XMLHttpRequest/#dependencies
Thanks.
Post by Anne van Kesteren
Post by Julian Reschke
Well, if we're talking about URIs (and I think we do), then we need to
refer to RFC3986 grammar and comparison rules.
Ok, referenced RFC3986 as well.
That's not sufficient, and not what I asked for. Please make up your
mind whether it's a URI or a IRI, and then cite accordingly.
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
Post by Julian Reschke
Besides that: this may be a non-optimal example unless we can point
toa definition of "HttpOnly cookies". Can we?
I don't believe we can, but since this was put in mostly for
HttpOnlycookies I rather not remove that. I think it will be clear
enough forpeople reading the document.
So why don't we refer to the specification for httpOnly? Do you consider
it a problem that it's a Microsoft document?
I added a pointer to http://msdn.microsoft.com/en-us/library/ms533046.aspx
Thanks.
Post by Anne van Kesteren
Post by Julian Reschke
As TRACK doesn't seem to be documented anywhere, and not implemented in
current IIS versions anymore, I'd really like to see this made a foot
node. The way it's written now is just totally confusing to every reader
who doesn't know the full story around it.
I added a note.
I'd prefer it to be moved somewhere else, but at least it's an improvement.
Post by Anne van Kesteren
Post by Julian Reschke
When they are a string, then taking about character encoding doesn't
make any sense here.
Actually, since you need to encode them for the request it does.
But that totally depends on the authentication scheme. I think you're
confusing layers here.
Post by Anne van Kesteren
Post by Julian Reschke
Thinking of it, could you please add a clarification that setting to an
empty string is legal, and MUST NOT be ignored? I recall that
Microsoft's original XHR (ActiveX) implementation got that wrong, not
setting the header at all.
I added a note to that effect as it is already normatively required.
Thanks. It currently says:

"Note: The empty string is legal."

Maybe you could add "and represent an empty header value"?
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
Post by Julian Reschke
"Serialize data into a namespace well-formed XML document and
encodedusing the encoding given by data.inputEncoding, when not
null, orUTF-8 otherwise. Or, if this fails because the Document
cannot beserialized act as if data is null."
Does anybody rely on that? I would be very suprised.
I don't know, but it seems safest to not require changes here for
compatibility.
Sounds like something that should be tested. Silent data loss is a bad
thing, and I really don't believe that any existing content relies on that.
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
Post by Julian Reschke
"If no Content-Type header has been set using
setRequestHeader()append a Content-Type header to the list of
request headers with avalue of application/xml;charset=charset
where charset is theencoding used to encode the document."
This will result in an invalid Content-Type header if the UA
hasinitialized the headers with a default (which I think the
speccurrently allows; and at least one UA was reported to do). See
commentabove about header handling.
Rephrased.
Pointer?
http://dev.w3.org/2006/webapi/XMLHttpRequest/#send
So is it legal for implementations to populate certain headers upon
object creation?
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
Post by Julian Reschke
"If the user agent supports HTTP State Management it should
persist,discard and send cookies (as received in the Set-Cookie
andSet-Cookie2 response headers, and sent in the Cookie header)
asapplicable. [RFC2965]"
This should probably include a reference to the Set-Cookie
(notSet-Cookie2) spec as well (RFC2109).
I believe it used to do that and it was pointed out that
thatspecification is not useful in practice and would actually do
more harmthan good. I'm not really sure what to do here.
Well, the one that is not used in practice is RFC2965, not RFC2109. That
being said, you probably need to reference both.
Ok done.
Thanks.
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
Post by Julian Reschke
var client = new XMLHttpRequest();
client.open("GET", "test.txt", true);
client.send();
client.onreadystatechange = function() {
if(this.readyState == 3) {
print(this.getAllResponseHeaders());
}
}
Date: Sun, 24 Oct 2004 04:58:38 GMT
Server: Apache/1.3.31 (Unix)
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/plain; charset=utf-8"
I think examples like this would be more readable (and take
lessspace) when using the syncr. mode.
I would like to avoid encouraging authors to use the synchronous API.
Disagreed. I think readability and compactness is more important here.
I disagree. It would also change the example as then the header
information would only be made available after all data has been
downloaded rather than when the header information is available.
How is this relevant for demonstrating the output format for
getAllResponseHeaders()?
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
Post by Julian Reschke
"status of type unsigned short, readonly
On getting, if available, it must return the HTTP status code sent
bythe server (typically 200 for a successful request). Otherwise, if
notavailable, the user agent must raise an INVALID_STATE_ERR
exception."
This may be incorrect when the UA caches (304 vs 200).
That's why it says typically.
Hm, no.
When the UA caches, and the server sent 304, the client will potentially
see a 200. This would contradict what *this* paragraph says.
I fixed this by saying that in case of user agent conditional requests
the user agent must act as if the server gave a 200 response in case of
a 304 response.
That's better, although still a bit confusing.
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
All requirements from HTTP are taken over unless explicitly stated so
Idon't think this is needed.
Well, the spec repeats lots of things specified somewhere else already.
The warning from the HTTP spec is relevant and should appear here, as
XHR is related to UAs, and existing UAs are known to ignore this
security consideration.
In that case I'd be even more hesitant to repeat it in XMLHttpRequest as
it seems like something HTTP should try to address one way or another.
Well, it is addressed in HTTP.

BR, Julian
Sunava Dutta
2008-05-16 20:52:20 UTC
Permalink
Comment Inline.
Post by Sunava Dutta
-----Original Message-----
On Behalf Of Julian Reschke
Sent: Friday, May 16, 2008 4:14 AM
To: Anne van Kesteren
Cc: Web API WG (public)
Subject: Re: XHR LC comments
Post by Anne van Kesteren
Since this is the second Last Call and credentials are already following
each other (and the same for other similar steps) I've decided not to
change this.
Unfortunately.
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
Post by Julian Reschke
c) Structure: It would be nice if Section 4 had more structure.
Rightnow it's ugly to navigate and refer to.
This is better in XMLHttpRequest Level 2. I rather not revise
thatentire section editorially as it might introduce new errors.
But then, it makes a comparison with XHR2 harder. Please reconsider.
Given that XMLHttpRequest Level 2 has more changes than just this in
terms of structure I don't think it will help that much.
At this point, I'm not sure why we're bothering with XHR1 at all. It is
*not* what the current implementations do anyway.
[Sunava Dutta] I'm sorry, this statement is concerning and I'd like to understand it better. We haven’t had a chance to run the latest test suite yet but expect the test suite to be compliant with at least two existing implementations. Do you mean the XHR 1 draft is not interoperable with existing implementations?
Post by Sunava Dutta
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
Yes, as stated it must be a subset that matches what
XMLHttpRequestrequires from the eventing and core specifications.
Then it would be clearer if it said "the subset" instead of "some
subset".
http://dev.w3.org/2006/webapi/XMLHttpRequest/#dependencies
Thanks.
Post by Anne van Kesteren
Post by Julian Reschke
Well, if we're talking about URIs (and I think we do), then we need to
refer to RFC3986 grammar and comparison rules.
Ok, referenced RFC3986 as well.
That's not sufficient, and not what I asked for. Please make up your
mind whether it's a URI or a IRI, and then cite accordingly.
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
Post by Julian Reschke
Besides that: this may be a non-optimal example unless we can point
toa definition of "HttpOnly cookies". Can we?
I don't believe we can, but since this was put in mostly for
HttpOnlycookies I rather not remove that. I think it will be clear
enough forpeople reading the document.
So why don't we refer to the specification for httpOnly? Do you
consider
Post by Anne van Kesteren
Post by Julian Reschke
it a problem that it's a Microsoft document?
I added a pointer to http://msdn.microsoft.com/en-
us/library/ms533046.aspx
Thanks.
Post by Anne van Kesteren
Post by Julian Reschke
As TRACK doesn't seem to be documented anywhere, and not implemented in
current IIS versions anymore, I'd really like to see this made a foot
node. The way it's written now is just totally confusing to every
reader
Post by Anne van Kesteren
Post by Julian Reschke
who doesn't know the full story around it.
I added a note.
I'd prefer it to be moved somewhere else, but at least it's an
improvement.
Post by Anne van Kesteren
Post by Julian Reschke
When they are a string, then taking about character encoding doesn't
make any sense here.
Actually, since you need to encode them for the request it does.
But that totally depends on the authentication scheme. I think you're
confusing layers here.
Post by Anne van Kesteren
Post by Julian Reschke
Thinking of it, could you please add a clarification that setting to an
empty string is legal, and MUST NOT be ignored? I recall that
Microsoft's original XHR (ActiveX) implementation got that wrong, not
setting the header at all.
I added a note to that effect as it is already normatively required.
"Note: The empty string is legal."
Maybe you could add "and represent an empty header value"?
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
Post by Julian Reschke
"Serialize data into a namespace well-formed XML document and
encodedusing the encoding given by data.inputEncoding, when not
null, orUTF-8 otherwise. Or, if this fails because the Document
cannot beserialized act as if data is null."
Does anybody rely on that? I would be very suprised.
I don't know, but it seems safest to not require changes here for
compatibility.
Sounds like something that should be tested. Silent data loss is a bad
thing, and I really don't believe that any existing content relies on that.
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
Post by Julian Reschke
"If no Content-Type header has been set using
setRequestHeader()append a Content-Type header to the list of
request headers with avalue of application/xml;charset=charset
where charset is theencoding used to encode the document."
This will result in an invalid Content-Type header if the UA
hasinitialized the headers with a default (which I think the
speccurrently allows; and at least one UA was reported to do). See
commentabove about header handling.
Rephrased.
Pointer?
http://dev.w3.org/2006/webapi/XMLHttpRequest/#send
So is it legal for implementations to populate certain headers upon
object creation?
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
Post by Julian Reschke
"If the user agent supports HTTP State Management it should
persist,discard and send cookies (as received in the Set-Cookie
andSet-Cookie2 response headers, and sent in the Cookie header)
asapplicable. [RFC2965]"
This should probably include a reference to the Set-Cookie
(notSet-Cookie2) spec as well (RFC2109).
I believe it used to do that and it was pointed out that
thatspecification is not useful in practice and would actually do
more harmthan good. I'm not really sure what to do here.
Well, the one that is not used in practice is RFC2965, not RFC2109.
That
Post by Anne van Kesteren
Post by Julian Reschke
being said, you probably need to reference both.
Ok done.
Thanks.
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
Post by Julian Reschke
var client = new XMLHttpRequest();
client.open("GET", "test.txt", true);
client.send();
client.onreadystatechange = function() {
if(this.readyState == 3) {
print(this.getAllResponseHeaders());
}
}
Date: Sun, 24 Oct 2004 04:58:38 GMT
Server: Apache/1.3.31 (Unix)
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/plain; charset=utf-8"
I think examples like this would be more readable (and take
lessspace) when using the syncr. mode.
I would like to avoid encouraging authors to use the synchronous API.
Disagreed. I think readability and compactness is more important here.
I disagree. It would also change the example as then the header
information would only be made available after all data has been
downloaded rather than when the header information is available.
How is this relevant for demonstrating the output format for
getAllResponseHeaders()?
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
Post by Julian Reschke
"status of type unsigned short, readonly
On getting, if available, it must return the HTTP status code sent
bythe server (typically 200 for a successful request). Otherwise, if
notavailable, the user agent must raise an INVALID_STATE_ERR
exception."
This may be incorrect when the UA caches (304 vs 200).
That's why it says typically.
Hm, no.
When the UA caches, and the server sent 304, the client will
potentially
Post by Anne van Kesteren
Post by Julian Reschke
see a 200. This would contradict what *this* paragraph says.
I fixed this by saying that in case of user agent conditional requests
the user agent must act as if the server gave a 200 response in case of
a 304 response.
That's better, although still a bit confusing.
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
All requirements from HTTP are taken over unless explicitly stated so
Idon't think this is needed.
Well, the spec repeats lots of things specified somewhere else already.
The warning from the HTTP spec is relevant and should appear here, as
XHR is related to UAs, and existing UAs are known to ignore this
security consideration.
In that case I'd be even more hesitant to repeat it in XMLHttpRequest as
it seems like something HTTP should try to address one way or another.
Well, it is addressed in HTTP
Julian Reschke
2008-05-17 08:03:18 UTC
Permalink
Post by Sunava Dutta
...
Post by Julian Reschke
At this point, I'm not sure why we're bothering with XHR1 at all. It is
*not* what the current implementations do anyway.
[Sunava Dutta] I'm sorry, this statement is concerning and I'd like to understand it better. We haven’t had a chance to run the latest test suite yet but expect the test suite to be compliant with at least two existing implementations. Do you mean the XHR 1 draft is not interoperable with existing implementations?
...
Absolutely. Everytime I check something that is of interest to me it
turns out that there is no interop, and that only some or even none of
the browsers works as specified.

Examples:

- Support for HTTP extension methods: IE violates the SHOULD level
requirement to support extenstion methods. Opera silently (!!!) changes
extension method names to "POST".

- setRequestHeader: none of the browsers throws an exception when
setting the header to null. Some do something useful (removing the
header), some treat it like an empty string, some seem to set the valoue
to the string "null".

I'm also concerned that the spec proposes behaviour that leads to silent
data loss, although it's totally unclear why this is needed for
interoperability (such as when a DOM to be serialized has no XML
representation).

It seems that what's needed here is more work on the test suite. LC is
way too early.


BR, Julian
Maciej Stachowiak
2008-05-17 09:04:17 UTC
Permalink
Post by Julian Reschke
Post by Sunava Dutta
...
Post by Julian Reschke
At this point, I'm not sure why we're bothering with XHR1 at all. It is
*not* what the current implementations do anyway.
[Sunava Dutta] I'm sorry, this statement is concerning and I'd like
to understand it better. We haven’t had a chance to run the latest
test suite yet but expect the test suite to be compliant with at
least two existing implementations. Do you mean the XHR 1 draft is
not interoperable with existing implementations?
...
Absolutely. Everytime I check something that is of interest to me it
turns out that there is no interop, and that only some or even none
of the browsers works as specified.
We decided long ago (and subsequently reaffirmed) that instead of
leaving the spec so vague that all existing implementations are
automatically compliant, we would define a shared interoperable
behavior so that implementations can converge. It should not be news
to anyone that implementations are not automatically 100% compliant.
Post by Julian Reschke
- Support for HTTP extension methods: IE violates the SHOULD level
requirement to support extenstion methods. Opera silently (!!!)
changes extension method names to "POST".
- setRequestHeader: none of the browsers throws an exception when
setting the header to null. Some do something useful (removing the
header), some treat it like an empty string, some seem to set the
valoue to the string "null".
I'm also concerned that the spec proposes behaviour that leads to
silent data loss, although it's totally unclear why this is needed
for interoperability (such as when a DOM to be serialized has no XML
representation).
It seems that what's needed here is more work on the test suite. LC
is way too early.
By W3C Process, the test suite is supposed to be developed during the
CR period. So by having one at all before LC, we are ahead of schedule.

Regards,
Maciej
Julian Reschke
2008-05-17 09:56:45 UTC
Permalink
Post by Maciej Stachowiak
Post by Julian Reschke
Absolutely. Everytime I check something that is of interest to me it
turns out that there is no interop, and that only some or even none of
the browsers works as specified.
We decided long ago (and subsequently reaffirmed) that instead of
leaving the spec so vague that all existing implementations are
automatically compliant, we would define a shared interoperable behavior
so that implementations can converge. It should not be news to anyone
that implementations are not automatically 100% compliant.
...
I'm totally happy not to leave things vague.

But what IMHO happens all over again is that strange choices in the
design are defended with the statement "this is what the vendors do, or
want to do", and when we check it, that turns out to be incorrect.

The totally broken API with respect to setting (or adding) header values
is the best example for that.

If we're specifying something vendors can converge on, why not specify
something *good*? Oh yes, the answer to that is "XHR2". I guess I'm
confused about both the goals and the planned timelines for these specs.

BR, Julian
Anne van Kesteren
2008-05-17 12:13:52 UTC
Permalink
Post by Julian Reschke
But what IMHO happens all over again is that strange choices in the
design are defended with the statement "this is what the vendors do, or
want to do", and when we check it, that turns out to be incorrect.
Could you point out one such example? I've actually tested a fair amount
of stuff, including headers, methods, etc. I agree that some of the
details of headers need to be worked out. For null/""/undefined I've been
waiting for the Web IDL specification. For which headers can be set by the
user agent I don't really have an answer and that part has not been
defined as such. That setRequestHeader() always appends was a conscious
choice to be in line with Internet Explorer. Initially the design was so
that it special cased a bunch of headers that did not allow duplication
which would have been more in line with Firefox, but given that it is not
a fixed list and the Internet Explorer route seemed more appropriate.
--
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>
Julian Reschke
2008-05-17 12:23:24 UTC
Permalink
On Sat, 17 May 2008 11:56:45 +0200, Julian Reschke
Post by Julian Reschke
But what IMHO happens all over again is that strange choices in the
design are defended with the statement "this is what the vendors do,
or want to do", and when we check it, that turns out to be incorrect.
Could you point out one such example? I've actually tested a fair amount
They are in the current threads.

- "add" semantics for setRequestHeader
- semantics for setRequestHeader(...,null)
- silent data loss for send() when DOM can't be serialized
- ...
of stuff, including headers, methods, etc. I agree that some of the
details of headers need to be worked out. For null/""/undefined I've
been waiting for the Web IDL specification. For which headers can be set
by the user agent I don't really have an answer and that part has not
been defined as such. That setRequestHeader() always appends was a
conscious choice to be in line with Internet Explorer. Initially the
design was so that it special cased a bunch of headers that did not
allow duplication which would have been more in line with Firefox, but
given that it is not a fixed list and the Internet Explorer route seemed
more appropriate.
Well, not to me. And apparently not to FF, as FF3 seems to ship with be
non-compliant behavior.

setRequestHeader() currently simply is broken. We should deprecate it,
and add new methods with well-defined semantics:

- removeHeader(...) (or specify set with null to mean remove)
- addHeader...
- getHeader...

BR, Julian
Anne van Kesteren
2008-05-17 12:45:01 UTC
Permalink
Post by Julian Reschke
On Sat, 17 May 2008 11:56:45 +0200, Julian Reschke
Post by Julian Reschke
But what IMHO happens all over again is that strange choices in the
design are defended with the statement "this is what the vendors do,
or want to do", and when we check it, that turns out to be incorrect.
Could you point out one such example? I've actually tested a fair amount
They are in the current threads.
- "add" semantics for setRequestHeader
- semantics for setRequestHeader(...,null)
- silent data loss for send() when DOM can't be serialized
- ...
I think only for the last one I have suggested that I rather not change it
based on that this seems like a safer choice. I have not seen any tests
that show that implementations actually throw in that case.
Post by Julian Reschke
of stuff, including headers, methods, etc. I agree that some of the
details of headers need to be worked out. For null/""/undefined I've
been waiting for the Web IDL specification. For which headers can be
set by the user agent I don't really have an answer and that part has
not been defined as such. That setRequestHeader() always appends was a
conscious choice to be in line with Internet Explorer. Initially the
design was so that it special cased a bunch of headers that did not
allow duplication which would have been more in line with Firefox, but
given that it is not a fixed list and the Internet Explorer route
seemed more appropriate.
Well, not to me. And apparently not to FF, as FF3 seems to ship with be
non-compliant behavior.
To my best knowledge Mozilla hasn't started implementing the specification
yet. I've seen several comments in their public bug database to the effect
that they rather wait until it reaches CR.
Post by Julian Reschke
setRequestHeader() currently simply is broken. We should deprecate it,
- removeHeader(...) (or specify set with null to mean remove)
- addHeader...
- getHeader...
"Deprecating" a method does not help implementations converge. Besides,
for typical usage there's no issue in using this header at all.
--
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>
Julian Reschke
2008-05-17 12:50:54 UTC
Permalink
On Sat, 17 May 2008 14:23:24 +0200, Julian Reschke
Post by Julian Reschke
On Sat, 17 May 2008 11:56:45 +0200, Julian Reschke
Post by Julian Reschke
But what IMHO happens all over again is that strange choices in the
design are defended with the statement "this is what the vendors do,
or want to do", and when we check it, that turns out to be incorrect.
Could you point out one such example? I've actually tested a fair amount
They are in the current threads.
- "add" semantics for setRequestHeader
- semantics for setRequestHeader(...,null)
- silent data loss for send() when DOM can't be serialized
- ...
I think only for the last one I have suggested that I rather not change
it based on that this seems like a safer choice. I have not seen any
tests that show that implementations actually throw in that case.
Data loss is not a "safe" choice, it's a bad choice.

Do you have any evidence of deployed code that would break if this would
throw?
...
Post by Julian Reschke
setRequestHeader() currently simply is broken. We should deprecate it,
- removeHeader(...) (or specify set with null to mean remove)
- addHeader...
- getHeader...
"Deprecating" a method does not help implementations converge. Besides,
for typical usage there's no issue in using this header at all.
Currently there is no conversion, and what is specified clearly can
cause implementations to create broken requests, where the code worked
before.

The semantics has always been broken (as compared, for instance, the
equivalent methods in the servlet spec). The sanest way out of this is
to deprecate the existing method, and to define new methods with sane
semantics.

BR, Julian
Julian Reschke
2008-05-17 13:26:21 UTC
Permalink
Post by Julian Reschke
...
Data loss is not a "safe" choice, it's a bad choice.
Do you have any evidence of deployed code that would break if this would
throw?
...
I just tried with FF3 and IE7.

Using a non-ns-wellformed document:

- FF3: happily sends it
- IE7: couldn't figure out how to create it (respect!)

Using an document that has no root element, but a single comment:

- FF3: happily sends it
- IE7: throws an exception

So, how is data loss a "safe" choice here???

BR, Julian
Boris Zbarsky
2008-05-17 17:30:22 UTC
Permalink
Post by Julian Reschke
- FF3: happily sends it
Out of curiosity, what did this document look like? What got sent?

-Boris
Julian Reschke
2008-05-17 18:12:42 UTC
Permalink
Post by Boris Zbarsky
Post by Julian Reschke
- FF3: happily sends it
Out of curiosity, what did this document look like? What got sent?
I removed the document element and added a comment node, so it looked like:

<!-- foo -->

BR, Julian
Julian Reschke
2008-05-17 18:13:56 UTC
Permalink
Post by Julian Reschke
Post by Boris Zbarsky
Post by Julian Reschke
- FF3: happily sends it
Out of curiosity, what did this document look like? What got sent?
<!-- foo -->
Sorry, that was the other case.

For this one I used Dom L1 methods to create this document:

<foo><x:y/></foo>

which isn't XMLNS-wellformed.

BR, Julian
Boris Zbarsky
2008-05-18 17:00:59 UTC
Permalink
Post by Julian Reschke
<foo><x:y/></foo>
which isn't XMLNS-wellformed.
I'm not sure I see the problem here, to be honest... Using the
non-namespace-aware DOM methods one can indeed create documents that require a
non-namespace-aware XML parser to roundtrip.

Since the UA has no idea what sort of XML parser is being used on the server
side, I'm not sure it makes sense to bail on attempts to serialize such
documents. In particular, if the document _is_ parsed with a
non-namespace-aware XML parser, there is no problem.

-Boris
Julian Reschke
2008-05-18 19:56:37 UTC
Permalink
Post by Boris Zbarsky
Post by Julian Reschke
<foo><x:y/></foo>
which isn't XMLNS-wellformed.
I'm not sure I see the problem here, to be honest... Using the
non-namespace-aware DOM methods one can indeed create documents that
require a non-namespace-aware XML parser to roundtrip.
Yes.
Post by Boris Zbarsky
Since the UA has no idea what sort of XML parser is being used on the
server side, I'm not sure it makes sense to bail on attempts to
serialize such documents. In particular, if the document _is_ parsed
with a non-namespace-aware XML parser, there is no problem.
That's true. But it's not what the XHR spec requires:

"Serialize data into a namespace well-formed XML document and encoded
using the encoding given by data.inputEncoding, when not null, or UTF-8
otherwise. Or, if this fails because the Document cannot be serialized
act as if data is null." --
<http://dev.w3.org/2006/webapi/XMLHttpRequest/#send>

So the spec requires silent data loss here, which I think is an
extremely bad idea.

BR, Julian
Boris Zbarsky
2008-05-18 20:02:31 UTC
Permalink
Post by Julian Reschke
Post by Boris Zbarsky
Since the UA has no idea what sort of XML parser is being used on the
server side, I'm not sure it makes sense to bail on attempts to
serialize such documents. In particular, if the document _is_ parsed
with a non-namespace-aware XML parser, there is no problem.
"Serialize data into a namespace well-formed XML document and encoded
using the encoding given by data.inputEncoding, when not null, or UTF-8
otherwise. Or, if this fails because the Document cannot be serialized
act as if data is null." --
<http://dev.w3.org/2006/webapi/XMLHttpRequest/#send>
So the spec requires silent data loss here, which I think is an
extremely bad idea.
Agreed. I think the spec needs changing to allow this use case, personally...

-Boris
Julian Reschke
2008-05-18 20:53:23 UTC
Permalink
Post by Boris Zbarsky
Post by Julian Reschke
Post by Boris Zbarsky
Since the UA has no idea what sort of XML parser is being used on the
server side, I'm not sure it makes sense to bail on attempts to
serialize such documents. In particular, if the document _is_ parsed
with a non-namespace-aware XML parser, there is no problem.
"Serialize data into a namespace well-formed XML document and encoded
using the encoding given by data.inputEncoding, when not null, or
UTF-8 otherwise. Or, if this fails because the Document cannot be
serialized act as if data is null." --
<http://dev.w3.org/2006/webapi/XMLHttpRequest/#send>
So the spec requires silent data loss here, which I think is an
extremely bad idea.
Agreed. I think the spec needs changing to allow this use case, personally...
I think it should say that if the DOM can't be serialized, an exception
needs to be thrown.

Not sure whether it makes sense to allow non-XMLNS-compliant
serializations, though.

BR, Julian
Bjoern Hoehrmann
2008-05-18 23:53:18 UTC
Permalink
Post by Boris Zbarsky
Post by Julian Reschke
"Serialize data into a namespace well-formed XML document and encoded
using the encoding given by data.inputEncoding, when not null, or UTF-8
otherwise. Or, if this fails because the Document cannot be serialized
act as if data is null." --
<http://dev.w3.org/2006/webapi/XMLHttpRequest/#send>
So the spec requires silent data loss here, which I think is an
extremely bad idea.
Agreed. I think the spec needs changing to allow this use case, personally...
Being able to send wf-but-ns-illformed documents would not make much
sense if you couldn't also read them back in, and the odds that some
wf-but-ns-illformed has been created deliberately for use with XHR
as opposed to being created due to some mistake, seem too low to make
supporting this worthwhile.
--
Björn Höhrmann · mailto:***@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/
Boris Zbarsky
2008-05-19 00:18:24 UTC
Permalink
Post by Bjoern Hoehrmann
Being able to send wf-but-ns-illformed documents would not make much
sense if you couldn't also read them back in
Which you can, with a non-NS-aware XML parser.
Post by Bjoern Hoehrmann
and the odds that some
wf-but-ns-illformed has been created deliberately for use with XHR
as opposed to being created due to some mistake, seem too low to make
supporting this worthwhile.
The problem is that figuring out whether a DOM fragment can usefully be
serialized as a ns-wellformed string is a bit of a pain. I have no faith in the
spec being interoperably implemented as written.

-Boris
Bjoern Hoehrmann
2008-05-19 00:28:36 UTC
Permalink
Post by Boris Zbarsky
Post by Bjoern Hoehrmann
Being able to send wf-but-ns-illformed documents would not make much
sense if you couldn't also read them back in
Which you can, with a non-NS-aware XML parser.
My point was that the XHR draft currently requires using a namespace-
aware one, so for both writing and reading, you would have to change
two parts of the draft.
Post by Boris Zbarsky
The problem is that figuring out whether a DOM fragment can usefully
be serialized as a ns-wellformed string is a bit of a pain.
Could you elaborate on this point? You need to serialize the document
before starting to send it, to ensure that changes to it do not affect
what is being sent, to set the Content-Length header, etc., and you
can rather easily check for ns-wf during serialization if you implement
the serialization yourself, so this does not seem like a problem. Even
if you cannot do it during serialization, the algorithm to do it on the
document object is relatively simple aswell.
--
Björn Höhrmann · mailto:***@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/
Boris Zbarsky
2008-05-19 03:07:52 UTC
Permalink
Post by Bjoern Hoehrmann
Post by Boris Zbarsky
Which you can, with a non-NS-aware XML parser.
My point was that the XHR draft currently requires using a namespace-
aware one
On the server side? Can you point me to where it makes that requirement?

I'm not suggesting that the parser XHR uses for data it receives from the server
be changed; I'm suggesting that the server should be able to use whatever XML
parser it wishes.
Post by Bjoern Hoehrmann
Post by Boris Zbarsky
The problem is that figuring out whether a DOM fragment can usefully
be serialized as a ns-wellformed string is a bit of a pain.
Could you elaborate on this point? You need to serialize the document
before starting to send it
Agreed.
Post by Bjoern Hoehrmann
and you can rather easily check for ns-wf during serialization if you implement
the serialization yourself
Perhaps. This is less clear to me. In particular, it's not that clear to me
that its trivial to decide whether a given DOM has a ns-wellformed
serialization. Certainly there have been a number of past bugs in the Gecko
serializer dealing with this aspect of things, and I wouldn't bet my life on
there not being any now.
Post by Bjoern Hoehrmann
Even if you cannot do it during serialization, the algorithm to do it on the
document object is relatively simple aswell.
The concept of "namespace well-formed" applies to strings, not document objects,
last I checked. Though Firefox does prevent creation of attribute nodes with
the prefix "xmlns" in random namespaces, so maybe I'm wrong about that.

In any case, let me give an example, as requested.

var doc = document.implementation.createDocument("", "", null);
var el = doc.createElementNS("ns1", "x:y");
el.setAttributeNS("ns2", "x:z", "val");
doc.appendChild(el);
var xhr = new XMLHttpRequest();
xhr.open("POST", "echo.cgi", false);
xhr.send(doc);
alert(xhr.responseText);

Here echo.cgi is the following CGI:

#!/usr/bin/perl

print "Content-Type: text/plain\n\n";
while (<>) {
print;
}

Here are the results I see:

Firefox 3rc1:

<x:y xmlns:x="ns1" a0:z="val" xmlns:a0="ns2"/>

Opera 9.25:

<?xml version="1.0"?><x:y x:z="val" xmlns:x="ns1"/>

Safari 3.1:

<x:y x:z="val" />

Ignoring the Safari serialization, which is not in fact ns-wellformed no matter
how you slice it, the other two are ns-wellformed XML. Neither one roundtrips
to quite the original document. Which one is "correct" per the current spec?
Or is it neither one? Should an exception have been thrown in this case? Why
or why not? If there shouldn't have been an exception in this case, how is a UA
to determine that?

I'm not saying these are impossible things to define; just that they're far from
obvious (as witness the three serializations above) and therefore perhaps need
definition in this spec if we want interoperability.

-Boris
Simon Pieters
2008-05-19 08:12:22 UTC
Permalink
Post by Boris Zbarsky
Post by Bjoern Hoehrmann
and you can rather easily check for ns-wf during serialization if you implement
the serialization yourself
Perhaps. This is less clear to me. In particular, it's not that clear
to me that its trivial to decide whether a given DOM has a ns-wellformed
serialization. Certainly there have been a number of past bugs in the
Gecko serializer dealing with this aspect of things, and I wouldn't bet
my life on there not being any now.
FWIW, this is defined for getting innerHTML in XML:
http://www.whatwg.org/specs/web-apps/current-work/multipage/section-dynamic.html#innerhtml1

Perhaps XHR should just reference that?
--
Simon Pieters
Opera Software
Boris Zbarsky
2008-05-19 16:09:40 UTC
Permalink
Post by Simon Pieters
http://www.whatwg.org/specs/web-apps/current-work/multipage/section-dynamic.html#innerhtml1
That's more like what I was looking for, yes. I would be happy if XHR adopted
that approach.

-Boris
Anne van Kesteren
2008-05-26 10:51:35 UTC
Permalink
Post by Boris Zbarsky
Post by Simon Pieters
http://www.whatwg.org/specs/web-apps/current-work/multipage/section-dynamic.html#innerhtml1
That's more like what I was looking for, yes. I would be happy if XHR
adopted that approach.
Ok, the data argument of send() is now serialized using data.innerHTML in
case data is a Document object. The encoding and header provisions stay
the same. If data.innerHTML raises an exception that exception is
re-raised by the send() API (INVALID_STATE_ERR is the only one).
--
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>
Bjoern Hoehrmann
2008-05-19 08:23:42 UTC
Permalink
Post by Boris Zbarsky
On the server side?
No, I was simply trying to say XHR should not generate output it cannot
parse itself. Either it generates and parses a document, or it neither
generates nor parses a document. If there was a parameter to set, like
LSParser.domConfig.namespaces, to control this, that would be fine, but
I am not suggesting such an addition.
Post by Boris Zbarsky
var el = doc.createElementNS("ns1", "x:y");
el.setAttributeNS("ns2", "x:z", "val");
<x:y xmlns:x="ns1" a0:z="val" xmlns:a0="ns2"/>
<?xml version="1.0"?><x:y x:z="val" xmlns:x="ns1"/>
<x:y x:z="val" />
Ignoring the Safari serialization, which is not in fact ns-wellformed no matter
how you slice it, the other two are ns-wellformed XML. Neither one roundtrips
to quite the original document. Which one is "correct" per the current spec?
DOM Level 3 Core Appendix B.1 should define how to fix the tree. There
are some imperfections in the other namespace algorithms in the appendix
and it does not say how good the error reporting is, but I believe the
idea is that, either you get an error, or you can serialize the document
without special handling for namespaces. Above Opera's behavior is wrong
since you created an attribute in ns2 but now it's suddenly in ns1. Only
renameNode can cause that.

The behavior of Firefox seems correct to me, except that it does not use
the "ns<index>" pattern to create the new prefix. You picked a document
that cannot exist when building it directly from a plain text document,
so that this does not very strictly speaking roundtrip does not seem an
issue to me.
--
Björn Höhrmann · mailto:***@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/
Boris Zbarsky
2008-05-19 17:44:02 UTC
Permalink
Post by Bjoern Hoehrmann
No, I was simply trying to say XHR should not generate output it cannot
parse itself.
I'm not sure I see why not, to be honest. But I can accept that this might be a
desirable design principle in some circumstances.
Post by Bjoern Hoehrmann
DOM Level 3 Core Appendix B.1 should define how to fix the tree.
Indeed. Might be worth referencing it normatively here.
Post by Bjoern Hoehrmann
You picked a document
that cannot exist when building it directly from a plain text document,
so that this does not very strictly speaking roundtrip does not seem an
issue to me.
Agreed; I was just pointing it out because it can easily cause developer
confusion and non-interoperable results, as demonstrated.

-Boris
Julian Reschke
2008-05-19 07:04:00 UTC
Permalink
Post by Bjoern Hoehrmann
Post by Boris Zbarsky
Post by Bjoern Hoehrmann
Being able to send wf-but-ns-illformed documents would not make much
sense if you couldn't also read them back in
Which you can, with a non-NS-aware XML parser.
My point was that the XHR draft currently requires using a namespace-
aware one, so for both writing and reading, you would have to change
two parts of the draft.
Bot sure. The recipient is a server which does not use XHR for parsing
at all, right?
Post by Bjoern Hoehrmann
Post by Boris Zbarsky
The problem is that figuring out whether a DOM fragment can usefully
be serialized as a ns-wellformed string is a bit of a pain.
Could you elaborate on this point? You need to serialize the document
before starting to send it, to ensure that changes to it do not affect
what is being sent, to set the Content-Length header, etc., and you
can rather easily check for ns-wf during serialization if you implement
the serialization yourself, so this does not seem like a problem. Even
if you cannot do it during serialization, the algorithm to do it on the
document object is relatively simple aswell.
You could implement a streaming serialization, in which case errors like
these would only be catched when the response is already partly written
(and no, you don't need the content length beforehand, you can always
use Transfer-Encoding: chunked).

BR, Julian
Julian Reschke
2008-05-19 07:00:37 UTC
Permalink
Post by Bjoern Hoehrmann
Being able to send wf-but-ns-illformed documents would not make much
sense if you couldn't also read them back in, and the odds that some
wf-but-ns-illformed has been created deliberately for use with XHR
as opposed to being created due to some mistake, seem too low to make
supporting this worthwhile.
I do not disagree with that.

But as you said, it's probably a mistake. There are several ways to
handle this:

1) throw an exception on serialization

2) send the document, and let the recipient detect the problem

3) silent data loss (sending empty body)

In cases 1) and 2), the caller will find out about the problem, in case
3) s/he might not. That is a problem (keep in mind that there are HTTP
resources/method handlers that both support an XML request body and an
empty body, and the difference *does* make a difference).

BR, Julian
Julian Reschke
2008-05-20 11:31:55 UTC
Permalink
Post by Julian Reschke
...
Currently there is no conversion, and what is specified clearly can
cause implementations to create broken requests, where the code worked
before.
...
...even without looking for it, I came across this one:
<https://jersey.dev.java.net/servlets/ReadMsg?list=users&msgNo=1346>. So
please don't claim that this isn't a problem.

BR, Julian
Sunava Dutta
2008-05-19 19:13:18 UTC
Permalink
Inline...
Post by Sunava Dutta
-----Original Message-----
Sent: Saturday, May 17, 2008 5:45 AM
To: Julian Reschke
Cc: Maciej Stachowiak; Sunava Dutta; Web API WG (public)
Subject: Re: XHR LC comments
Post by Julian Reschke
On Sat, 17 May 2008 11:56:45 +0200, Julian Reschke
Post by Julian Reschke
But what IMHO happens all over again is that strange choices in the
design are defended with the statement "this is what the vendors do,
or want to do", and when we check it, that turns out to be incorrect.
Could you point out one such example? I've actually tested a fair amount
They are in the current threads.
- "add" semantics for setRequestHeader
- semantics for setRequestHeader(...,null)
- silent data loss for send() when DOM can't be serialized
- ...
I think only for the last one I have suggested that I rather not change it
based on that this seems like a safer choice. I have not seen any tests
that show that implementations actually throw in that case.
Post by Julian Reschke
of stuff, including headers, methods, etc. I agree that some of the
details of headers need to be worked out. For null/""/undefined I've
been waiting for the Web IDL specification. For which headers can be
set by the user agent I don't really have an answer and that part has
not been defined as such. That setRequestHeader() always appends was a
conscious choice to be in line with Internet Explorer. Initially the
design was so that it special cased a bunch of headers that did not
allow duplication which would have been more in line with Firefox, but
given that it is not a fixed list and the Internet Explorer route
seemed more appropriate.
Well, not to me. And apparently not to FF, as FF3 seems to ship with be
non-compliant behavior.
To my best knowledge Mozilla hasn't started implementing the specification
yet. I've seen several comments in their public bug database to the effect
that they rather wait until it reaches CR.
Post by Julian Reschke
setRequestHeader() currently simply is broken. We should deprecate it,
- removeHeader(...) (or specify set with null to mean remove)
- addHeader...
- getHeader...
"Deprecating" a method does not help implementations converge. Besides,
for typical usage there's no issue in using this header at all.
[Sunava Dutta] I agree with Anne here. Deprecating an existing implementations and re-engineering XHR is something we just cannot accept. This spec should be designed to reflect reality and seek interoperability for each and every single section/method/event with at least one (I think the W3C mandates two?) existing implementations. That does not mean the entire spec is aligned with FF or IE, but it should be harmonious at any instance with one existing implementation.
Post by Sunava Dutta
--
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.oper
Julian Reschke
2008-05-19 19:50:32 UTC
Permalink
Post by Sunava Dutta
Inline...
Post by Anne van Kesteren
Post by Julian Reschke
- "add" semantics for setRequestHeader
- semantics for setRequestHeader(...,null)
- silent data loss for send() when DOM can't be serialized
- ...
I think only for the last one I have suggested that I rather not change it
based on that this seems like a safer choice. I have not seen any tests
that show that implementations actually throw in that case.
Which reminds me...

To Anne: ...speaking of which, I just showed that two days ago. As a
matter of fact, neither IE7 nor FF3 do what the spec say, they either
throw or send the non-wellformed document.
Post by Sunava Dutta
Post by Anne van Kesteren
Post by Julian Reschke
setRequestHeader() currently simply is broken. We should deprecate it,
- removeHeader(...) (or specify set with null to mean remove)
- addHeader...
- getHeader...
"Deprecating" a method does not help implementations converge. Besides,
for typical usage there's no issue in using this header at all.
[Sunava Dutta] I agree with Anne here. Deprecating an existing implementations and re-engineering XHR is something we just cannot accept. This spec should be designed to reflect reality and seek interoperability for each and every single section/method/event with at least one (I think the W3C mandates two?) existing implementations. That does not mean the entire spec is aligned with FF or IE, but it should be harmonious at any instance with one existing implementation.
The existing API sucks big time. It is not consistently implemented
anyway, and the way it is specified right now easily causes invalid HTTP
messages to be sent (for instance, including broken Content-Type headers).

Deprecate it, and come up with something that is good.

<sarcasm>I you're looking for an SDO to rubber stamp a bad thing, go to
ECMA or ISO :-)</sarcasm>

BR, Julian
Jonas Sicking
2008-05-19 22:14:26 UTC
Permalink
Post by Sunava Dutta
Post by Anne van Kesteren
Post by Julian Reschke
setRequestHeader() currently simply is broken. We should deprecate it,
- removeHeader(...) (or specify set with null to mean remove)
- addHeader...
- getHeader...
"Deprecating" a method does not help implementations converge. Besides,
for typical usage there's no issue in using this header at all.
[Sunava Dutta] I agree with Anne here. Deprecating an existing
implementations and re-engineering XHR is something we just cannot
accept. This spec should be designed to reflect reality and seek
interoperability for each and every single section/method/event with
at least one (I think the W3C mandates two?) existing implementations.
That does not mean the entire spec is aligned with FF or IE, but it
should be harmonious at any instance with one existing implementation.
There is absolutely no W3C mandate that a spec is compatible with any
existing implementations in order to reach the earlier milestones in the
standardization track. Not sure where you got that idea. It would be
very strange if there was a requirement to have implementations in order
to reach LC, when W3C is discouraging implementations at that stage.

Also, I personally don't care at all which UAs the various features of
spec is compatible with. Or if it's not compatible with any UA. What I
care about is that the spec is compatible with the web, and in the cases
where the web doesn't care, that it's as useful and simple as possible.

/ Jonas
Sunava Dutta
2008-05-19 22:21:46 UTC
Permalink
Inline...
Post by Sunava Dutta
-----Original Message-----
Sent: Monday, May 19, 2008 3:14 PM
To: Sunava Dutta
Cc: Anne van Kesteren; Julian Reschke; Maciej Stachowiak; Web API WG
(public); IE8 Core AJAX SWAT Team
Subject: Re: XHR LC comments
Post by Sunava Dutta
Post by Anne van Kesteren
Post by Julian Reschke
setRequestHeader() currently simply is broken. We should deprecate it,
- removeHeader(...) (or specify set with null to mean remove)
- addHeader...
- getHeader...
"Deprecating" a method does not help implementations converge. Besides,
for typical usage there's no issue in using this header at all.
[Sunava Dutta] I agree with Anne here. Deprecating an existing
implementations and re-engineering XHR is something we just cannot
accept. This spec should be designed to reflect reality and seek
interoperability for each and every single section/method/event with
at least one (I think the W3C mandates two?) existing implementations.
That does not mean the entire spec is aligned with FF or IE, but it
should be harmonious at any instance with one existing implementation.
There is absolutely no W3C mandate that a spec is compatible with any
existing implementations in order to reach the earlier milestones in the
standardization track. Not sure where you got that idea. It would be
very strange if there was a requirement to have implementations in order
to reach LC, when W3C is discouraging implementations at that stage.
Also, I personally don't care at all which UAs the various features of
spec is compatible with. Or if it's not compatible with any UA. What I
care about is that the spec is compatible with the web, and in the cases
where the web doesn't care, that it's as useful and simple as possible.
/ Jonas
[Sunava Dutta] Compatible with the web sounds very nice and is something I think I share with you. I think you mean compatible with browsers who enable the technologies when you mean compatible with the web?
Getting back to more specifics, if we're talking about compatibility I absolutely believe the spec should be relevant to existing implementations. I'm amenable to what Maciej said when he mentioned that in the case (I'm assuming this is a rarity) where the implementations are doing whacky things or doing nothing at all, it makes sense to work together to identify a way/solution that will allow for convergence.
Thanks for pointing out there is no mandate or guidelines for having two implementations in CR. I misunderstood something Chris had m
Boris Zbarsky
2008-05-19 22:30:34 UTC
Permalink
Post by Sunava Dutta
I think you mean compatible with browsers who enable
the technologies when you mean compatible with the web?
"Compatible with the web" means that when a UA implements the specification as
written it will encounter either no reports of pages broken due to that
implementation or a very very small number of them.

One possible way to do that is to implement exactly what the market leader
implements, although even that is no guarantee if sites work around some
behavior of the market leader based on UA sniffing.

In reality, what's needed here is that all "commonly used" functionality (and
yes, this is an imprecise term; so is "compatible with the web" in the end) is
specified the way websites expect it to work. Whether they expect it because of
some other implementation, because of a popular book, because of documentation
somewhere, or for some other reason is not relevant. What's relevant is what
they expect when they write their code.
Post by Sunava Dutta
I'm amenable to what Maciej
said when he mentioned that in the case (I'm assuming this is a rarity) where
the implementations are doing whacky things or doing nothing at all, it makes
sense to work together to identify a way/solution that will allow for
convergence.
Right. Any time implementations disagree, the most likely conclusion is that
the point on which they don't agree is not used much, if at all, by websites.
Therefore the exact behavior the spec requires on that point doesn't affect the
"compatible with the web" criterion.

-Boris
Julian Reschke
2008-05-20 06:12:57 UTC
Permalink
Post by Boris Zbarsky
...
Right. Any time implementations disagree, the most likely conclusion is
that the point on which they don't agree is not used much, if at all, by
websites. Therefore the exact behavior the spec requires on that point
doesn't affect the "compatible with the web" criterion.
...
Agreed. In which case it makes sense to either leave the specifics
undefined, or to standardize the behavior that makes the most sense.

BR, Julian
Maciej Stachowiak
2008-05-19 22:49:08 UTC
Permalink
Post by Sunava Dutta
[Sunava Dutta] Compatible with the web sounds very nice and is
something I think I share with you. I think you mean compatible with
browsers who enable the technologies when you mean compatible with
the web?
Jonas means that it should enable existing Web content to continue to
work as expected, to the extent possible. So if browsers have a
specific behavior but we have strong reason to believe Web content
does not rely on it (for example if every browser does something
wildly different and we can't find any specific examples of reliance),
then that behavior is likely not relevant to Web compatibility.
Post by Sunava Dutta
Getting back to more specifics, if we're talking about compatibility
I absolutely believe the spec should be relevant to existing
implementations. I'm amenable to what Maciej said when he mentioned
that in the case (I'm assuming this is a rarity) where the
implementations are doing whacky things or doing nothing at all, it
makes sense to work together to identify a way/solution that will
allow for convergence.
It's not a rarity. The state of XHR interoperability is fairly poor
for edge cases.

Regards,
Maciej
Jonas Sicking
2008-05-19 22:52:36 UTC
Permalink
Post by Sunava Dutta
Inline...
Post by Sunava Dutta
-----Original Message-----
Sent: Monday, May 19, 2008 3:14 PM
To: Sunava Dutta
Cc: Anne van Kesteren; Julian Reschke; Maciej Stachowiak; Web API WG
(public); IE8 Core AJAX SWAT Team
Subject: Re: XHR LC comments
Post by Sunava Dutta
Post by Anne van Kesteren
Post by Julian Reschke
setRequestHeader() currently simply is broken. We should deprecate it,
- removeHeader(...) (or specify set with null to mean remove)
- addHeader...
- getHeader...
"Deprecating" a method does not help implementations converge. Besides,
for typical usage there's no issue in using this header at all.
[Sunava Dutta] I agree with Anne here. Deprecating an existing
implementations and re-engineering XHR is something we just cannot
accept. This spec should be designed to reflect reality and seek
interoperability for each and every single section/method/event with
at least one (I think the W3C mandates two?) existing implementations.
That does not mean the entire spec is aligned with FF or IE, but it
should be harmonious at any instance with one existing implementation.
There is absolutely no W3C mandate that a spec is compatible with any
existing implementations in order to reach the earlier milestones in the
standardization track. Not sure where you got that idea. It would be
very strange if there was a requirement to have implementations in order
to reach LC, when W3C is discouraging implementations at that stage.
Also, I personally don't care at all which UAs the various features of
spec is compatible with. Or if it's not compatible with any UA. What I
care about is that the spec is compatible with the web, and in the cases
where the web doesn't care, that it's as useful and simple as possible.
/ Jonas
[Sunava Dutta] Compatible with the web sounds very nice and is
something I think I share with you. I think you mean compatible with
browsers who enable the technologies when you mean compatible with the
web?
No, I mean "able to run the javascript that exists on pages on the web".
So for example if there is an aspect to a feature that no, or very few,
web pages use, then I don't think we need to pay attention to what UAs
do today and instead make the best possible spec based on technical
considerations.

Figuring out what aspects webpages do or don't use is hard of course.
But often there are indications as well as implementation experience.
Post by Sunava Dutta
Getting back to more specifics, if we're talking about compatibility I
absolutely believe the spec should be relevant to existing
implementations.
What do you mean by "relevant to existing implementations". And why do
you think that?
Post by Sunava Dutta
I'm amenable to what Maciej said when he mentioned
that in the case (I'm assuming this is a rarity) where the
implementations are doing whacky things or doing nothing at all, it
makes sense to work together to identify a way/solution that will
allow for convergence.
It is in fact quite common when you start looking at the details of the
various features that implementations behave very differently. So in
those details we should in my opinion use the strategy I described above.

/ Jonas
Sunava Dutta
2008-05-19 23:03:49 UTC
Permalink
Inline...
Post by Sunava Dutta
-----Original Message-----
Sent: Monday, May 19, 2008 3:53 PM
To: Sunava Dutta
Cc: Anne van Kesteren; Julian Reschke; Maciej Stachowiak; Web API WG
(public); IE8 Core AJAX SWAT Team
Subject: Re: XHR LC comments
Post by Sunava Dutta
Inline...
Post by Sunava Dutta
-----Original Message-----
Sent: Monday, May 19, 2008 3:14 PM
To: Sunava Dutta
Cc: Anne van Kesteren; Julian Reschke; Maciej Stachowiak; Web API WG
(public); IE8 Core AJAX SWAT Team
Subject: Re: XHR LC comments
Post by Sunava Dutta
Post by Anne van Kesteren
Post by Julian Reschke
setRequestHeader() currently simply is broken. We should deprecate
it,
Post by Sunava Dutta
Post by Sunava Dutta
Post by Sunava Dutta
Post by Anne van Kesteren
Post by Julian Reschke
- removeHeader(...) (or specify set with null to mean remove)
- addHeader...
- getHeader...
"Deprecating" a method does not help implementations converge.
Besides,
Post by Sunava Dutta
Post by Sunava Dutta
Post by Sunava Dutta
Post by Anne van Kesteren
for typical usage there's no issue in using this header at all.
[Sunava Dutta] I agree with Anne here. Deprecating an existing
implementations and re-engineering XHR is something we just cannot
accept. This spec should be designed to reflect reality and seek
interoperability for each and every single section/method/event with
at least one (I think the W3C mandates two?) existing implementations.
That does not mean the entire spec is aligned with FF or IE, but it
should be harmonious at any instance with one existing implementation.
There is absolutely no W3C mandate that a spec is compatible with any
existing implementations in order to reach the earlier milestones in
the
Post by Sunava Dutta
Post by Sunava Dutta
standardization track. Not sure where you got that idea. It would be
very strange if there was a requirement to have implementations in
order
Post by Sunava Dutta
Post by Sunava Dutta
to reach LC, when W3C is discouraging implementations at that stage.
Also, I personally don't care at all which UAs the various features of
spec is compatible with. Or if it's not compatible with any UA. What I
care about is that the spec is compatible with the web, and in the
cases
Post by Sunava Dutta
Post by Sunava Dutta
where the web doesn't care, that it's as useful and simple as possible.
/ Jonas
[Sunava Dutta] Compatible with the web sounds very nice and is
something I think I share with you. I think you mean compatible with
browsers who enable the technologies when you mean compatible with the
web?
No, I mean "able to run the javascript that exists on pages on the web".
So for example if there is an aspect to a feature that no, or very few,
web pages use, then I don't think we need to pay attention to what UAs
do today and instead make the best possible spec based on technical
considerations.
[Sunava Dutta] Thanks for explaining. Yes, if features exist in XHR that web content does not rely on, we should absolutely drive to UA alignment with the reality.
Post by Sunava Dutta
Figuring out what aspects webpages do or don't use is hard of course.
But often there are indications as well as implementation experience.
Post by Sunava Dutta
Getting back to more specifics, if we're talking about compatibility I
absolutely believe the spec should be relevant to existing
implementations.
What do you mean by "relevant to existing implementations". And why do
you think that?
[Sunava Dutta] Existing implementations means the web sites. I see the confusion, since I use the term implementation later on to mean browsers.
Post by Sunava Dutta
Post by Sunava Dutta
I'm amenable to what Maciej said when he mentioned
that in the case (I'm assuming this is a rarity) where the
implementations are doing whacky things or doing nothing at all, it
makes sense to work together to identify a way/solution that will
allow for convergence.
It is in fact quite common when you start looking at the details of the
various features that implementations behave very differently. So in
those details we should in my opinion use the strategy I described above.
/ Jonas
Sunava Dutta
2008-05-19 23:34:37 UTC
Permalink
Inline...
Post by Sunava Dutta
-----Original Message-----
Sent: Saturday, May 17, 2008 2:04 AM
To: Julian Reschke
Cc: Sunava Dutta; Anne van Kesteren; Web API WG (public)
Subject: Re: XHR LC comments
Post by Julian Reschke
Post by Sunava Dutta
...
Post by Julian Reschke
At this point, I'm not sure why we're bothering with XHR1 at all. It is
*not* what the current implementations do anyway.
[Sunava Dutta] I'm sorry, this statement is concerning and I'd like
to understand it better. We haven't had a chance to run the latest
test suite yet but expect the test suite to be compliant with at
least two existing implementations. Do you mean the XHR 1 draft is
not interoperable with existing implementations?
...
Absolutely. Everytime I check something that is of interest to me it
turns out that there is no interop, and that only some or even none
of the browsers works as specified.
We decided long ago (and subsequently reaffirmed) that instead of
leaving the spec so vague that all existing implementations are
automatically compliant, we would define a shared interoperable
behavior so that implementations can converge. It should not be news
to anyone that implementations are not automatically 100% compliant.
Post by Julian Reschke
- Support for HTTP extension methods: IE violates the SHOULD level
requirement to support extenstion methods. Opera silently (!!!)
changes extension method names to "POST".
- setRequestHeader: none of the browsers throws an exception when
setting the header to null. Some do something useful (removing the
header), some treat it like an empty string, some seem to set the
valoue to the string "null".
I'm also concerned that the spec proposes behaviour that leads to
silent data loss, although it's totally unclear why this is needed
for interoperability (such as when a DOM to be serialized has no XML
representation).
It seems that what's needed here is more work on the test suite. LC
is way too early.
By W3C Process, the test suite is supposed to be developed during the
CR period. So by having one at all before LC, we are ahead of schedule.
[Sunava Dutta] Can I have a link to this? I can't find it. Thanks!
Btw, we discussed the possibility of having the test suite ready before CR (see below). I think that's wise given that you mentioned that there are many cases where interoperability has not been reached? (or a convergence plan is not in place?) Our XHR test is going to be running the test suite in LC to see where interop doesn't exist and weigh in with our thoughts where we can to help.
http://lists.w3.org/Archives/Public/public-webapi/2008Feb/0019.html
Post by Sunava Dutta
2) In fact, on that note, we're interested to see the test suite be
linked, normatively if necessary.
Charles said
"Yes. I think this is a valuable piece of feedback. Currently W3C process
doesn't require test suites until you're trying to get out of CR and I
think it would be better to have them earlier. I would
like the group to start checking the test cases we have against the spec
and formally agreeing them to facilitate this linkage during last call. It
slows down the LC period, but it should make CR easier and reduce the
possibility of reverting from CR."

)
Post by Sunava Dutta
Regards,
Maciej
Anne van Kesteren
2008-05-26 12:30:56 UTC
Permalink
On Fri, 16 May 2008 13:14:12 +0200, Julian Reschke <***@gmx.d=
e> =
At this point, I'm not sure why we're bothering with XHR1 at all. It i=
s =
*not* what the current implementations do anyway.
It's setting a baseline for implementations. As with most legacy feature=
s =

without a specification, implementations differ a lot in the details. =

Typical usage of the API more or less works the same anywhere, but if we=
=

only defined that we might as well publish an empty specification and =

reference some brief description of XMLHttpRequest somewhere on the Web.=
Post by Anne van Kesteren
Well, if we're talking about URIs (and I think we do), then we need =
to
Post by Anne van Kesteren
refer to RFC3986 grammar and comparison rules.
Ok, referenced RFC3986 as well.
That's not sufficient, and not what I asked for. Please make up your =
mind whether it's a URI or a IRI, and then cite accordingly.
I deferred this issue to HTML5 for now by referencing the recently =

introduced definition of "same origin" there. That makes more sense =

because if any changes to that definition are made there it would also =

affect XMLHttpRequest.
Post by Anne van Kesteren
When they are a string, then taking about character encoding doesn't=
make any sense here.
Actually, since you need to encode them for the request it does.
But that totally depends on the authentication scheme. I think you're =
=
confusing layers here.
It does depend on that and that is mentioned.
Post by Anne van Kesteren
Thinking of it, could you please add a clarification that setting to=
an
Post by Anne van Kesteren
empty string is legal, and MUST NOT be ignored? I recall that
Microsoft's original XHR (ActiveX) implementation got that wrong, no=
t
Post by Anne van Kesteren
setting the header at all.
I added a note to that effect as it is already normatively required.=
"Note: The empty string is legal."
Maybe you could add "and represent an empty header value"?
Done.
Post by Anne van Kesteren
Post by Anne van Kesteren
"If no Content-Type header has been set using =
setRequestHeader()append a Content-Type header to the list of =
request headers with avalue of application/xml;charset=3Dcharset =
=
Post by Anne van Kesteren
Post by Anne van Kesteren
where charset is theencoding used to encode the document."
This will result in an invalid Content-Type header if the UA =
hasinitialized the headers with a default (which I think the =
speccurrently allows; and at least one UA was reported to do). See=
=
Post by Anne van Kesteren
Post by Anne van Kesteren
commentabove about header handling.
Rephrased.
Pointer?
http://dev.w3.org/2006/webapi/XMLHttpRequest/#send
So is it legal for implementations to populate certain headers upon =
object creation?
Since you raised this comment on various threads I'll address it in one =
of =

the other ones.
How is this relevant for demonstrating the output format for =
getAllResponseHeaders()?
It's relevant in case people copy the example, which I expect to happen.=
=

In case they do that and the example would've used synchronous code they=
=

end up with UI-lockup et cetera, which would be bad.


-- =

Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>
Julian Reschke
2008-05-26 12:49:52 UTC
Permalink
Post by Anne van Kesteren
On Fri, 16 May 2008 13:14:12 +0200, Julian Reschke
Post by Julian Reschke
At this point, I'm not sure why we're bothering with XHR1 at all. It
is *not* what the current implementations do anyway.
It's setting a baseline for implementations. As with most legacy
features without a specification, implementations differ a lot in the
details. Typical usage of the API more or less works the same anywhere,
but if we only defined that we might as well publish an empty
specification and reference some brief description of XMLHttpRequest
somewhere on the Web.
That's understood. But what confuses me is the relation to XHR2 -- it
seems that this WG is splitting time for work on two specs, where just
working on XHR2 would be more useful.
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
Post by Julian Reschke
Well, if we're talking about URIs (and I think we do), then we need to
refer to RFC3986 grammar and comparison rules.
Ok, referenced RFC3986 as well.
That's not sufficient, and not what I asked for. Please make up your
mind whether it's a URI or a IRI, and then cite accordingly.
I deferred this issue to HTML5 for now by referencing the recently
introduced definition of "same origin" there. That makes more sense
because if any changes to that definition are made there it would also
affect XMLHttpRequest.
Pointer, please?
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
Post by Julian Reschke
When they are a string, then taking about character encoding doesn't
make any sense here.
Actually, since you need to encode them for the request it does.
But that totally depends on the authentication scheme. I think you're
confusing layers here.
It does depend on that and that is mentioned.
Are you referring to: "14. If the user argument was not omitted and is
not null let stored user be user encoded using the encoding specified
in the relevant authentication scheme or UTF-8 if the scheme fails to
specify an encoding."?

This has two problems:

- it makes "stored used" an octet sequence, not a string.

- it simply doesn't work in practice, for instance for Basic Authentication
Post by Anne van Kesteren
Post by Julian Reschke
How is this relevant for demonstrating the output format for
getAllResponseHeaders()?
It's relevant in case people copy the example, which I expect to happen.
In case they do that and the example would've used synchronous code they
end up with UI-lockup et cetera, which would be bad.
Well, we continue to disagree on this point.

The goal for examples should be to illustrate a specific feature, not to
promote a specific coding practice (at least not when doing the latter
affects the readability).

BR, Julian
Anne van Kesteren
2008-05-27 12:07:37 UTC
Permalink
Post by Julian Reschke
That's understood. But what confuses me is the relation to XHR2 -- it
seems that this WG is splitting time for work on two specs, where just
working on XHR2 would be more useful.
It's not exactly splitting time as all the issues raised for 1 affect 2.
Maybe it will turn out that 1 is not needed anymore at some point, but for
now it seems useful to have.
Post by Julian Reschke
Post by Anne van Kesteren
I deferred this issue to HTML5 for now by referencing the recently
introduced definition of "same origin" there. That makes more sense
because if any changes to that definition are made there it would also
affect XMLHttpRequest.
Pointer, please?
http://www.whatwg.org/specs/web-apps/current-work/#same-origin
Post by Julian Reschke
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
Post by Julian Reschke
When they are a string, then taking about character encoding doesn't
make any sense here.
Actually, since you need to encode them for the request it does.
But that totally depends on the authentication scheme. I think you're
confusing layers here.
It does depend on that and that is mentioned.
Are you referring to: "14. If the user argument was not omitted and is
not null let stored user be user encoded using the encoding specified
in the relevant authentication scheme or UTF-8 if the scheme fails to
specify an encoding."?
- it makes "stored used" an octet sequence, not a string.
What is the problem?
Post by Julian Reschke
- it simply doesn't work in practice, for instance for Basic
Authentication
You're not really helping finding the right solution here. This was added
for basic authentication if I remember correctly as it does not specify
any encoding.
Post by Julian Reschke
Post by Anne van Kesteren
Post by Julian Reschke
How is this relevant for demonstrating the output format for
getAllResponseHeaders()?
It's relevant in case people copy the example, which I expect to
happen. In case they do that and the example would've used synchronous
code they end up with UI-lockup et cetera, which would be bad.
Well, we continue to disagree on this point.
The goal for examples should be to illustrate a specific feature, not to
promote a specific coding practice (at least not when doing the latter
affects the readability).
I don't think it affects readability that much.
--
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>
Julian Reschke
2008-05-27 12:29:16 UTC
Permalink
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
I deferred this issue to HTML5 for now by referencing the recently
introduced definition of "same origin" there. That makes more sense
because if any changes to that definition are made there it would
also affect XMLHttpRequest.
Pointer, please?
http://www.whatwg.org/specs/web-apps/current-work/#same-origin
No, I was looking for a pointer to what actually changed (which wasn't
in CVS when I wrote the mail).

You're still avoiding the question whether the URL parameter can be an
IRI. I would assume it can't, in which case the spec should require it
to conform to RFC3986.

If it's known to be a URI, do we really need to refer to HTML5 for
same-origin detection?
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
Post by Julian Reschke
Post by Anne van Kesteren
Post by Julian Reschke
When they are a string, then taking about character encoding doesn't
make any sense here.
Actually, since you need to encode them for the request it does.
But that totally depends on the authentication scheme. I think
you're confusing layers here.
It does depend on that and that is mentioned.
Are you referring to: "14. If the user argument was not omitted and is
not null let stored user be user encoded using the encoding specified
in the relevant authentication scheme or UTF-8 if the scheme fails to
specify an encoding."?
- it makes "stored used" an octet sequence, not a string.
What is the problem?
Well, octet sequences usually are not stored in strings but in byte arrays.

I think what the spec currently says is confusing, and likely to cause
damage in practice.
Post by Anne van Kesteren
Post by Julian Reschke
- it simply doesn't work in practice, for instance for Basic
Authentication
You're not really helping finding the right solution here. This was
added for basic authentication if I remember correctly as it does not
specify any encoding.
Sometimes there is no simple solution.

Basic Authentication is not defined in terms of UTF-8, and, as far as I
know, is not using it in practice, so suggesting that in XHR is a bug.
Post by Anne van Kesteren
Post by Julian Reschke
The goal for examples should be to illustrate a specific feature, not
to promote a specific coding practice (at least not when doing the
latter affects the readability).
I don't think it affects readability that much.
It probably doesn't affect you (because you prefer that notation
anyway), but minimally it affects me. And if it affects me, it's likely
to affect others as well.

BR, Julian

Loading...