LuaSocket HTTP module

LuaSocket HTTP module

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

LuaSocket HTTP module

Post by gajop »

Lua socket has support for HTTP: http://w3.impa.br/~diego/software/luasocket/http.html , and I'd like it to be added to Spring.
It's currently implemented in Lua (https://github.com/diegonehab/luasocket ... c/http.lua), so it shouldn't be that hard, although it seems these files haven't been added/migrated to the repo (https://github.com/spring/spring/tree/0 ... socket/src)
Imo the best way to do it is to simply include it in socket.http once Spring is initialized assuming lua sockets are enabled.

For now I'll probably use something like https://github.com/spring/spring/blob/0 ... et.lua#L95 to achieve HTTP for what I need, but real support should be added in the future.
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: LuaSocket HTTP module

Post by abma »

why no lua interface for curl?

https://github.com/Lua-cURL/Lua-cURLv3

this pulls in a c dependency, too, not sure if a lua-only implementation is better.
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: LuaSocket HTTP module

Post by gajop »

abma wrote:why no lua interface for curl?

https://github.com/Lua-cURL/Lua-cURLv3

this pulls in a c dependency, too, not sure if a lua-only implementation is better.
Not sure if it makes sense to use this if we already have Lua sockets that supports it (admittedly doing it via native Lua is probably slower).
I think we should avoid extra engine dependencies when we can, and only consider adding it if there's a significant performance boost or additional features.
PS: I played a bit with writing an analytics API in Lua, and it's interesting how simple it is to write JSONRPC using mostly just luasockets. That said, it's still rather limited and I'd want *real* http support that covers all the corner cases. This is how some graphs look like: http://ec2-52-24-31-116.us-west-2.compu ... onaws.com/
Post Reply

Return to “Engine”