Closed (fixed)
Project:
Http Client
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
18 Oct 2011 at 15:29 UTC
Updated:
22 Aug 2012 at 14:45 UTC
Jump to comment: Most recent file
In the HttpClientCurlDelegate class when executing a CURL request POST data is always added with curl_setopt($ch, CURLOPT_POSTFIELDS, $request->data);.
While a request without CURLOPT_POSTFIELDS would look like
> GET /api/ HTTP/1.1
User-Agent: Drupal (+http://drupal.org/)
Host: 192.168.0.8
Accept: application/xml
CURL automatically adds a Content-Length: 0 and a Content-Type: application/x-www-form-urlencoded header:
> GET /api/ HTTP/1.1
User-Agent: Drupal (+http://drupal.org/)
Host: 192.168.0.8
Accept: application/xml
Content-Length: 0
Content-Type: application/x-www-form-urlencoded
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | http_client-POST-data-is-always-added-to-a-CURL-request-1313374-38.patch | 1.42 KB | sanduhrs |
| #2 | curlopt_postfields-1313374-2.patch | 695 bytes | sanduhrs |
| #1 | curlopt_postfields-1313374-1.patch | 695 bytes | sanduhrs |
Comments
Comment #1
sanduhrsAdding post data only if not empty fixes the problem for me.
Patch attached, please review.
Comment #2
sanduhrsWell to more more accurate, we could also check f it's not NULL.
Patch attached.
Comment #3
sanduhrsI'm trying to communicate with a BigBlueButton server which fails for GET requests because of the added POST data.
This behavior seems to be common.
It is even documented in drupal_http_request():
Added the above comment to the patch and adjusted the if statement accordingly.
Please review.
Comment #39
Hugo Wetterberg commentedFixed in 7.x-2.4
Comment #40
Hugo Wetterberg commented