Take the best parts of the cURL request function from https://github.com/coldfrontlabs/restclient and merge them with cURL. The end result is to have cURL be the request plugin for RESTClient.

At the same time, refactoring the code a bit to make it easier to manage and write tests against.

Comments

minoroffense’s picture

Done my first round of refactoring and code merging. I created a separate branch to do so. (7.x-restclient-merge).

A quick rundown of the changes:

- Broke up the request method into major parts (i.e. set headers, set options, set method) to more easily test and read the code
- Added new array parameter to accept any curl options
- Added admin UI toggle to override drupal_http_request (requires Drupal 7.21 or higher)
- Switched from using array of settings to simply calling curl_setopt
- Added request debug mode. Uses dpm() to output the curl http request/response object when enabled. This can be toggled on/off on the admin page

More to come.

minoroffense’s picture

Next up is to optimize the header parsing. Regex are expensive and we can get away with using substr which is much faster. We simply use the header and content length values coming back from the request.

minoroffense’s picture

Status: Active » Patch (to be ported)

Done.

Now to backport to 6.x and see about making an 8.x version.

minoroffense’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
minoroffense’s picture

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