Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Status codes an non-HTTP protocols

68 views
Skip to first unread message

Philip Withnall

unread,
Mar 25, 2006, 7:00:17 AM3/25/06
to
I was wondering what the official response was to bug #331610
(https://bugzilla.mozilla.org/show_bug.cgi?id=331610): a guy's tried
using XMLHttpRequest with a non-HTTP protocol (in this case, "file://"),
and has found that the status codes are different to HTTP. Is this
intentional, or a bug?

Regards,
Philip Withnall (bug triager)

Martin Honnen

unread,
Mar 25, 2006, 7:53:39 AM3/25/06
to
Philip Withnall wrote:

> I was wondering what the official response was to bug #331610
> (https://bugzilla.mozilla.org/show_bug.cgi?id=331610): a guy's tried
> using XMLHttpRequest with a non-HTTP protocol (in this case, "file://"),
> and has found that the status codes are different to HTTP. Is this
> intentional, or a bug?

Mozilla's implementation of XMLHttpRequest follows the implementation
that Microsoft has done in MSXML for IXMLHttpRequest and that, for file:
URLs, returns the status as 0. If you see that then I think it is
intentional.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Philip Withnall

unread,
Mar 27, 2006, 1:10:28 PM3/27/06
to
Apparently (I haven't tested it; I'm just going on what the bug reporter
has just written) IE returns a status 200 for successfully loaded local
files. I think there would be a case for returning HTTP status codes for
any file loaded with XMLHttpRequest:
- It is XML*Http*Request (so the use of HTTP standards would follow in
the interface)
- It would stop JS coders having to put all sorts of code in to detect
the protocol used and translate the resulting status code
Then again, it could be argued the other way, with strict separation
between different protocols being a good idea.

Martin Honnen

unread,
Mar 28, 2006, 8:34:48 AM3/28/06
to
Philip Withnall wrote:

> Apparently (I haven't tested it; I'm just going on what the bug reporter
> has just written) IE returns a status 200 for successfully loaded local
> files.

No, IE (at least IE 5, 5.5, 6) uses MSXML as an ActiveXObject and that
returns status as the number 0 for successful file: URL requests with
MSXML 2.6, 3, 4, 5, 6 in my tests here.
Opera 8 and Opera 9 preview also return 0 as the status code for file:
URL access.

I think there would be a case for returning HTTP status codes for
> any file loaded with XMLHttpRequest:
> - It is XML*Http*Request (so the use of HTTP standards would follow in
> the interface)

If the name part is to be used as an argument then you could as well
argue that file: URL access has to be removed completely as file: URL
access does not use the HTTP protocol.

Philip Withnall

unread,
Mar 28, 2006, 11:01:35 AM3/28/06
to
Martin Honnen wrote:
> If the name part is to be used as an argument then you could as well
> argue that file: URL access has to be removed completely as file: URL
> access does not use the HTTP protocol.

As I said, you could argue it both ways, but I've since been shown that
the name argument was not a particularly good route to go down.
Regardless, the bug's been resolved as invalid (again).

0 new messages