The $options array passed into the curl_http_request function has a key called data. The doc comment for both curl_http_request and the drupal_http_request function says this data value should be an encoded string. The curl_http_request function deals with this as an array when posting and passes it to the drupal_http_build_query function that must take an array as its first argument. Since this is a string it causes a fatal PHP error.

Comments

johnennew’s picture

Status: Active » Needs review
StatusFileSize
new654 bytes

The following patch stops the string being passed to drupal_http_build_query on a POST request if it is already a string. This should not break any implementations that assume this can be an array.

dariogcode’s picture

Also in line 154 script assumes "data" is an string, not an array.

$content_length = strlen($options['data']);
gambaweb’s picture

StatusFileSize
new461 bytes

to be compatible with drupal_http_request the data when using POST should come as a query string

data: A string containing the request body, formatted as 'param=value&param=value&...'. Defaults to NULL.

http://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_http_request/7
the attached patch fixes chr to be compatible with that.

Taz’s picture

Status: Needs review » Reviewed & tested by the community

The patch in #3 is still valid and good.
Very simple fix to bring this module in-line with what drupal_http_request() expects.

minoroffense’s picture

Status: Reviewed & tested by the community » Patch (to be ported)

I've committed the change to the 7.x-1.x branch. It's a rather big rewrite so I manually applied the change but still gave you the attribution.

I've also done the same change for PUT requests.

Next is to port to 6.x

minoroffense’s picture

Version: 7.x-1.5 » 6.x-1.x-dev
Priority: Critical » Normal
minoroffense’s picture

Version: 6.x-1.x-dev » 8.x-1.x-dev
Priority: Normal » Minor