Re: New project LuaCURL v1.0 is up (Enrico Tassi)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: New project LuaCURL v1.0 is up (Enrico Tassi)

Alexander Marinov
> I've already binded curl to LUA for FreePOPs http://www.freepops.org
> you can find the sources in the modules/src/curl_lua directory of the
> freepops tarball.
I'm happy I haven't found your luacurl earlier, because I wouldn't have made my personal training : )

I took a look at your sources and they look great.
The idea to generate binding modules according to a specific curl version is excellent.

> I've no time to have a look at your work, but at least one thing you
> may copy from my work: 
I can't copy your work, because the sources are GPL : (

>no c:close() is needed.
c:close is not required, but doesn't hurt

>my bindings are not really up to date (may miss som new CURL flags),
>but they have been used with different old versions, so the bunch of
>#ifdefs to make them compile against old CURL versions may help.

The problem with my bind is the opposite - older curl versions are not supported, which is a serious problem.
But the concept of my implementation is quite simple and easy adoptable.
All curl options are "macroised" and cited only once, except the few callbacks, where special actions are taken.
Here is a small piece of the option list. Using this way it is very easy to add/remove options (according the current curl version)
Beside the option name the option type is required, so appropriate errors to be displayed on type mismatches.
And also it helps with easy experimenting with different option handling concepts: e.g. 
c=curl.new()
c:setopt(curl.OPT_USERPWD, ...)
or
(as Rici suggested)
c:setopt("userpwd",...)
or
c["userpwd"]=... | c.userpwd=...


#define ALL_CURL_OPT \
	C_OPT_SPECIAL(WRITEDATA) \
	C_OPT(URL, string) \
	C_OPT(PORT, number) \
	C_OPT(PROXY, string) \
	C_OPT(USERPWD, string) \
	C_OPT(PROXYUSERPWD, string) \
	C_OPT(RANGE, string) \
	C_OPT_SPECIAL(READDATA) \
	C_OPT_SPECIAL(WRITEFUNCTION) \
	C_OPT_SPECIAL(READFUNCTION) \
	C_OPT(TIMEOUT, number) \
	C_OPT(INFILESIZE, number) \
...

It seems we both skipped some curl features as 
curl multi, curl shared, debug, curl_info, which means 
merging both implementations is not a sollution.

I will ask luaforge admin to drop my luacurl project when you
1. add progress callback
2. remove the GPL license 
: )

It's not a problem for me, my goal is only to learn more


Best Regards,
alek


_____________________________________________________________
Get your free email at http://www.crazyland.com