Bug 23182 - [CURL] POST without body becomes GET
Summary: [CURL] POST without body becomes GET
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-08 08:17 PST by Adam Bergkvist
Modified: 2009-01-09 19:48 PST (History)
0 users

See Also:


Attachments
Makes sure method is always set to POST in setupPOST(). (2.54 KB, patch)
2009-01-08 08:49 PST, Adam Bergkvist
zecke: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Bergkvist 2009-01-08 08:17:30 PST
When doing a POST using XMLHttpRequest and sending null or an empty string as body, the method is never set to POST in ResourceHandleManager::setupPOST() (WebCore/platform/network/curl/ResourceHandleManager.cpp).

This will make the POST method test on http://www.mnot.net/javascript/xmlhttprequest/ fail since the method sent is GET.
Comment 1 Adam Bergkvist 2009-01-08 08:49:04 PST
Created attachment 26523 [details]
Makes sure method is always set to POST in setupPOST().
Comment 2 Holger Freyther 2009-01-08 23:52:23 PST
The only thing that saddens me is this would have been caugh with the http tests in the LayoutTest directory but we do not run them...
Comment 3 Holger Freyther 2009-01-08 23:56:19 PST
Comment on attachment 26523 [details]
Makes sure method is always set to POST in setupPOST().


> +    if (!job->request().httpBody())
> +        return;

This does not look correct. An empty PUT will not be finished and the ResourceHandle will be leaked? Could you explain that?
Comment 4 Adam Bergkvist 2009-01-09 02:10:28 PST
(In reply to comment #3)

I'm not sure I follow.. 
Instead of creating a Vector that is never assigned in case of job->request().httpBody() being null and checking that it has zero elements before returning, I thought it would be better to just return directly.


Comment 5 Holger Freyther 2009-01-09 11:40:58 PST
Comment on attachment 26523 [details]
Makes sure method is always set to POST in setupPOST().

You are right.
Comment 6 Holger Freyther 2009-01-09 19:48:36 PST
Landed in r39774.