Status
This module include three layer
lcurl
module provide low level pure C binding to libcurl.
Almost ready and needs tests. I have no plans to change this API.cURL
module provide compatibility for Lua-cURLv2 API.
Almost ready and needs tests.cURL
module provide new high level API.
In fact for now it providelcurl
API directly and needed to redesign.
Documentation
lcurl API
Lua-cURLv2 API
Lua-cURLv3 API
Original Lua-cURLv2 binding has several problems:
- it can not return error codes but just raise Lua errors (Fixed. use
cURL.safe
module) - it raise Lua error from callback that may result resource leak in libcurl (Fixed.)
- it does not provide building multipart/formdata explicitly (Fixed.)
- it has memory leak when send multipart/formdata (Fixed.)
- it does not save string for curl options that may result crush in libcurl (Fixed.)
- there no way to get result for operations in multi interface (e.g. if one of easy operation fail you can not get result code/error message) (Fixed. But it does not very handy interface.)
- you can not use your own callback function to perform operation with multi interface (Could not be fixed without changing API.)
- you can not pass your context to callback functions (Could not be fixed without changing API.)
List of incompatibility with original Lua-cURLv2
- objects are tables
- multi:perform() also returns (“done”,code), (“error”,error) and (“response”,code) records
- writer callback does not recv string len (just string itself)
- on Lua > 5.2 errors are objects but not strings