XMLHttpRequest only supports HTTP GET, POST

VERIFIED FIXED in mozilla0.9.9

Status

()

Core
XML
P2
normal
VERIFIED FIXED
16 years ago
15 years ago

People

(Reporter: Matthew Wilson, Assigned: Heikki Toivonen (remove -bugzilla when emailing directly))

Tracking

Trunk
mozilla0.9.9
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

669 bytes, patch
Heikki Toivonen (remove -bugzilla when emailing directly)
: review+
Darin Fisher
: superreview+
Details | Diff | Splinter Review
(Reporter)

Description

16 years ago
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US) Gecko/20011221
BuildID:    2001122106

The XMLHttpRequest object only supports HTTP GET and POST. If an HTTP DELETE
request is constructed, it is transformed into a POST.

Reproducible: Always
Steps to Reproduce:
Run a script such as the following:

var xmlhttpdelete = new XMLHttpRequest();
xmlhttpdelete.open ("DELETE", "http://localhost");
var deletestr =
Components.classes["@mozilla.org/supports-wstring;1"].createInstance(Components.interfaces.nsISupportsWString);
deletestr.data = '';
xmlhttpdelete.send(deletestr);


Actual Results:  Web server access log shows a POST request being made.

Expected Results:  DELETE request should have been made.

It appears that the request method is correct until the call to SetUploadStream,
which changes it to POST.

http://lxr.mozilla.org/seamonkey/source/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp#1043
(Reporter)

Comment 1

16 years ago
Created attachment 67879 [details] [diff] [review]
Proposed patch
I don't really know what HTTP commands we support, and is this a safe way to do
this, or if there is a preferred way. Adding darin to Cc. Darin, if you think
this is ok, just slap sr, otherwise it would be great if you could educate us ;)

Comment 3

16 years ago
Comment on attachment 67879 [details] [diff] [review]
Proposed patch

sr=darin... looks good to me.
Attachment #67879 - Flags: superreview+
Comment on attachment 67879 [details] [diff] [review]
Proposed patch

Ok, in that case it is also r=heikki.

Do you want me to check this in for you?
Attachment #67879 - Flags: review+
(Reporter)

Comment 5

16 years ago
Yes please.
Checked in. I also fixed the comments in the IDL file to just give GET and POST
as examples, not the only supported commands.
Status: NEW → RESOLVED
Last Resolved: 16 years ago
OS: Windows NT → All
Priority: -- → P2
Hardware: PC → All
Resolution: --- → FIXED
Target Milestone: --- → mozilla0.9.9

Updated

15 years ago
QA Contact: petersen → rakeshmishra

Comment 7

15 years ago
Verified fixed on the trunk build 2002-12-17-08-trunk on win2K , using the
following test case : 

<html>
<body>
<script>
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var xmlhttpdelete = new XMLHttpRequest();
//xmlhttpdelete.open ("DELETE", "http://localhost");
xmlhttpdelete.open ("DELETE", "http://www.google.com");
//var deletestr
=Components.classes["@mozilla.org/supports-wstring;1"].createInstance(Components.interfaces.nsISupportsWString);
//deletestr.data = ' ';
//xmlhttpdelete.send(deletestr);
xmlhttpdelete.send(' ');
</script>
</body>
</html>

Response data:
0[235f68]: http request [
0[235f68]:   DELETE / HTTP/1.1
0[235f68]:   Host: www.google.com
0[235f68]:   User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
rv:1.3b) Gecko/20021217 Netscape/7.0+
0[235f68]:   Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=
0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1


marking verified
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.