Closed
Bug 362043
Opened 18 years ago
Closed 18 years ago
XMLHttpRequest should set a charset in the Content-Type request header
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla1.9alpha5
People
(Reporter: sayrer, Assigned: sciguyryan)
References
Details
Attachments
(1 file, 1 obsolete file)
2.43 KB,
patch
|
peterv
:
review+
peterv
:
superreview+
|
Details | Diff | Splinter Review |
since this can be something other than XML. In the XML case, it would still be nice to know without sniffing the XML itself.
Don't we just put whatever the server gave us in there?
Comment 2•18 years ago
|
||
This bug is about the _request_ header we send when doing a POST via XMLHttpRequest. That is, we're sending the server some data, but we're not telling it how we encoded it.
OS: Mac OS X 10.3 → All
Hardware: PC → All
Assignee | ||
Comment 3•18 years ago
|
||
Possible patch v1
Assignee: general → sciguyryan
Status: NEW → ASSIGNED
Attachment #260524 -
Flags: superreview?(peterv)
Attachment #260524 -
Flags: review?(peterv)
Comment 4•18 years ago
|
||
I think in the XML case you just want the document to describe itself, actually. Why would you want to provide the encoding?
Reporter | ||
Comment 5•18 years ago
|
||
(In reply to comment #4)
> I think in the XML case you just want the document to describe itself,
> actually. Why would you want to provide the encoding?
>
Requests have different requirements than responses. Request metadata turns out to be much more useful to the recipient, because it is practical for servers to enforce application-specific coherence requirements.
Assignee | ||
Comment 6•18 years ago
|
||
I should have defaulted |charset| too UTF-8 if there are problems so we don't end up with |;charset=| appended.
Attachment #260524 -
Attachment is obsolete: true
Attachment #260588 -
Flags: superreview?(peterv)
Attachment #260588 -
Flags: review?(peterv)
Attachment #260524 -
Flags: superreview?(peterv)
Attachment #260524 -
Flags: review?(peterv)
Updated•18 years ago
|
Attachment #260588 -
Flags: superreview?(peterv)
Attachment #260588 -
Flags: superreview+
Attachment #260588 -
Flags: review?(peterv)
Attachment #260588 -
Flags: review+
Assignee | ||
Updated•18 years ago
|
Flags: in-testsuite?
Whiteboard: [checkin needed]
Comment 7•18 years ago
|
||
mozilla/content/base/src/nsXMLHttpRequest.cpp 1.179
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Whiteboard: [checkin needed]
Target Milestone: --- → mozilla1.9alpha5
Comment 8•17 years ago
|
||
I got a complaint in a forum that this breaks multipart/form-data requests. Is there any way to prevent charset from being added? This could be also an issue when the sender sets the charset header himself because he knows the encoding of the stream (unlike XMLHttpRequest which always assumes UTF-8).
Assignee | ||
Comment 9•17 years ago
|
||
(In reply to comment #8)
> I got a complaint in a forum that this breaks multipart/form-data requests. Is
> there any way to prevent charset from being added? This could be also an issue
> when the sender sets the charset header himself because he knows the encoding
> of the stream (unlike XMLHttpRequest which always assumes UTF-8).
>
Actually it shouldn't always assume UTF-8 but it will if for some reason the charset of the document isn't returned by |baseDoc->GetDocumentCharacterSet()|
Comment 10•17 years ago
|
||
I think most times you send a multipart/form-data request the data will be read from a stream and not from a document. Streams don't have any charset data associated with them.
Assignee | ||
Comment 11•17 years ago
|
||
(In reply to comment #10)
> I think most times you send a multipart/form-data request the data will be read
> from a stream and not from a document. Streams don't have any charset data
> associated with them.
>
That's a good point. I guess we could only append the charset if we have a document and not a stream but I'm not sure if that would be much better than simply not setting it at all.
Comment 12•17 years ago
|
||
If you set a charset, the recipient MUST (in the RFC sense) honor it. If not, it can try to guess it from the data. So if you don't know the charset, don't set it.
Is there a bug on this followup issue? It should block 1.9, imo.
Assignee | ||
Comment 13•17 years ago
|
||
(In reply to comment #12)
> If you set a charset, the recipient MUST (in the RFC sense) honor it. If not,
> it can try to guess it from the data. So if you don't know the charset, don't
> set it.
>
> Is there a bug on this followup issue? It should block 1.9, imo.
>
That's a simple fix, just don't set the UTF-8 default and check is the charSet is null before we add the charset information.
If someone fills a new bug please either cc me too it or mark me as the assignee and I'll get a patch up for that. Thanks.
Comment 14•17 years ago
|
||
I filed the bug, but given that this is your regression, you should really not have made others spend time on it, imo...
Updated•12 years ago
|
Component: DOM: Mozilla Extensions → DOM
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•