Closed Bug 377671 Opened 17 years ago Closed 8 years ago

XMLHttpRequest request truncated at null character ('\0')

Categories

(Core :: XML, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: h2g2bob, Unassigned)

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-UK; rv:1.8.1.3) Gecko/20070310 Iceweasel/2.0.0.3 (Debian-2.0.0.3-2) It was me, I was the turkey all along
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-UK; rv:1.8.1.3) Gecko/20070310 Iceweasel/2.0.0.3 (Debian-2.0.0.3-2)




//create a string containing a NULL character
var text = "WELCOME" + String.fromCharCode(0) + "HELLO WORLD!!";
alert("Text length is " + String(text.length));

//send text as POST to example.com
var hx = new XMLHttpRequest;
hx.open('POST', "http://example.com", true);
hx.onreadystatechange = function () { ; }
hx.setRequestHeader("Content-Type", "application/x-example");
hx.send(text);

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Code above only sends "WELCOME" part and stops at NULL character. If string starts with zero char then no data part is sent.
Summary: XMLHttpRequest incorrectly handles characcer 0 → XMLHttpRequest incorrectly handles character 0 for HTTP POST
Assignee: nobody → xml
Component: General → XML
Product: Firefox → Core
QA Contact: general → ashshbhatt
Summary: XMLHttpRequest incorrectly handles character 0 for HTTP POST → XMLHttpRequest request truncated at null character ('\0')
Assignee: xml → nobody
QA Contact: ashshbhatt → xml
It seems this bug can be closed. On today's nightly, the example above now sends the full text to the server (confirmed with a trivial PHP script that simply outputs the POST body it received).
Flags: needinfo?(bugs)
Feel free to resolve as worksforme. If there are still issues, one can always reopen the bug or file a new one.
Flags: needinfo?(bugs)
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.