This is a small change, but it would make a big difference for me:

In includes/HttpClientCurlDelegate.inc, move the curl_setopt_array($ch, $curlopts) line to the end of the method, just before the return statement.

This would allow any options sent to be able to override the default settings set within the method itself.

For example, I had to implement the technique described at http://matthom.com/archive/2008/12/29/php-curl-disable-100-continue-expe..., and it would not work until I moved that line.

The resulting method would look like:

  public function curl(HttpClientRequest $request, $curlopts) {
    $ch = curl_init();
		
    curl_setopt($ch, CURLOPT_USERAGENT, 'Drupal (+http://drupal.org/)');
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $request->method);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL, $request->url());
    curl_setopt($ch, CURLOPT_POSTFIELDS, $request->data);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $request->getHeaders());
		
	  curl_setopt_array($ch, $curlopts);	
		
	  return $ch;
  }

Comments

Hugo Wetterberg’s picture

Status: Active » Closed (fixed)

Fixed in 2.4