Bug 23182

Summary: [CURL] POST without body becomes GET
Product: WebKit Reporter: Adam Bergkvist <adam.bergkvist>
Component: PlatformAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Makes sure method is always set to POST in setupPOST(). zecke: review+

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.