Patch (to be ported)
Project:
cURL HTTP Request
Version:
8.x-1.x-dev
Component:
Code
Priority:
Minor
Category:
Task
Assigned:
Reporter:
Created:
16 Apr 2013 at 02:50 UTC
Updated:
27 Oct 2013 at 22:33 UTC
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
Comment #1
minoroffense commentedDone 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.
Comment #2
minoroffense commentedNext 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.
Comment #3
minoroffense commentedDone.
Now to backport to 6.x and see about making an 8.x version.
Comment #4
minoroffense commentedComment #5
minoroffense commented