Re: FFI, cURL and function callback

  • From: Daurnimator <quae@xxxxxxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Wed, 27 Mar 2013 11:12:40 -0400

I should jump in here with a reminder of the existence of fend
(https://github.com/chatid/fend)
Low level functions for any server/main loop. Includes file io,
sockets, dns, ssl.
All done via ffi.

It's in a basic working state, and I've got a couple of applications
running on top of it.
Needs more polish before a release, if anyone wants to help out I'm
not going to turn them away ;)

D

On 27 March 2013 05:25, Pierre Chapuis <catwell@xxxxxxxxxxxx> wrote:
> On Tue, 26 Mar 2013 19:59:20 +0100, Justin Cormack
> <justin@xxxxxxxxxxxxxxxxxxxxx> wrote:
>
>> Right now for that I would use the Lua module for Nginx. I wish Nginx had
>> been written as a library so you could invert control and call from Lua,
>> but aside from that it provides everything and with a quality http
>> implementation that you don't need to put er Nginx in front of for
>> security.
>
> +1 for HTTP servers. But what we need is:
>
>  * lower-level protocols support (TCP, UDP...)
>  * an HTTP client library
>
> The HTTP client library could build on the lower-level library.
> I think the standard interface at the lower level is sockets and
> it should stay that way.
>
> There are a few interesting contenders in that field, including
> lua-llnet [1] and the recently announced lsocket [2].
> I don't think any of these is as advanced as luasocket though.
>
> cURL bindings are another possibility. When it comes to
> networking, especially for clients, it is the obvious solution.
>
> About libuv wrappers, there have been attempts at that including
> creationix's [3] and Richard Hundt's [4] (that have the same name...)
>
> I don't have strong opinions about what a low-level network
> library should look like, although I think it should roughly
> follow the socket interface. Also, ltn12 is an amazing interface
> that we should definitely make use of.
>
> I have stronger opinions about HTTP client libraries, having
> contributed to (and used) a lot of them in many different
> languages. The best of the kind is Requests, and if you want
> to write such a library you should definitely see a talk about
> it by its author [5].
>
> Anyway, these are just a few thoughts. All in all I think
> luasocket is not too bad. It lacks features but it is relatively
> easy to extend ([6], [7]).
>
> I have not really tried the alternatives such as lua-llnet
> or lsocket, I will probably try them though because this
> thread and the release made me curious.
>
> However luasocket is a kind of standard in the Lua world,
> which is kind of a rare thing in our ecosystem :)
> So I think maybe we should not be too eager to replace it by
> something else, and try to keep it up to date instead.
>
> [1] https://github.com/Neopallium/lua-llnet
> [2] http://www.tset.de/lsocket/
> [3] https://github.com/creationix/luv
> [4] https://github.com/richardhundt/luv
> [5] https://speakerdeck.com/kennethreitz/python-for-humans
> [6] https://github.com/catwell/lua-multipart-post
> [7] https://github.com/catwell/lua-http-digest
>
> --
> Pierre Chapuis
>
>

Other related posts: