lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> I've already binded curl to LUA for FreePOPs
> 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:setopt(curl.OPT_USERPWD, ...)
(as Rici suggested)
c["userpwd"]=... | c.userpwd=...

#define ALL_CURL_OPT \
	C_OPT(URL, string) \
	C_OPT(PORT, number) \
	C_OPT(PROXY, string) \
	C_OPT(USERPWD, string) \
	C_OPT(RANGE, string) \
	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,

Get your free email at