Closed Bug 307769 Opened 19 years ago Closed 19 years ago

document the fact that XMLHttpRequest::Send doesn't support streams with headers

Categories

(Core :: XML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: Biesinger, Assigned: darin.moz)

References

()

Details

(Keywords: fixed1.8, regression)

Attachments

(1 file, 1 obsolete file)

XMLHttpRequest always passes a content type to SetUploadStream, which means that
any possibly existing headers in the input stream will be sent as data.

In 1.7.x, that was different:
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp&rev=MOZILLA_1_7_BRANCH&cvsroot=/cvsroot&mark=1487#1483

We should maybe still allow streams with headers.
Keywords: regression
OS: Linux → All
Hardware: PC → All
Either that or fix the documentation accordingly...

In any case, we need to do one or the other for 1.8, imo.

Darin, bsmedberg, thoughts?
Flags: blocking1.8b5?
How does this affect web authors?
It doesn't, but it affects extension authors or any other UniversalXPConnect
code that's using XMLHttpRequest.
When we fix this, we should make sure not to cause bug 308484 on the 1.8 branch.
Depends on: 308484
Why should we fix this?  Do we know of many extensions that try to set headers
at the top of their data stream?  If possible, we should drop support for
headers in the data stream.  It is a messy way of specifying headers.

It looks like the change was introduced by the patch for bug 246651.
at least nsIXMLHttpRequest.idl needs to be fixed, which says the headers need to
be specified in the stream.
Attached patch v1 patch: fix comments (obsolete) — Splinter Review
Attachment #196262 - Flags: superreview?(jst)
Attachment #196262 - Flags: review?(cbiesinger)
I'd be fine with us changing the IDL appropriately, sure.  As long as our IDL
and impl are consistent and we have _a_ way to set headers, I'm happy not to do
it in the stream (which I agree is a messy way).
Comment on attachment 196262 [details] [diff] [review]
v1 patch: fix comments

+   *		  compatible with nsIUploadChannel.setUploadStream, and a

I think it should be made clearer that this function expects no headers in the
stream - nsIUploadChannel.setUploadStream can behave either way.

should it be mentioned that a content-type for the uploaded data can be set
using setRequestHeader, or is that obvious?
Comment on attachment 196262 [details] [diff] [review]
v1 patch: fix comments

sr=jst
Attachment #196262 - Flags: superreview?(jst) → superreview+
Flags: blocking1.8b5? → blocking1.8b5+
> I think it should be made clearer that this function expects no headers in the
> stream - nsIUploadChannel.setUploadStream can behave either way.
> 
> should it be mentioned that a content-type for the uploaded data can be set
> using setRequestHeader, or is that obvious?

good points.  i'll extend the comments to mention those.
Comment on attachment 196262 [details] [diff] [review]
v1 patch: fix comments

r=biesi with those comment changes.
Attachment #196262 - Flags: review?(cbiesinger) → review+
Attached patch v1.1 patchSplinter Review
OK, here's the version that I checked in.  I would like to land this on the 1.8
branch for consistency.
Assignee: xml → darin
Attachment #196262 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #196381 - Flags: approval1.8b5?
marking FIXED
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Summary: XMLHttpRequest::Send doesn't support streams with headers → document the fact that XMLHttpRequest::Send doesn't support streams with headers
Could we add a quick blurb about this change linked off
http://developer.mozilla.org/docs/Adapting_XUL_Applications_for_Firefox_1.5 ?
Comment on attachment 196381 [details] [diff] [review]
v1.1 patch

Can you write a blurb for an update to devmo and send to cbeard/deb?
Attachment #196381 - Flags: approval1.8b5? → approval1.8b5+
fixed1.8
Keywords: fixed1.8
(In reply to comment #15)
> Could we add a quick blurb about this change linked off
> http://developer.mozilla.org/docs/Adapting_XUL_Applications_for_Firefox_1.5 ?

Done
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: