Bug 3812

Summary: XMLHttpRequest: PUT, DELETE, HEAD and all other methods but POST actually do a GET
Product: WebKit Reporter: Henri Sivonen <hsivonen>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Major CC: adam, adam, ap, bugs-webkit, cdumez, gabor.farkas, imarkroger, jacmesj, jeff, michaelhill789, pswag994, raokrishnavasudeva, rsneha027, sen, stuartmorgan, svillar, yagmurcanayakin
Priority: P2    
Version: 312.x   
Hardware: Mac   
OS: OS X 10.3   
Bug Depends on:    
Bug Blocks: 7390    
Attachments:
Description Flags
proposed patch
none
proposed patch darin: review+

Henri Sivonen
Reported 2005-07-02 05:15:32 PDT
Steps to reproduce: 1) Try to do a PUT or a DELETE using XMLHttpRequest. Actual results: A GET request is issued. Expected results: Expected the full suite of HTTP verbs to be supported or at least the API to fail detectably when a verb is not supported. Additional information: In order to implement a client for a clean RESTful Web service supporting full CRUD capabilities, PUT and DELETE are needed, too.
Attachments
proposed patch (35.95 KB, patch)
2006-02-28 11:05 PST, Alexey Proskuryakov
no flags
proposed patch (36.44 KB, patch)
2006-02-28 22:29 PST, Alexey Proskuryakov
darin: review+
Adam Trachtenberg
Comment 1 2005-07-25 09:11:57 PDT
This also applies to other verbs not explicitly defined in the HTTP spec, such as SEARCH used in HTTP-DAV. In my case, this prevents me from writing a client to access Microsoft Exchange servers.
Stuart Morgan
Comment 2 2005-09-04 10:22:08 PDT
Comfirmed in ToT by source inspection; anything unknown is treated as a GET.
Eric Seidel (no email)
Comment 3 2005-12-27 14:23:24 PST
Would be nice to have a test case. Although w/o server side support, that might be hard.
Alexey Proskuryakov
Comment 4 2006-01-05 06:55:35 PST
Writing a synthetic test shouldn't be too hard (one could take one from bug 3810 as a model), but it would be very helpful to have an example of a "real life" application that uses this.
Alexey Proskuryakov
Comment 5 2006-02-20 12:05:34 PST
*** Bug 7390 has been marked as a duplicate of this bug. ***
Alexey Proskuryakov
Comment 6 2006-02-28 11:05:45 PST
Created attachment 6776 [details] proposed patch There are some differences between this implementaion and Firefox: 1) For null data, "Content-Length: 0" header is sent (isn't sent in Firefox). Looks like better behavior to me; besides, I don't think we have a choice, because this header is added by NSURLConnection. 2) HEAD is not implemented - there seems to be a crashing bug in NSURLConnection, <rdar://4460899>. 3) After #2 is fixed, we won't be sending a body in HEAD requests, just like we don't send it in GET ones. Firefox ignores the body in GET requests, but sends it in HEAD ones, which looks like a bug to me. Also fixed a bug: send(null) was actually sending characters "null" instead of an empty body.
Darin Adler
Comment 7 2006-02-28 22:17:38 PST
Comment on attachment 6776 [details] proposed patch Should use String instead of QString in new code, like the new parameter to TransferJob. String converts itself into NSString without even calling getNSString().
Alexey Proskuryakov
Comment 8 2006-02-28 22:29:03 PST
Created attachment 6786 [details] proposed patch Addressed the comments.
Darin Adler
Comment 9 2006-03-01 08:42:11 PST
Comment on attachment 6786 [details] proposed patch Change looks fine as is, but I have three comments: 1) Is there a test for the change in JSXMLHttpRequest.cpp? That change looks fine, but I'd like to see a test that was broken before and fixed now. 2) Since method is now a String you can use equalIgnoringCase rather than calling lower when comparing the method with head. 3) I would like the client pointer to be the first parameter to TransferJob and the method the second parameter, because the client pointer sort of a "back pointer to the claler" while the rest of the parameters are the specification of what the job is to do. The most important of these three is (1), but I think none are a big enough deal to prevent landing the patch. I'll say r=me.
Alexey Proskuryakov
Comment 10 2006-03-01 09:51:45 PST
(In reply to comment #9) 1) Yes, the tests call send(null) for all methods, and there were a lot of failures before I fixed this. 2) Actually, method in XMLHTTPRequest class is still a QString, I haven't changed it. 3) Done.
Sergio Villar Senin
Comment 11 2011-02-09 04:04:43 PST
Sergio Villar Senin
Comment 12 2011-02-09 04:08:00 PST
(In reply to comment #11) > Committed r78043: <http://trac.webkit.org/changeset/78043> Sorry for the noise. I just mentioned this bug in a ChangeLog, it seems that webkit-patch was too smart this time.
Alexey Proskuryakov
Comment 13 2011-02-09 08:45:23 PST
This still remains fixed :)
Lucas Forschler
Comment 21 2019-02-06 09:03:05 PST
Mass moving XML DOM bugs to the "DOM" Component.
Note You need to log in before you can comment on or make changes to this bug.