Closed
Bug 455318
Opened 17 years ago
Closed 17 years ago
xmlHttpRequest adds charset=UTF-8 to user-supplied Content-Type header regardless
Categories
(Firefox :: General, defect)
Firefox
General
Tracking
()
RESOLVED
DUPLICATE
of bug 416178
People
(Reporter: paul.downey, Unassigned)
Details
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_4; en-us) AppleWebKit/528.4+ (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1
XMLHTTPRequest blindly asserts a charset of UTF-8 to a user-supplied Content-Type header.
This causes issues with existing servers, some of which only accept a Content-Type of "application/x-www-form-urlencoded". In some cases it is not possible to change the server firmware, meaning users being advised not to use Firefox 3 or later.
The charset of UTF-8 is asserted, even when a different charset is supplied using setRequestHeader.
This doesn't mirror the behavior of a HTTP POST form, which simply sends "Content-Type: application/x-www-form-urlencoded" and consequently is backwards compatible with existing servers.
Reproducible: Always
Steps to Reproduce:
var req = new XMLHttpRequest();
req.open('POST', 'http://example.com/', true);
req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
req.send(data);
Actual Results:
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Expected Results:
Content-Type: application/x-www-form-urlencoded
This behavior was introduced in Firefox 3, possibly as a result of the report "Bug 241540 - No charset encoding sent for application/x-www-form-urlencoded data" https://bugzilla.mozilla.org/show_bug.cgi?id=241540&GoAheadAndLogIn=1
Updated•17 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•